33 #include "interpreter/bytecode.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/oopMapCache.hpp"
36 #include "memory/allocation.inline.hpp"
37 #include "memory/oopFactory.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "oops/method.hpp"
40 #include "oops/objArrayOop.inline.hpp"
41 #include "oops/oop.inline.hpp"
42 #include "oops/fieldStreams.hpp"
43 #include "oops/verifyOopClosure.hpp"
44 #include "prims/jvmtiThreadState.hpp"
45 #include "runtime/biasedLocking.hpp"
46 #include "runtime/compilationPolicy.hpp"
47 #include "runtime/deoptimization.hpp"
48 #include "runtime/interfaceSupport.hpp"
49 #include "runtime/sharedRuntime.hpp"
50 #include "runtime/signature.hpp"
51 #include "runtime/stubRoutines.hpp"
52 #include "runtime/thread.hpp"
53 #include "runtime/vframe.hpp"
54 #include "runtime/vframeArray.hpp"
55 #include "runtime/vframe_hp.hpp"
56 #include "utilities/events.hpp"
57 #include "utilities/xmlstream.hpp"
58
59 #if INCLUDE_JVMCI
60 #include "jvmci/jvmciRuntime.hpp"
61 #include "jvmci/jvmciJavaClasses.hpp"
62 #endif
63
64
65 bool DeoptimizationMarker::_is_active = false;
66
67 Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
68 int caller_adjustment,
69 int caller_actual_parameters,
70 int number_of_frames,
71 intptr_t* frame_sizes,
72 address* frame_pcs,
1280 collect_monitors(cvf, objects_to_revoke);
1281 cvf = compiledVFrame::cast(cvf->sender());
1282 }
1283 collect_monitors(cvf, objects_to_revoke);
1284
1285 if (SafepointSynchronize::is_at_safepoint()) {
1286 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1287 } else {
1288 BiasedLocking::revoke(objects_to_revoke);
1289 }
1290 }
1291
1292
1293 void Deoptimization::revoke_biases_of_monitors(CodeBlob* cb) {
1294 if (!UseBiasedLocking) {
1295 return;
1296 }
1297
1298 assert(SafepointSynchronize::is_at_safepoint(), "must only be called from safepoint");
1299 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1300 for (JavaThread* jt = Threads::first(); jt != NULL ; jt = jt->next()) {
1301 if (jt->has_last_Java_frame()) {
1302 StackFrameStream sfs(jt, true);
1303 while (!sfs.is_done()) {
1304 frame* cur = sfs.current();
1305 if (cb->contains(cur->pc())) {
1306 vframe* vf = vframe::new_vframe(cur, sfs.register_map(), jt);
1307 compiledVFrame* cvf = compiledVFrame::cast(vf);
1308 // Revoke monitors' biases in all scopes
1309 while (!cvf->is_top()) {
1310 collect_monitors(cvf, objects_to_revoke);
1311 cvf = compiledVFrame::cast(cvf->sender());
1312 }
1313 collect_monitors(cvf, objects_to_revoke);
1314 }
1315 sfs.next();
1316 }
1317 }
1318 }
1319 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1320 }
|
33 #include "interpreter/bytecode.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/oopMapCache.hpp"
36 #include "memory/allocation.inline.hpp"
37 #include "memory/oopFactory.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "oops/method.hpp"
40 #include "oops/objArrayOop.inline.hpp"
41 #include "oops/oop.inline.hpp"
42 #include "oops/fieldStreams.hpp"
43 #include "oops/verifyOopClosure.hpp"
44 #include "prims/jvmtiThreadState.hpp"
45 #include "runtime/biasedLocking.hpp"
46 #include "runtime/compilationPolicy.hpp"
47 #include "runtime/deoptimization.hpp"
48 #include "runtime/interfaceSupport.hpp"
49 #include "runtime/sharedRuntime.hpp"
50 #include "runtime/signature.hpp"
51 #include "runtime/stubRoutines.hpp"
52 #include "runtime/thread.hpp"
53 #include "runtime/threadSMR.hpp"
54 #include "runtime/vframe.hpp"
55 #include "runtime/vframeArray.hpp"
56 #include "runtime/vframe_hp.hpp"
57 #include "utilities/events.hpp"
58 #include "utilities/xmlstream.hpp"
59
60 #if INCLUDE_JVMCI
61 #include "jvmci/jvmciRuntime.hpp"
62 #include "jvmci/jvmciJavaClasses.hpp"
63 #endif
64
65
66 bool DeoptimizationMarker::_is_active = false;
67
68 Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
69 int caller_adjustment,
70 int caller_actual_parameters,
71 int number_of_frames,
72 intptr_t* frame_sizes,
73 address* frame_pcs,
1281 collect_monitors(cvf, objects_to_revoke);
1282 cvf = compiledVFrame::cast(cvf->sender());
1283 }
1284 collect_monitors(cvf, objects_to_revoke);
1285
1286 if (SafepointSynchronize::is_at_safepoint()) {
1287 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1288 } else {
1289 BiasedLocking::revoke(objects_to_revoke);
1290 }
1291 }
1292
1293
1294 void Deoptimization::revoke_biases_of_monitors(CodeBlob* cb) {
1295 if (!UseBiasedLocking) {
1296 return;
1297 }
1298
1299 assert(SafepointSynchronize::is_at_safepoint(), "must only be called from safepoint");
1300 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1301 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
1302 if (jt->has_last_Java_frame()) {
1303 StackFrameStream sfs(jt, true);
1304 while (!sfs.is_done()) {
1305 frame* cur = sfs.current();
1306 if (cb->contains(cur->pc())) {
1307 vframe* vf = vframe::new_vframe(cur, sfs.register_map(), jt);
1308 compiledVFrame* cvf = compiledVFrame::cast(vf);
1309 // Revoke monitors' biases in all scopes
1310 while (!cvf->is_top()) {
1311 collect_monitors(cvf, objects_to_revoke);
1312 cvf = compiledVFrame::cast(cvf->sender());
1313 }
1314 collect_monitors(cvf, objects_to_revoke);
1315 }
1316 sfs.next();
1317 }
1318 }
1319 }
1320 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1321 }
|