464 _current_pending_monitor = monitor;
465 }
466 void set_current_pending_monitor_is_from_java(bool from_java) {
467 _current_pending_monitor_is_from_java = from_java;
468 }
469 bool current_pending_monitor_is_from_java() {
470 return _current_pending_monitor_is_from_java;
471 }
472
473 // For tracking the ObjectMonitor on which this thread called Object.wait()
474 ObjectMonitor* current_waiting_monitor() {
475 return _current_waiting_monitor;
476 }
477 void set_current_waiting_monitor(ObjectMonitor* monitor) {
478 _current_waiting_monitor = monitor;
479 }
480
481 // GC support
482 // Apply "f->do_oop" to all root oops in "this".
483 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
484 virtual void oops_do(OopClosure* f, CodeBlobClosure* cf);
485
486 // Handles the parallel case for the method below.
487 private:
488 bool claim_oops_do_par_case(int collection_parity);
489 public:
490 // Requires that "collection_parity" is that of the current strong roots
491 // iteration. If "is_par" is false, sets the parity of "this" to
492 // "collection_parity", and returns "true". If "is_par" is true,
493 // uses an atomic instruction to set the current threads parity to
494 // "collection_parity", if it is not already. Returns "true" iff the
495 // calling thread does the update, this indicates that the calling thread
496 // has claimed the thread's stack as a root groop in the current
497 // collection.
498 bool claim_oops_do(bool is_par, int collection_parity) {
499 if (!is_par) {
500 _oops_do_parity = collection_parity;
501 return true;
502 } else {
503 return claim_oops_do_par_case(collection_parity);
504 }
1388 void add_monitor_chunk(MonitorChunk* chunk);
1389 void remove_monitor_chunk(MonitorChunk* chunk);
1390 bool in_deopt_handler() const { return _in_deopt_handler > 0; }
1391 void inc_in_deopt_handler() { _in_deopt_handler++; }
1392 void dec_in_deopt_handler() {
1393 assert(_in_deopt_handler > 0, "mismatched deopt nesting");
1394 if (_in_deopt_handler > 0) { // robustness
1395 _in_deopt_handler--;
1396 }
1397 }
1398
1399 private:
1400 void set_entry_point(ThreadFunction entry_point) { _entry_point = entry_point; }
1401
1402 public:
1403
1404 // Frame iteration; calls the function f for all frames on the stack
1405 void frames_do(void f(frame*, const RegisterMap*));
1406
1407 // Memory operations
1408 void oops_do(OopClosure* f, CodeBlobClosure* cf);
1409
1410 // Sweeper operations
1411 void nmethods_do(CodeBlobClosure* cf);
1412
1413 // RedefineClasses Support
1414 void metadata_do(void f(Metadata*));
1415
1416 // Memory management operations
1417 void gc_epilogue();
1418 void gc_prologue();
1419
1420 // Misc. operations
1421 char* name() const { return (char*)get_thread_name(); }
1422 void print_on(outputStream* st) const;
1423 void print() const { print_on(tty); }
1424 void print_value();
1425 void print_thread_state_on(outputStream* ) const PRODUCT_RETURN;
1426 void print_thread_state() const PRODUCT_RETURN;
1427 void print_on_error(outputStream* st, char* buf, int buflen) const;
1428 void verify();
1808 CompilerCounters* counters() { return _counters; }
1809
1810 // Get/set the thread's compilation environment.
1811 ciEnv* env() { return _env; }
1812 void set_env(ciEnv* env) { _env = env; }
1813
1814 BufferBlob* get_buffer_blob() { return _buffer_blob; }
1815 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; };
1816
1817 // Get/set the thread's logging information
1818 CompileLog* log() { return _log; }
1819 void init_log(CompileLog* log) {
1820 // Set once, for good.
1821 assert(_log == NULL, "set only once");
1822 _log = log;
1823 }
1824
1825 // GC support
1826 // Apply "f->do_oop" to all root oops in "this".
1827 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
1828 void oops_do(OopClosure* f, CodeBlobClosure* cf);
1829
1830 #ifndef PRODUCT
1831 private:
1832 IdealGraphPrinter *_ideal_graph_printer;
1833 public:
1834 IdealGraphPrinter *ideal_graph_printer() { return _ideal_graph_printer; }
1835 void set_ideal_graph_printer(IdealGraphPrinter *n) { _ideal_graph_printer = n; }
1836 #endif
1837
1838 // Get/set the thread's current task
1839 CompileTask* task() { return _task; }
1840 void set_task(CompileTask* task) { _task = task; }
1841
1842 // Track the nmethod currently being scanned by the sweeper
1843 void set_scanned_nmethod(nmethod* nm) {
1844 assert(_scanned_nmethod == NULL || nm == NULL, "should reset to NULL before writing a new value");
1845 _scanned_nmethod = nm;
1846 }
1847 };
1848
1875 static void threads_do(ThreadClosure* tc);
1876
1877 // Initializes the vm and creates the vm thread
1878 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
1879 static void convert_vm_init_libraries_to_agents();
1880 static void create_vm_init_libraries();
1881 static void create_vm_init_agents();
1882 static void shutdown_vm_agents();
1883 static bool destroy_vm();
1884 // Supported VM versions via JNI
1885 // Includes JNI_VERSION_1_1
1886 static jboolean is_supported_jni_version_including_1_1(jint version);
1887 // Does not include JNI_VERSION_1_1
1888 static jboolean is_supported_jni_version(jint version);
1889
1890 // Garbage collection
1891 static void follow_other_roots(void f(oop*));
1892
1893 // Apply "f->do_oop" to all root oops in all threads.
1894 // This version may only be called by sequential code.
1895 static void oops_do(OopClosure* f, CodeBlobClosure* cf);
1896 // This version may be called by sequential or parallel code.
1897 static void possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf);
1898 // This creates a list of GCTasks, one per thread.
1899 static void create_thread_roots_tasks(GCTaskQueue* q);
1900 // This creates a list of GCTasks, one per thread, for marking objects.
1901 static void create_thread_roots_marking_tasks(GCTaskQueue* q);
1902
1903 // Apply "f->do_oop" to roots in all threads that
1904 // are part of compiled frames
1905 static void compiled_frame_oops_do(OopClosure* f, CodeBlobClosure* cf);
1906
1907 static void convert_hcode_pointers();
1908 static void restore_hcode_pointers();
1909
1910 // Sweeper
1911 static void nmethods_do(CodeBlobClosure* cf);
1912
1913 // RedefineClasses support
1914 static void metadata_do(void f(Metadata*));
1915
1916 static void gc_epilogue();
1917 static void gc_prologue();
|
464 _current_pending_monitor = monitor;
465 }
466 void set_current_pending_monitor_is_from_java(bool from_java) {
467 _current_pending_monitor_is_from_java = from_java;
468 }
469 bool current_pending_monitor_is_from_java() {
470 return _current_pending_monitor_is_from_java;
471 }
472
473 // For tracking the ObjectMonitor on which this thread called Object.wait()
474 ObjectMonitor* current_waiting_monitor() {
475 return _current_waiting_monitor;
476 }
477 void set_current_waiting_monitor(ObjectMonitor* monitor) {
478 _current_waiting_monitor = monitor;
479 }
480
481 // GC support
482 // Apply "f->do_oop" to all root oops in "this".
483 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
484 virtual void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
485
486 // Handles the parallel case for the method below.
487 private:
488 bool claim_oops_do_par_case(int collection_parity);
489 public:
490 // Requires that "collection_parity" is that of the current strong roots
491 // iteration. If "is_par" is false, sets the parity of "this" to
492 // "collection_parity", and returns "true". If "is_par" is true,
493 // uses an atomic instruction to set the current threads parity to
494 // "collection_parity", if it is not already. Returns "true" iff the
495 // calling thread does the update, this indicates that the calling thread
496 // has claimed the thread's stack as a root groop in the current
497 // collection.
498 bool claim_oops_do(bool is_par, int collection_parity) {
499 if (!is_par) {
500 _oops_do_parity = collection_parity;
501 return true;
502 } else {
503 return claim_oops_do_par_case(collection_parity);
504 }
1388 void add_monitor_chunk(MonitorChunk* chunk);
1389 void remove_monitor_chunk(MonitorChunk* chunk);
1390 bool in_deopt_handler() const { return _in_deopt_handler > 0; }
1391 void inc_in_deopt_handler() { _in_deopt_handler++; }
1392 void dec_in_deopt_handler() {
1393 assert(_in_deopt_handler > 0, "mismatched deopt nesting");
1394 if (_in_deopt_handler > 0) { // robustness
1395 _in_deopt_handler--;
1396 }
1397 }
1398
1399 private:
1400 void set_entry_point(ThreadFunction entry_point) { _entry_point = entry_point; }
1401
1402 public:
1403
1404 // Frame iteration; calls the function f for all frames on the stack
1405 void frames_do(void f(frame*, const RegisterMap*));
1406
1407 // Memory operations
1408 void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
1409
1410 // Sweeper operations
1411 void nmethods_do(CodeBlobClosure* cf);
1412
1413 // RedefineClasses Support
1414 void metadata_do(void f(Metadata*));
1415
1416 // Memory management operations
1417 void gc_epilogue();
1418 void gc_prologue();
1419
1420 // Misc. operations
1421 char* name() const { return (char*)get_thread_name(); }
1422 void print_on(outputStream* st) const;
1423 void print() const { print_on(tty); }
1424 void print_value();
1425 void print_thread_state_on(outputStream* ) const PRODUCT_RETURN;
1426 void print_thread_state() const PRODUCT_RETURN;
1427 void print_on_error(outputStream* st, char* buf, int buflen) const;
1428 void verify();
1808 CompilerCounters* counters() { return _counters; }
1809
1810 // Get/set the thread's compilation environment.
1811 ciEnv* env() { return _env; }
1812 void set_env(ciEnv* env) { _env = env; }
1813
1814 BufferBlob* get_buffer_blob() { return _buffer_blob; }
1815 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; };
1816
1817 // Get/set the thread's logging information
1818 CompileLog* log() { return _log; }
1819 void init_log(CompileLog* log) {
1820 // Set once, for good.
1821 assert(_log == NULL, "set only once");
1822 _log = log;
1823 }
1824
1825 // GC support
1826 // Apply "f->do_oop" to all root oops in "this".
1827 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
1828 void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
1829
1830 #ifndef PRODUCT
1831 private:
1832 IdealGraphPrinter *_ideal_graph_printer;
1833 public:
1834 IdealGraphPrinter *ideal_graph_printer() { return _ideal_graph_printer; }
1835 void set_ideal_graph_printer(IdealGraphPrinter *n) { _ideal_graph_printer = n; }
1836 #endif
1837
1838 // Get/set the thread's current task
1839 CompileTask* task() { return _task; }
1840 void set_task(CompileTask* task) { _task = task; }
1841
1842 // Track the nmethod currently being scanned by the sweeper
1843 void set_scanned_nmethod(nmethod* nm) {
1844 assert(_scanned_nmethod == NULL || nm == NULL, "should reset to NULL before writing a new value");
1845 _scanned_nmethod = nm;
1846 }
1847 };
1848
1875 static void threads_do(ThreadClosure* tc);
1876
1877 // Initializes the vm and creates the vm thread
1878 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
1879 static void convert_vm_init_libraries_to_agents();
1880 static void create_vm_init_libraries();
1881 static void create_vm_init_agents();
1882 static void shutdown_vm_agents();
1883 static bool destroy_vm();
1884 // Supported VM versions via JNI
1885 // Includes JNI_VERSION_1_1
1886 static jboolean is_supported_jni_version_including_1_1(jint version);
1887 // Does not include JNI_VERSION_1_1
1888 static jboolean is_supported_jni_version(jint version);
1889
1890 // Garbage collection
1891 static void follow_other_roots(void f(oop*));
1892
1893 // Apply "f->do_oop" to all root oops in all threads.
1894 // This version may only be called by sequential code.
1895 static void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
1896 // This version may be called by sequential or parallel code.
1897 static void possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
1898 // This creates a list of GCTasks, one per thread.
1899 static void create_thread_roots_tasks(GCTaskQueue* q);
1900 // This creates a list of GCTasks, one per thread, for marking objects.
1901 static void create_thread_roots_marking_tasks(GCTaskQueue* q);
1902
1903 // Apply "f->do_oop" to roots in all threads that
1904 // are part of compiled frames
1905 static void compiled_frame_oops_do(OopClosure* f, CodeBlobClosure* cf);
1906
1907 static void convert_hcode_pointers();
1908 static void restore_hcode_pointers();
1909
1910 // Sweeper
1911 static void nmethods_do(CodeBlobClosure* cf);
1912
1913 // RedefineClasses support
1914 static void metadata_do(void f(Metadata*));
1915
1916 static void gc_epilogue();
1917 static void gc_prologue();
|