Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/interp_masm_sparc.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. |
1293 #ifndef CC_INTERP | 1293 #ifndef CC_INTERP |
1294 | 1294 |
1295 // Get the method data pointer from the methodOop and set the | 1295 // Get the method data pointer from the methodOop and set the |
1296 // specified register to its value. | 1296 // specified register to its value. |
1297 | 1297 |
1298 void InterpreterMacroAssembler::set_method_data_pointer_offset(Register Roff) { | 1298 void InterpreterMacroAssembler::set_method_data_pointer() { |
1299 assert(ProfileInterpreter, "must be profiling interpreter"); | 1299 assert(ProfileInterpreter, "must be profiling interpreter"); |
1300 Label get_continue; | 1300 Label get_continue; |
1301 | 1301 |
1302 ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr); | 1302 ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr); |
1303 test_method_data_pointer(get_continue); | 1303 test_method_data_pointer(get_continue); |
1304 add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr); | 1304 add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr); |
1305 if (Roff != noreg) | |
1306 // Roff contains a method data index ("mdi"). It defaults to zero. | |
1307 add(ImethodDataPtr, Roff, ImethodDataPtr); | |
1308 bind(get_continue); | 1305 bind(get_continue); |
1309 } | 1306 } |
1310 | 1307 |
1311 // Set the method data pointer for the current bcp. | 1308 // Set the method data pointer for the current bcp. |
1312 | 1309 |
1313 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { | 1310 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
1314 assert(ProfileInterpreter, "must be profiling interpreter"); | 1311 assert(ProfileInterpreter, "must be profiling interpreter"); |
1315 Label zero_continue; | 1312 Label zero_continue; |
1316 | 1313 |
1317 // Test MDO to avoid the call if it is NULL. | 1314 // Test MDO to avoid the call if it is NULL. |
1318 ld_ptr(Lmethod, methodOopDesc::method_data_offset(), ImethodDataPtr); | 1315 ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr); |
1319 test_method_data_pointer(zero_continue); | 1316 test_method_data_pointer(zero_continue); |
1320 call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), Lmethod, Lbcp); | 1317 call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), Lmethod, Lbcp); |
1321 set_method_data_pointer_offset(O0); | 1318 add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr); |
1319 add(ImethodDataPtr, O0, ImethodDataPtr); | |
1322 bind(zero_continue); | 1320 bind(zero_continue); |
1323 } | 1321 } |
1324 | 1322 |
1325 // Test ImethodDataPtr. If it is null, continue at the specified label | 1323 // Test ImethodDataPtr. If it is null, continue at the specified label |
1326 | 1324 |
1367 bind(verify_continue); | 1365 bind(verify_continue); |
1368 #endif // ASSERT | 1366 #endif // ASSERT |
1369 } | 1367 } |
1370 | 1368 |
1371 void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count, | 1369 void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count, |
1372 Register cur_bcp, | |
1373 Register Rtmp, | 1370 Register Rtmp, |
1374 Label &profile_continue) { | 1371 Label &profile_continue) { |
1375 assert(ProfileInterpreter, "must be profiling interpreter"); | 1372 assert(ProfileInterpreter, "must be profiling interpreter"); |
1376 // Control will flow to "profile_continue" if the counter is less than the | 1373 // Control will flow to "profile_continue" if the counter is less than the |
1377 // limit or if we call profile_method() | 1374 // limit or if we call profile_method() |
1398 cmp(invocation_count, Rtmp); | 1395 cmp(invocation_count, Rtmp); |
1399 br(Assembler::lessUnsigned, false, Assembler::pn, profile_continue); | 1396 br(Assembler::lessUnsigned, false, Assembler::pn, profile_continue); |
1400 delayed()->nop(); | 1397 delayed()->nop(); |
1401 | 1398 |
1402 // Build it now. | 1399 // Build it now. |
1403 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), cur_bcp); | 1400 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); |
1404 set_method_data_pointer_offset(O0); | 1401 set_method_data_pointer_for_bcp(); |
1405 ba(false, profile_continue); | 1402 ba(false, profile_continue); |
1406 delayed()->nop(); | 1403 delayed()->nop(); |
1407 bind(done); | 1404 bind(done); |
1408 } | 1405 } |
1409 | 1406 |