comparison src/share/vm/runtime/thread.hpp @ 3555:22d11b3bc561

Various hacks to be able to install machine code from a Java thread.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 24 Aug 2011 01:05:02 +0200
parents 344264424174
children bc95d122df79
comparison
equal deleted inserted replaced
3554:b20889b42d12 3555:22d11b3bc561
711 friend class VMStructs; 711 friend class VMStructs;
712 private: 712 private:
713 JavaThread* _next; // The next thread in the Threads list 713 JavaThread* _next; // The next thread in the Threads list
714 oop _threadObj; // The Java level thread object 714 oop _threadObj; // The Java level thread object
715 715
716 // (tw) Necessary for holding a compilation buffer and ci environment. Moved from CompilerThread to JavaThread in order to enable code installation from Java application code.
717 BufferBlob* _buffer_blob;
718 ciEnv* _env;
719
716 #ifdef ASSERT 720 #ifdef ASSERT
717 private: 721 private:
718 int _java_call_counter; 722 int _java_call_counter;
719 723
720 public: 724 public:
907 _jni_environment.functions = functionTable; 911 _jni_environment.functions = functionTable;
908 } 912 }
909 struct JNINativeInterface_* get_jni_functions() { 913 struct JNINativeInterface_* get_jni_functions() {
910 return (struct JNINativeInterface_ *)_jni_environment.functions; 914 return (struct JNINativeInterface_ *)_jni_environment.functions;
911 } 915 }
916
917 // Get/set the thread's compilation environment.
918 ciEnv* env() { return _env; }
919 void set_env(ciEnv* env) { _env = env; }
920
921 BufferBlob* get_buffer_blob() { return _buffer_blob; }
922 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; };
912 923
913 // This function is called at thread creation to allow 924 // This function is called at thread creation to allow
914 // platform specific thread variables to be initialized. 925 // platform specific thread variables to be initialized.
915 void cache_global_variables(); 926 void cache_global_variables();
916 927
1694 class CompilerThread : public JavaThread { 1705 class CompilerThread : public JavaThread {
1695 friend class VMStructs; 1706 friend class VMStructs;
1696 private: 1707 private:
1697 CompilerCounters* _counters; 1708 CompilerCounters* _counters;
1698 1709
1699 ciEnv* _env;
1700 CompileLog* _log; 1710 CompileLog* _log;
1701 CompileTask* _task; 1711 CompileTask* _task;
1702 CompileQueue* _queue; 1712 CompileQueue* _queue;
1703 bool _is_compiling; 1713 bool _is_compiling;
1704 BufferBlob* _buffer_blob;
1705 1714
1706 nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper 1715 nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper
1707 1716
1708 public: 1717 public:
1709 1718
1718 // (tw) For Graal, the compiler thread should be visible. 1727 // (tw) For Graal, the compiler thread should be visible.
1719 bool is_hidden_from_external_view() const { return !UseGraal || !DebugGraal; } 1728 bool is_hidden_from_external_view() const { return !UseGraal || !DebugGraal; }
1720 1729
1721 CompileQueue* queue() { return _queue; } 1730 CompileQueue* queue() { return _queue; }
1722 CompilerCounters* counters() { return _counters; } 1731 CompilerCounters* counters() { return _counters; }
1723
1724 // Get/set the thread's compilation environment.
1725 ciEnv* env() { return _env; }
1726 void set_env(ciEnv* env) { _env = env; }
1727
1728 BufferBlob* get_buffer_blob() { return _buffer_blob; }
1729 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; };
1730 1732
1731 // Get/set the thread's logging information 1733 // Get/set the thread's logging information
1732 CompileLog* log() { return _log; } 1734 CompileLog* log() { return _log; }
1733 void init_log(CompileLog* log) { 1735 void init_log(CompileLog* log) {
1734 // Set once, for good. 1736 // Set once, for good.