Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiImpl.hpp @ 1878:fa83ab460c54
6988353: refactor contended sync subsystem
Summary: reduce complexity by factoring synchronizer.cpp
Reviewed-by: dholmes, never, coleenp
author | acorn |
---|---|
date | Fri, 22 Oct 2010 15:59:34 -0400 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1874:75ab0162aa84 | 1878:fa83ab460c54 |
---|---|
24 | 24 |
25 // | 25 // |
26 // Forward Declarations | 26 // Forward Declarations |
27 // | 27 // |
28 | 28 |
29 class JvmtiRawMonitor; | |
30 class JvmtiBreakpoint; | 29 class JvmtiBreakpoint; |
31 class JvmtiBreakpoints; | 30 class JvmtiBreakpoints; |
32 | 31 |
33 | 32 |
34 /////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////// |
325 if ((*bps) == bcp) return true; | 324 if ((*bps) == bcp) return true; |
326 } | 325 } |
327 return false; | 326 return false; |
328 } | 327 } |
329 | 328 |
330 | |
331 /////////////////////////////////////////////////////////////// | |
332 // | |
333 // class JvmtiRawMonitor | |
334 // | |
335 // Used by JVMTI methods: All RawMonitor methods (CreateRawMonitor, EnterRawMonitor, etc.) | |
336 // | |
337 // Wrapper for ObjectMonitor class that saves the Monitor's name | |
338 // | |
339 | |
340 class JvmtiRawMonitor : public ObjectMonitor { | |
341 private: | |
342 int _magic; | |
343 char * _name; | |
344 // JVMTI_RM_MAGIC is set in contructor and unset in destructor. | |
345 enum { JVMTI_RM_MAGIC = (int)(('T' << 24) | ('I' << 16) | ('R' << 8) | 'M') }; | |
346 | |
347 public: | |
348 JvmtiRawMonitor(const char *name); | |
349 ~JvmtiRawMonitor(); | |
350 int magic() { return _magic; } | |
351 const char *get_name() { return _name; } | |
352 bool is_valid(); | |
353 }; | |
354 | |
355 // Onload pending raw monitors | |
356 // Class is used to cache onload or onstart monitor enter | |
357 // which will transition into real monitor when | |
358 // VM is fully initialized. | |
359 class JvmtiPendingMonitors : public AllStatic { | |
360 | |
361 private: | |
362 static GrowableArray<JvmtiRawMonitor*> *_monitors; // Cache raw monitor enter | |
363 | |
364 inline static GrowableArray<JvmtiRawMonitor*>* monitors() { return _monitors; } | |
365 | |
366 static void dispose() { | |
367 delete monitors(); | |
368 } | |
369 | |
370 public: | |
371 static void enter(JvmtiRawMonitor *monitor) { | |
372 monitors()->append(monitor); | |
373 } | |
374 | |
375 static int count() { | |
376 return monitors()->length(); | |
377 } | |
378 | |
379 static void destroy(JvmtiRawMonitor *monitor) { | |
380 while (monitors()->contains(monitor)) { | |
381 monitors()->remove(monitor); | |
382 } | |
383 } | |
384 | |
385 // Return false if monitor is not found in the list. | |
386 static bool exit(JvmtiRawMonitor *monitor) { | |
387 if (monitors()->contains(monitor)) { | |
388 monitors()->remove(monitor); | |
389 return true; | |
390 } else { | |
391 return false; | |
392 } | |
393 } | |
394 | |
395 static void transition_raw_monitors(); | |
396 }; | |
397 | |
398 | |
399 | |
400 /////////////////////////////////////////////////////////////// | 329 /////////////////////////////////////////////////////////////// |
401 // The get/set local operations must only be done by the VM thread | 330 // The get/set local operations must only be done by the VM thread |
402 // because the interpreter version needs to access oop maps, which can | 331 // because the interpreter version needs to access oop maps, which can |
403 // only safely be done by the VM thread | 332 // only safely be done by the VM thread |
404 // | 333 // |