[vmkit-commits] [vmkit] r183660 - Incinerator feature removed from the main JVM. Incinerator shall be available in a separate branch.
Koutheir Attouchi
koutheir at gmail.com
Mon Jun 10 07:28:18 PDT 2013
Author: koutheir
Date: Mon Jun 10 09:28:18 2013
New Revision: 183660
URL: http://llvm.org/viewvc/llvm-project?rev=183660&view=rev
Log:
Incinerator feature removed from the main JVM. Incinerator shall be available in a separate branch.
Removed:
vmkit/trunk/lib/j3/VMCore/JnjvmIntOSGi.cpp
vmkit/trunk/lib/j3/VMCore/JnjvmStaleRef.cpp
Modified:
vmkit/trunk/autoconf/configure.ac
vmkit/trunk/configure
vmkit/trunk/include/vmkit/VirtualMachine.h
vmkit/trunk/include/vmkit/config.h.in
vmkit/trunk/include/vmkit/config.h.in.orig
vmkit/trunk/lib/j3/VMCore/Jnjvm.cpp
vmkit/trunk/lib/j3/VMCore/Jnjvm.h
vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.cpp
vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.h
vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
Modified: vmkit/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/autoconf/configure.ac (original)
+++ vmkit/trunk/autoconf/configure.ac Mon Jun 10 09:28:18 2013
@@ -340,20 +340,6 @@ esac
AC_SUBST(classpathimpl)
-dnl **************************************************************************
-dnl Kill stale references
-dnl **************************************************************************
-AC_ARG_ENABLE(incinerator,
- AS_HELP_STRING([--enable-incinerator],
- [Use incinerator to kill stale references in OSGi (default is NO)]),,
- enable_incinerator=no)
-case "$enable_incinerator" in
- yes) AC_DEFINE(RESET_STALE_REFERENCES,[1]) ;;
- no) ;; #AC_DEFINE(RESET_STALE_REFERENCES,[0]) ;;
- *) AC_MSG_ERROR([Invalid setting for --enable-incinerator. Use "yes" or "no"]) ;;
-esac
-
-
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
Modified: vmkit/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/configure (original)
+++ vmkit/trunk/configure Mon Jun 10 09:28:18 2013
@@ -717,7 +717,6 @@ with_gnu_classpath_libs
with_gnu_classpath_glibj
with_openjdk_path
with_classpath_impl
-enable_incinerator
'
ac_precious_vars='build_alias
host_alias
@@ -1348,8 +1347,6 @@ Optional Features:
yes)
--enable-debug Build with debug flags (default is no)
--enable-assert Build with assert flags (default is yes)
- --enable-incinerator Use incinerator to kill stale references in OSGi
- (default is NO)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -2911,23 +2908,6 @@ esac
-# Check whether --enable-incinerator was given.
-if test "${enable_incinerator+set}" = set; then :
- enableval=$enable_incinerator;
-else
- enable_incinerator=no
-fi
-
-case "$enable_incinerator" in
- yes) $as_echo "#define RESET_STALE_REFERENCES 1" >>confdefs.h
- ;;
- no) ;; #AC_DEFINE(RESET_STALE_REFERENCES,[0]) ;;
- *) as_fn_error $? "Invalid setting for --enable-incinerator. Use \"yes\" or \"no\"" "$LINENO" 5 ;;
-esac
-
-
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD-compatible nm" >&5
$as_echo_n "checking for BSD-compatible nm... " >&6; }
if ${lt_cv_path_NM+:} false; then :
Modified: vmkit/trunk/include/vmkit/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/vmkit/VirtualMachine.h?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/include/vmkit/VirtualMachine.h (original)
+++ vmkit/trunk/include/vmkit/VirtualMachine.h Mon Jun 10 09:28:18 2013
@@ -161,7 +161,6 @@ public:
/// endCollection - Code after running a GC.
///
- virtual void endCollectionBeforeUnlockingWorld() {}
virtual void endCollection() {}
/// scanWeakReferencesQueue - Scan all weak references. Called by the GC
@@ -224,10 +223,6 @@ public:
///
CooperativeCollectionRV rendezvous;
-#if RESET_STALE_REFERENCES
- virtual void resetReferenceIfStale(const void* source, void** ref) {}
-#endif
-
//===----------------------------------------------------------------------===//
// (2.5) GC-DEBUG-related methods.
//===----------------------------------------------------------------------===//
Modified: vmkit/trunk/include/vmkit/config.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/vmkit/config.h.in?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/include/vmkit/config.h.in (original)
+++ vmkit/trunk/include/vmkit/config.h.in Mon Jun 10 09:28:18 2013
@@ -1,2 +0,0 @@
-/* Kill stale references */
-#undef RESET_STALE_REFERENCES
Modified: vmkit/trunk/include/vmkit/config.h.in.orig
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/vmkit/config.h.in.orig?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/include/vmkit/config.h.in.orig (original)
+++ vmkit/trunk/include/vmkit/config.h.in.orig Mon Jun 10 09:28:18 2013
@@ -77,6 +77,3 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
-
-/* Kill stale references
-#undef RESET_STALE_REFERENCES
Modified: vmkit/trunk/lib/j3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/Jnjvm.cpp?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/j3/VMCore/Jnjvm.cpp Mon Jun 10 09:28:18 2013
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#define JNJVM_LOAD 1
-#define DEBUG_VERBOSE_STALE_REF 1
#include <cfloat>
#include <climits>
@@ -1351,9 +1350,6 @@ Jnjvm::Jnjvm(vmkit::BumpPtrAllocator& Al
vmkit::CompiledFrames** frames,
JnjvmBootstrapLoader* loader) :
VirtualMachine(Alloc, frames), lockSystem(Alloc)
-#if RESET_STALE_REFERENCES
- , scanStaleReferences(false) //, findReferencesToObject(NULL)
-#endif
{
classpath = getenv("CLASSPATH");
@@ -1392,43 +1388,12 @@ void Jnjvm::startCollection() {
fflush(stdout);
#endif
-#if RESET_STALE_REFERENCES
-
-#if DEBUG_VERBOSE_STALE_REF
-
- if (scanStaleReferences)
- std::cerr << "Looking for stale references..." << std::endl;
-
-#endif
-
-// if (findReferencesToObject != NULL)
-// foundReferencerObjects.clear();
-
-#endif
-
finalizerThread->FinalizationQueueLock.acquire();
referenceThread->ToEnqueueLock.acquire();
referenceThread->SoftReferencesQueue.acquire();
referenceThread->WeakReferencesQueue.acquire();
referenceThread->PhantomReferencesQueue.acquire();
}
-
-void Jnjvm::endCollectionBeforeUnlockingWorld()
-{
-#if RESET_STALE_REFERENCES
-#if DEBUG_VERBOSE_STALE_REF
-
- if (scanStaleReferences)
- std::cerr << "Looking for stale references done." << std::endl;
-
-#endif
-
- // Stale references can no more exist, until a bundle is uninstalled later.
- scanStaleReferences = false;
-// findReferencesToObject = NULL;
-
-#endif
-}
void Jnjvm::endCollection() {
finalizerThread->FinalizationQueueLock.release();
Modified: vmkit/trunk/lib/j3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/Jnjvm.h?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/j3/VMCore/Jnjvm.h Mon Jun 10 09:28:18 2013
@@ -127,7 +127,6 @@ private:
JavaReferenceThread* referenceThread;
virtual void startCollection();
- virtual void endCollectionBeforeUnlockingWorld();
virtual void endCollection();
virtual void scanWeakReferencesQueue(word_t closure);
virtual void scanSoftReferencesQueue(word_t closure);
@@ -366,36 +365,6 @@ public:
void loadBootstrap();
static void printBacktrace() __attribute__((noinline));
-
-#if RESET_STALE_REFERENCES
-
-public:
- typedef std::map<int64_t, std::list<JnjvmClassLoader*> > staleBundleClassLoadersType;
- typedef std::map<int64_t, JnjvmClassLoader*> bundleClassLoadersType;
-
- void setBundleStaleReferenceCorrected(int64_t bundleID, bool corrected);
- bool isBundleStaleReferenceCorrected(int64_t bundleID);
- void dumpClassLoaderBundles();
-
- JnjvmClassLoader* getBundleClassLoader(int64_t bundleID);
- int64_t getClassLoaderBundleID(JnjvmClassLoader* loader);
- void setBundleClassLoader(int64_t bundleID, JnjvmClassLoader* loader);
- void classLoaderUnloaded(JnjvmClassLoader* loader);
-
- virtual void resetReferenceIfStale(const void* source, void** ref);
-
-protected:
- void resetReferenceIfStale(const JavaObject *source, class VMClassLoader** ref);
- void resetReferenceIfStale(const JavaObject *source, class VMStaticInstance** ref);
- void resetReferenceIfStale(const JavaObject *source, class JavaObject** ref);
-
- // Link between OSGi (bundle ID) and Java (class loaders).
- vmkit::LockRecursive bundleClassLoadersLock;
- bundleClassLoadersType bundleClassLoaders;
- staleBundleClassLoadersType staleBundleClassLoaders;
- volatile bool scanStaleReferences;
-
-#endif
};
} // end namespace j3
Modified: vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.cpp?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.cpp Mon Jun 10 09:28:18 2013
@@ -214,9 +214,6 @@ JnjvmBootstrapLoader::JnjvmBootstrapLoad
JnjvmClassLoader::JnjvmClassLoader(vmkit::BumpPtrAllocator& Alloc) :
allocator(Alloc)
-#if RESET_STALE_REFERENCES
- ,staleRefFlags(CLASS_LOADER_STALE_REF_CORRECTED)
-#endif
{
}
@@ -224,9 +221,6 @@ JnjvmClassLoader::JnjvmClassLoader(vmkit
JnjvmClassLoader& JCL, JavaObject* loader,
VMClassLoader* vmdata,
Jnjvm* VM) : allocator(Alloc)
-#if RESET_STALE_REFERENCES
- ,staleRefFlags(CLASS_LOADER_STALE_REF_CORRECTED)
-#endif
{
llvm_gcroot(loader, 0);
llvm_gcroot(vmdata, 0);
@@ -878,10 +872,6 @@ const UTF8* JnjvmClassLoader::readerCons
JnjvmClassLoader::~JnjvmClassLoader() {
-#if RESET_STALE_REFERENCES
- vm->classLoaderUnloaded(this);
-#endif
-
if (vm) {
vm->removeFrameInfos(TheCompiler);
}
@@ -1141,33 +1131,3 @@ ArrayObject* JnjvmBootstrapLoader::getBo
return res;
}
-
-#if RESET_STALE_REFERENCES
-
-bool JnjvmClassLoader::isStale() const
-{
- return (staleRefFlags & CLASS_LOADER_STALE_REF_STALE) != 0;
-}
-
-void JnjvmClassLoader::markStale(bool stale)
-{
- if (stale)
- staleRefFlags |= CLASS_LOADER_STALE_REF_STALE;
- else
- staleRefFlags &= ~CLASS_LOADER_STALE_REF_STALE;
-}
-
-bool JnjvmClassLoader::isStaleReferencesCorrectionEnabled() const
-{
- return (staleRefFlags & CLASS_LOADER_STALE_REF_CORRECTED) != 0;
-}
-
-void JnjvmClassLoader::setStaleReferencesCorrectionEnabled(bool enable)
-{
- if (enable)
- staleRefFlags |= CLASS_LOADER_STALE_REF_CORRECTED;
- else
- staleRefFlags &= ~CLASS_LOADER_STALE_REF_CORRECTED;
-}
-
-#endif
Modified: vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.h?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.h (original)
+++ vmkit/trunk/lib/j3/VMCore/JnjvmClassLoader.h Mon Jun 10 09:28:18 2013
@@ -52,9 +52,6 @@ class ZipArchive;
template <class T> class TJavaArray;
typedef TJavaArray<JavaObject*> ArrayObject;
-#define CLASS_LOADER_STALE_REF_CORRECTED 0x1
-#define CLASS_LOADER_STALE_REF_STALE 0x2
-
/// JnjvmClassLoader - Runtime representation of a class loader. It contains
/// its own tables (signatures, UTF8, types) which are mapped to a single
/// table for non-isolate environments.
@@ -346,19 +343,6 @@ public:
///
word_t getRegisteredNative(const JavaMethod * meth);
-#if RESET_STALE_REFERENCES
-
-protected:
- uint8_t staleRefFlags;
-
-public:
- bool isStale() const;
- void markStale(bool stale = true);
- bool isStaleReferencesCorrectionEnabled() const;
- void setStaleReferencesCorrectionEnabled(bool enable);
-
-#endif
-
friend class Class;
friend class CommonClass;
friend class StringList;
Removed: vmkit/trunk/lib/j3/VMCore/JnjvmIntOSGi.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/JnjvmIntOSGi.cpp?rev=183659&view=auto
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/JnjvmIntOSGi.cpp (original)
+++ vmkit/trunk/lib/j3/VMCore/JnjvmIntOSGi.cpp (removed)
@@ -1,262 +0,0 @@
-
-#include <algorithm>
-#include <iostream>
-#include <sstream>
-
-#include "VmkitGC.h"
-#include "Jnjvm.h"
-#include "ClasspathReflect.h"
-#include "JavaUpcalls.h"
-#include "j3/jni.h"
-#include "JavaArray.h"
-
-
-using namespace std;
-
-#if RESET_STALE_REFERENCES
-
-#define DEBUG_VERBOSE_STALE_REF 1
-
-namespace j3 {
-
-void Jnjvm::dumpClassLoaderBundles()
-{
- vmkit::LockGuard lg(bundleClassLoadersLock);
- Jnjvm::bundleClassLoadersType::const_iterator
- i = bundleClassLoaders.begin(), e = bundleClassLoaders.end();
-
- for (; i != e; ++i)
- cerr << "bundleID=" << i->first << " classLoader=" << i->second << endl;
-
- staleBundleClassLoadersType::const_iterator
- si = staleBundleClassLoaders.begin(), se = staleBundleClassLoaders.end();
- staleBundleClassLoadersType::mapped_type::const_iterator li, le;
- for (; si != se; ++si) {
- cerr << "stale bundleID=" << si->first << " classLoaders={";
- le = si->second.end();
- li = si->second.begin();
- for (; li != le; ++li) cerr << " " << *li;
- cerr << "}" << endl;
- }
-}
-
-void Jnjvm::setBundleStaleReferenceCorrected(int64_t bundleID, bool corrected)
-{
- JnjvmClassLoader* loader = this->getBundleClassLoader(bundleID);
- if (!loader) {
- this->illegalArgumentException("Invalid bundle ID"); return;}
-
-#if DEBUG_VERBOSE_STALE_REF
- cerr << "Stale references to bundleID=" << bundleID << " are ";
- if (corrected)
- cerr << "corrected." << endl;
- else
- cerr << "no more corrected." << endl;
-#endif
-
- loader->setStaleReferencesCorrectionEnabled(corrected);
-}
-
-bool Jnjvm::isBundleStaleReferenceCorrected(int64_t bundleID)
-{
- JnjvmClassLoader* loader = this->getBundleClassLoader(bundleID);
- if (!loader) {
- this->illegalArgumentException("Invalid bundle ID"); return false;}
-
- return loader->isStaleReferencesCorrectionEnabled();
-}
-
-JnjvmClassLoader* Jnjvm::getBundleClassLoader(int64_t bundleID)
-{
- if (bundleID == -1) return NULL;
-
- vmkit::LockGuard lg(bundleClassLoadersLock);
-
- bundleClassLoadersType::const_iterator
- i = bundleClassLoaders.find(bundleID), e = bundleClassLoaders.end();
- return (i == e) ? NULL : i->second;
-}
-
-struct Jnjvm_getClassLoaderBundleID_InstalledBundles_finder {
- JnjvmClassLoader* loader;
- Jnjvm_getClassLoaderBundleID_InstalledBundles_finder(
- JnjvmClassLoader* l) : loader(l) {}
-
- bool operator() (const Jnjvm::bundleClassLoadersType::value_type& pair) {
- return (loader == pair.second);
- }
-};
-
-struct Jnjvm_getClassLoaderBundleID_UninstalledBundles_finder {
- JnjvmClassLoader* loader;
- Jnjvm_getClassLoaderBundleID_UninstalledBundles_finder(
- JnjvmClassLoader* l) : loader(l) {}
-
- bool operator() (const Jnjvm::staleBundleClassLoadersType::value_type& pair) {
- Jnjvm::staleBundleClassLoadersType::mapped_type::const_iterator
- b = pair.second.begin(), e = pair.second.end();
- Jnjvm::staleBundleClassLoadersType::mapped_type::const_iterator
- i = std::find(b, e, loader);
- return (i != e);
- }
-};
-
-int64_t Jnjvm::getClassLoaderBundleID(JnjvmClassLoader* loader)
-{
- if (loader == NULL) return -1;
- vmkit::LockGuard lg(bundleClassLoadersLock);
-
- bundleClassLoadersType::const_iterator
- b = bundleClassLoaders.begin(),
- e = bundleClassLoaders.end();
- bundleClassLoadersType::const_iterator
- i = std::find_if(b, e,
- Jnjvm_getClassLoaderBundleID_InstalledBundles_finder(loader));
-
- if (i != e) return i->first;
-
- // Look up in stale bundles list
- staleBundleClassLoadersType::const_iterator
- sb = staleBundleClassLoaders.begin(),
- se = staleBundleClassLoaders.end();
- staleBundleClassLoadersType::const_iterator
- si = std::find_if(sb, se,
- Jnjvm_getClassLoaderBundleID_UninstalledBundles_finder(loader));
-
- return (si == se) ? -1 : si->first;
-}
-
-// Link a bundle ID (OSGi world) to a class loader (Java world).
-void Jnjvm::setBundleClassLoader(int64_t bundleID, JnjvmClassLoader* loader)
-{
- if (bundleID == -1) return;
- vmkit::LockGuard lg(bundleClassLoadersLock);
-
- JnjvmClassLoader* previous_loader = bundleClassLoaders[bundleID];
-
- if (!loader) {
- // Unloaded bundle
- bundleClassLoaders.erase(bundleID);
-
-#if DEBUG_VERBOSE_STALE_REF
- cerr << "Bundle uninstalled: bundleID=" << bundleID
- << " classLoader=" << previous_loader << endl;
-#endif
- } else {
- // Installed/Updated bundle
- if (previous_loader == loader)
- return; // Same class loader already associated with the bundle, do nothing
-
- // Associate the class loader with the bundle
- bundleClassLoaders[bundleID] = loader;
-
-#if DEBUG_VERBOSE_STALE_REF
- if (!previous_loader) {
- cerr << "Bundle installed: bundleID=" << bundleID
- << " classLoader=" << loader << endl;
- } else {
- cerr << "Bundle updated: bundleID=" << bundleID
- << " classLoader=" << loader
- << " previousClassLoader=" << previous_loader << endl;
- }
-#endif
- }
-
- if (previous_loader != NULL) {
- // Mark the previous class loader as stale
- if (previous_loader->isStaleReferencesCorrectionEnabled()) {
- previous_loader->markStale(true);
- staleBundleClassLoaders[bundleID].push_front(previous_loader);
- }
-
- // Enable stale references scanning
- scanStaleReferences = true;
-
- // Start a garbage collection now
- //vmkit::Collector::collect();
- }
-}
-
-void Jnjvm::classLoaderUnloaded(JnjvmClassLoader* loader)
-{
- int64_t bundleID = getClassLoaderBundleID(loader);
- if (bundleID == -1) {
- cerr << "Class loader unloaded: " << loader << endl;
- return;
- }
-
- staleBundleClassLoaders[bundleID].remove(loader);
- if (staleBundleClassLoaders[bundleID].size() == 0)
- staleBundleClassLoaders.erase(bundleID);
-
-#if DEBUG_VERBOSE_STALE_REF
- cerr << "Class loader unloaded: " << loader
- << " bundleID=" << bundleID << endl;
-#endif
-}
-
-}
-
-#endif
-
-using namespace j3;
-
-/*
- This Java native method must be called by the framework in order to link bundles (given
- by bundle identifiers) to objects (thus, class loaders). This allows the VM to perform
- operations on bundles without actually having to know the precise structure of these.
-*/
-extern "C" void Java_j3_vm_OSGi_associateBundleClass(jlong bundleID, JavaObjectClass* classObject)
-{
- llvm_gcroot(classObject, 0);
-
-#if RESET_STALE_REFERENCES
-
- Jnjvm* vm = JavaThread::get()->getJVM();
- CommonClass* ccl = JavaObjectClass::getClass(classObject);
- vm->setBundleClassLoader(bundleID, ccl->classLoader);
-
-#endif
-}
-
-extern "C" void Java_j3_vm_OSGi_notifyBundleUninstalled(jlong bundleID)
-{
-#if RESET_STALE_REFERENCES
-
- Jnjvm* vm = JavaThread::get()->getJVM();
- vm->setBundleClassLoader(bundleID, NULL);
-
-#endif
-}
-
-extern "C" void Java_j3_vm_OSGi_setBundleStaleReferenceCorrected(jlong bundleID, jboolean corrected)
-{
-#if RESET_STALE_REFERENCES
-
- Jnjvm* vm = JavaThread::get()->getJVM();
- vm->setBundleStaleReferenceCorrected(bundleID, corrected);
-
-#endif
-}
-
-extern "C" jboolean Java_j3_vm_OSGi_isBundleStaleReferenceCorrected(jlong bundleID)
-{
-#if RESET_STALE_REFERENCES
-
- Jnjvm* vm = JavaThread::get()->getJVM();
- return vm->isBundleStaleReferenceCorrected(bundleID);
-
-#else
- return false;
-#endif
-}
-
-extern "C" void Java_j3_vm_OSGi_dumpClassLoaderBundles()
-{
-#if RESET_STALE_REFERENCES
-
- Jnjvm* vm = JavaThread::get()->getJVM();
- vm->dumpClassLoaderBundles();
-
-#endif
-}
Removed: vmkit/trunk/lib/j3/VMCore/JnjvmStaleRef.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/VMCore/JnjvmStaleRef.cpp?rev=183659&view=auto
==============================================================================
--- vmkit/trunk/lib/j3/VMCore/JnjvmStaleRef.cpp (original)
+++ vmkit/trunk/lib/j3/VMCore/JnjvmStaleRef.cpp (removed)
@@ -1,122 +0,0 @@
-
-#include "VmkitGC.h"
-#include "Jnjvm.h"
-#include "VMStaticInstance.h"
-
-#include <sstream>
-
-#if RESET_STALE_REFERENCES
-
-#define DEBUG_VERBOSE_STALE_REF 1
-
-using namespace std;
-
-namespace j3 {
-
-void Jnjvm::resetReferenceIfStale(const void* source, void** ref)
-{
- JavaObject *src = NULL;
- llvm_gcroot(src, 0);
-
- if (!ref || !(*ref)) return; // Invalid or null reference
- src = const_cast<JavaObject*>(reinterpret_cast<const JavaObject*>(source));
- JavaObject **objRef = reinterpret_cast<JavaObject**>(ref);
-
-// if (findReferencesToObject == *objRef)
-// foundReferencerObjects.push_back(src);
-
- if (!scanStaleReferences) return; // Stale references scanning disabled
-
- // Check the type of Java object. Some Java objects are not real object, but
- // are bridges between Java and the VM objects.
- if (VMClassLoader::isVMClassLoader(*objRef))
- resetReferenceIfStale(src, reinterpret_cast<VMClassLoader**>(ref));
- else if (VMStaticInstance::isVMStaticInstance(*objRef))
- resetReferenceIfStale(src, reinterpret_cast<VMStaticInstance**>(ref));
- else
- resetReferenceIfStale(src, objRef);
-}
-
-void Jnjvm::resetReferenceIfStale(const JavaObject *source, VMClassLoader** ref)
-{
- llvm_gcroot(source, 0);
-
- // Don't touch fake Java objects that exist only as bridges between the
- // Java object model and the C++ object model.
-
-#if DEBUG_VERBOSE_STALE_REF
-
- JnjvmClassLoader* loader = (**ref).getClassLoader();
- if (!loader->isStale()) return;
-/*
- cerr << "WARNING: Ignored stale reference ref=" << ref << " obj=" << **ref;
- if (source) cerr << " source=" << *source;
- cerr << endl;
-*/
-#endif
-}
-
-void Jnjvm::resetReferenceIfStale(const JavaObject *source, VMStaticInstance** ref)
-{
- llvm_gcroot(source, 0);
-
- // Don't touch fake Java objects that exist only as bridges between the
- // Java object model and the C++ object model.
-
-#if DEBUG_VERBOSE_STALE_REF
-
- JnjvmClassLoader* loader = (**ref).getOwningClass()->classLoader;
- if (!loader->isStale()) return;
-/*
- cerr << "WARNING: Ignored stale reference ref=" << ref << " obj=" << **ref;
- if (source) cerr << " source=" << *source;
- cerr << endl;
-*/
-#endif
-}
-
-void Jnjvm::resetReferenceIfStale(const JavaObject *source, JavaObject** ref)
-{
- llvm_gcroot(source, 0);
-
-#if DEBUG_VERBOSE_STALE_REF
-
- if (source) {
- CommonClass* ccl = JavaObject::getClass(source);
- if (ccl->classLoader->isStale())
- cerr << "WARNING: Source object is stale source=" << *source << endl;
- }
-
-#endif
-
- CommonClass* ccl = JavaObject::getClass(*ref);
- assert (ccl && "Object Class is not null.");
-
- if (!ccl->classLoader->isStale()) return;
-
-#if DEBUG_VERBOSE_STALE_REF
-
- cerr << "Resetting ref=" << ref << " obj=" << **ref;
- if (source) cerr << " source=" << *source;
- cerr << endl;
-
-#endif
-
- if (JavaThread* ownerThread = (JavaThread*)vmkit::ThinLock::getOwner(*ref, this->lockSystem)) {
- if (vmkit::FatLock* lock = vmkit::ThinLock::getFatLock(*ref, this->lockSystem))
- lock->markAssociatedObjectAsDead();
-
- // Notify all threads waiting on this object
- ownerThread->lockingThread.notifyAll(*ref, this->lockSystem, ownerThread);
-
- // Release this object
- while (vmkit::ThinLock::getOwner(*ref, this->lockSystem) == ownerThread)
- vmkit::ThinLock::release(*ref, this->lockSystem, ownerThread);
- }
-
- *ref = NULL; // Reset the reference
-}
-
-}
-
-#endif
Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Mon Jun 10 09:28:18 2013
@@ -184,10 +184,6 @@ void Collector::scanObject(FrameInfo* FI
if ((*ptr) != NULL) {
assert(vmkit::Thread::get()->MyVM->isCorruptedType((gc*)(*ptr)));
}
-#if RESET_STALE_REFERENCES
- // Allow the VM to reset references if needed
- vmkit::Thread::get()->MyVM->resetReferenceIfStale(NULL, ptr);
-#endif
JnJVM_org_j3_bindings_Bindings_reportDelayedRootEdge__Lorg_mmtk_plan_TraceLocal_2Lorg_vmmagic_unboxed_Address_2(closure, ptr);
}
@@ -198,10 +194,6 @@ void Collector::markAndTrace(void* sourc
assert(vmkit::Thread::get()->MyVM->isCorruptedType((gc*)(*ptr_)));
}
if ((*(void**)ptr) != NULL) assert(vmkit::Thread::get()->MyVM->isCorruptedType((gc*)(*(void**)ptr)));
-#if RESET_STALE_REFERENCES
- // Allow the VM to reset references if needed
- vmkit::Thread::get()->MyVM->resetReferenceIfStale(source, ptr_);
-#endif
JnJVM_org_j3_bindings_Bindings_processEdge__Lorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2(closure, source, ptr);
}
@@ -211,10 +203,6 @@ void Collector::markAndTraceRoot(void* s
if ((*ptr_) != NULL) {
assert(vmkit::Thread::get()->MyVM->isCorruptedType((gc*)(*ptr_)));
}
-#if RESET_STALE_REFERENCES
- // Allow the VM to reset references if needed
- vmkit::Thread::get()->MyVM->resetReferenceIfStale(source, ptr_);
-#endif
JnJVM_org_j3_bindings_Bindings_processRootEdge__Lorg_mmtk_plan_TraceLocal_2Lorg_vmmagic_unboxed_Address_2Z(closure, ptr, true);
}
Modified: vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Collection.cpp?rev=183660&r1=183659&r2=183660&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Collection.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Collection.cpp Mon Jun 10 09:28:18 2013
@@ -41,7 +41,6 @@ extern "C" void Java_org_j3_mmtk_Collect
JnJVM_org_j3_bindings_Bindings_collect__I(why);
- th->MyVM->endCollectionBeforeUnlockingWorld();
th->MyVM->rendezvous.finishRV();
th->MyVM->endCollection();
}
More information about the vmkit-commits
mailing list