Add allocation and garbage collection infrastructure.
Change-Id: I4b04cdfdf18afb75a7b0df87b509e8156b4a932b
diff --git a/src/thread.h b/src/thread.h
index 3f962d5..3c6e64b 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -8,17 +8,16 @@
#include <list>
#include "src/globals.h"
-#include "src/heap.h"
#include "src/jni_internal.h"
#include "src/logging.h"
#include "src/macros.h"
+#include "src/offsets.h"
#include "src/runtime.h"
#include "jni.h"
namespace art {
-class Heap;
class Object;
class Runtime;
class StackHandleBlock;
@@ -162,6 +161,10 @@
static bool Init();
+ Runtime* GetRuntime() const {
+ return runtime_;
+ }
+
State GetState() {
return state_;
}
@@ -175,10 +178,6 @@
return ThreadOffset(OFFSETOF_MEMBER(Thread, state_));
}
- Heap* GetHeap() {
- return heap_;
- }
-
// JNI methods
JniEnvironment* GetJniEnv() const {
return jni_env_;
@@ -205,23 +204,18 @@
private:
Thread() :
- thread_id_(1234), top_shb_(NULL), exception_(NULL) {
+ id_(1234), top_shb_(NULL), exception_(NULL) {
jni_env_ = new JniEnvironment();
}
+
~Thread() {
delete jni_env_;
}
void InitCpu();
- // Initialized to "this". On certain architectures (such as x86) reading
- // off of Thread::Current is easy but getting the address of Thread::Current
- // is hard. This field can be read off of Thread::Current to give the address.
- Thread* self_;
-
- uint32_t thread_id_;
-
- Heap* heap_;
+ // Managed thread id.
+ uint32_t id_;
// Top of linked list of stack handle blocks or NULL for none
StackHandleBlock* top_shb_;
@@ -231,17 +225,29 @@
State state_;
- uint32_t id_;
-
+ // Native (kernel) thread id.
pid_t native_id_;
+ // Native thread handle.
pthread_t handle_;
+ // Initialized to "this". On certain architectures (such as x86) reading
+ // off of Thread::Current is easy but getting the address of Thread::Current
+ // is hard. This field can be read off of Thread::Current to give the address.
+ Thread* self_;
+
+ Runtime* runtime_;
+
+ // The pending exception or NULL.
Object* exception_;
+ // The inclusive base of the control stack.
byte* stack_base_;
+
+ // The exclusive limit of the control stack.
byte* stack_limit_;
+ // TLS key used to retrieve the VM thread object.
static pthread_key_t pthread_key_self_;
DISALLOW_COPY_AND_ASSIGN(Thread);