[vmkit-commits] [vmkit] r199693 - Abort last commit and revert to r199691
Gael Thomas
gael.thomas at lip6.fr
Mon Jan 20 14:52:31 PST 2014
Author: gthomas
Date: Mon Jan 20 16:52:30 2014
New Revision: 199693
URL: http://llvm.org/viewvc/llvm-project?rev=199693&view=rev
Log:
Abort last commit and revert to r199691
Modified:
vmkit/branches/mcjit/include/j3/j3class.h
vmkit/branches/mcjit/include/j3/j3classloader.h
vmkit/branches/mcjit/include/j3/j3object.h
vmkit/branches/mcjit/lib/j3/vm/j3object.cc
Modified: vmkit/branches/mcjit/include/j3/j3class.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3class.h?rev=199693&r1=199692&r2=199693&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3class.h (original)
+++ vmkit/branches/mcjit/include/j3/j3class.h Mon Jan 20 16:52:30 2014
@@ -40,6 +40,7 @@ namespace j3 {
J3Method** methods;
};
+
class J3Type : public vmkit::Symbol {
pthread_mutex_t _mutex;
J3ClassLoader* _loader;
@@ -51,7 +52,7 @@ namespace j3 {
const vmkit::Name* _name;
char* _nativeName;
uint32_t _nativeNameLength;
- J3VirtualTable* _vt;
+ J3VirtualTable* _vt;
J3ObjectHandle* volatile _javaClass;
volatile int status;
Modified: vmkit/branches/mcjit/include/j3/j3classloader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3classloader.h?rev=199693&r1=199692&r2=199693&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3classloader.h (original)
+++ vmkit/branches/mcjit/include/j3/j3classloader.h Mon Jan 20 16:52:30 2014
@@ -41,7 +41,7 @@ namespace j3 {
uint32_t _compilationMode;
J3ObjectHandle* _javaClassLoader;
- J3GlobalReferences<J3ObjectHandle> _globalReferences;
+ J3GlobalReferences _globalReferences;
pthread_mutex_t _mutexClasses;
vmkit::NameMap<J3Class*>::map classes; /* classes managed by this class loader */
@@ -77,7 +77,7 @@ namespace j3 {
uint32_t interfaceIndex(J3Method* signature);
- J3GlobalReferences<J3ObjectHandle>* globalReferences() { return &_globalReferences; }
+ J3GlobalReferences* globalReferences() { return &_globalReferences; }
static J3ClassLoader* nativeClassLoader(J3ObjectHandle* jloader);
J3ObjectHandle* javaClassLoader(bool doPush=1);
Modified: vmkit/branches/mcjit/include/j3/j3object.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3object.h?rev=199693&r1=199692&r2=199693&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3object.h (original)
+++ vmkit/branches/mcjit/include/j3/j3object.h Mon Jan 20 16:52:30 2014
@@ -144,6 +144,7 @@ namespace j3 {
class J3ObjectHandle {
friend class J3LocalReferences;
+ friend class J3GlobalReferences;
friend class J3Method;
public:
@@ -199,6 +200,25 @@ namespace j3 {
#undef defAccessor
};
+ class J3LocalReferences : public vmkit::Stack<J3ObjectHandle> {
+ public:
+ J3LocalReferences(vmkit::BumpAllocator* _allocator) : vmkit::Stack<J3ObjectHandle>(_allocator) {}
+
+ J3ObjectHandle* push(J3ObjectHandle* handle) { return handle ? push(handle->obj()) : 0; }
+ J3ObjectHandle* push(J3Object* obj);
+ };
+
+ class J3GlobalReferences {
+ pthread_mutex_t mutex;
+ vmkit::Stack<J3ObjectHandle> references;
+ vmkit::Stack<J3ObjectHandle*> emptySlots;
+ public:
+ J3GlobalReferences(vmkit::BumpAllocator* _allocator);
+
+ J3ObjectHandle* add(J3ObjectHandle* handle);
+ void del(J3ObjectHandle* handle);
+ };
+
class J3Value {
public:
union {
@@ -215,48 +235,6 @@ namespace j3 {
J3Value() {}
};
-
- class J3LocalReferences : public vmkit::Stack<J3ObjectHandle> {
- public:
- J3LocalReferences(vmkit::BumpAllocator* _allocator) : vmkit::Stack<J3ObjectHandle>(_allocator) {}
-
- J3ObjectHandle* push(J3ObjectHandle* handle) { return handle ? push(handle->obj()) : 0; }
- J3ObjectHandle* push(J3Object* obj);
- };
-
- template <class T>
- class J3GlobalReferences {
- pthread_mutex_t mutex;
- vmkit::Stack<T> references;
- vmkit::Stack<T*> emptySlots;
-
- public:
- J3GlobalReferences(vmkit::BumpAllocator* _allocator) :
- references(_allocator),
- emptySlots(_allocator) {
- pthread_mutex_init(&mutex, 0);
- }
-
- T* add(T* handle) {
- if(handle) {
- pthread_mutex_lock(&mutex);
- T* res = emptySlots.isEmpty() ? references.push() : *emptySlots.pop();
- *res = *handle;
- pthread_mutex_unlock(&mutex);
- return res;
- } else
- return 0;
- }
-
- void del(T* handle) {
- if(handle) {
- handle->harakiri();
- pthread_mutex_lock(&mutex);
- *emptySlots.push() = handle;
- pthread_mutex_unlock(&mutex);
- }
- }
- };
}
#endif
Modified: vmkit/branches/mcjit/lib/j3/vm/j3object.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3object.cc?rev=199693&r1=199692&r2=199693&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3object.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3object.cc Mon Jan 20 16:52:30 2014
@@ -544,4 +544,32 @@ J3ObjectHandle* J3LocalReferences::push(
return 0;
}
+/*
+ * J3GlobalReferences
+ */
+J3GlobalReferences::J3GlobalReferences(vmkit::BumpAllocator* _allocator) :
+ references(_allocator),
+ emptySlots(_allocator) {
+ pthread_mutex_init(&mutex, 0);
+}
+
+J3ObjectHandle* J3GlobalReferences::add(J3ObjectHandle* handle) {
+ if(handle) {
+ pthread_mutex_lock(&mutex);
+ J3ObjectHandle* res = emptySlots.isEmpty() ? references.push() : *emptySlots.pop();
+ res->_obj = handle->_obj;
+ pthread_mutex_unlock(&mutex);
+ return res;
+ } else
+ return 0;
+}
+
+void J3GlobalReferences::del(J3ObjectHandle* handle) {
+ if(handle) {
+ handle->harakiri();
+ pthread_mutex_lock(&mutex);
+ *emptySlots.push() = handle;
+ pthread_mutex_unlock(&mutex);
+ }
+}
More information about the vmkit-commits
mailing list