diff options
| author | Carl Shapiro <cshapiro@google.com> | 2011-03-21 13:35:24 -0700 |
|---|---|---|
| committer | Carl Shapiro <cshapiro@google.com> | 2011-03-21 13:35:24 -0700 |
| commit | 3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09 (patch) | |
| tree | 32bccadbd08a353a4650a6451218b0c854ec6fc2 /vm/native | |
| parent | 14b63ca9f3ba5b58c6f8ad703c7a9c68028aa230 (diff) | |
| download | android_dalvik-3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09.tar.gz android_dalvik-3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09.tar.bz2 android_dalvik-3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09.zip | |
Move finalization out of the VM.
This change introduces a new reference class whose referent
points to instances requiring finalization. This makes the
finalization of objects possible using a reference queue and
a dedicated thread which removes objects from the queue.
Change-Id: I0ff6dd272f00ca08c6ed3aa667bf766a039a944e
Diffstat (limited to 'vm/native')
| -rw-r--r-- | vm/native/dalvik_system_VMRuntime.c | 19 | ||||
| -rw-r--r-- | vm/native/dalvik_system_Zygote.c | 12 | ||||
| -rw-r--r-- | vm/native/java_lang_Runtime.c | 27 |
3 files changed, 6 insertions, 52 deletions
diff --git a/vm/native/dalvik_system_VMRuntime.c b/vm/native/dalvik_system_VMRuntime.c index af0df7a9e..3642f9098 100644 --- a/vm/native/dalvik_system_VMRuntime.c +++ b/vm/native/dalvik_system_VMRuntime.c @@ -55,23 +55,6 @@ static void Dalvik_dalvik_system_VMRuntime_nativeSetTargetHeapUtilization( } /* - * public native void runFinalizationSync() - * - * Does not return until any pending finalizers have been called. - * This may or may not happen in the context of the calling thread. - * No exceptions will escape. - * - * Used by zygote, which doesn't have a HeapWorker thread. - */ -static void Dalvik_dalvik_system_VMRuntime_runFinalizationSync(const u4* args, - JValue* pResult) -{ - dvmRunFinalizationSync(); - - RETURN_VOID(); -} - -/* * public native void startJitCompilation() * * Callback function from the framework to indicate that an app has gone @@ -216,8 +199,6 @@ const DalvikNativeMethod dvm_dalvik_system_VMRuntime[] = { Dalvik_dalvik_system_VMRuntime_newNonMovableArray }, { "properties", "()[Ljava/lang/String;", Dalvik_dalvik_system_VMRuntime_properties }, - { "runFinalizationSync", "()V", - Dalvik_dalvik_system_VMRuntime_runFinalizationSync }, { "startJitCompilation", "()V", Dalvik_dalvik_system_VMRuntime_startJitCompilation }, { "vmVersion", "()Ljava/lang/String;", diff --git a/vm/native/dalvik_system_Zygote.c b/vm/native/dalvik_system_Zygote.c index 905eb9a51..6f7e6fa69 100644 --- a/vm/native/dalvik_system_Zygote.c +++ b/vm/native/dalvik_system_Zygote.c @@ -513,11 +513,11 @@ static void Dalvik_dalvik_system_Zygote_forkSystemServer( } const DalvikNativeMethod dvm_dalvik_system_Zygote[] = { - { "fork", "()I", - Dalvik_dalvik_system_Zygote_fork }, - { "forkAndSpecialize", "(II[II[[I)I", - Dalvik_dalvik_system_Zygote_forkAndSpecialize }, - { "forkSystemServer", "(II[II[[IJJ)I", - Dalvik_dalvik_system_Zygote_forkSystemServer }, + { "nativeFork", "()I", + Dalvik_dalvik_system_Zygote_fork }, + { "nativeForkAndSpecialize", "(II[II[[I)I", + Dalvik_dalvik_system_Zygote_forkAndSpecialize }, + { "nativeForkSystemServer", "(II[II[[IJJ)I", + Dalvik_dalvik_system_Zygote_forkSystemServer }, { NULL, NULL, NULL }, }; diff --git a/vm/native/java_lang_Runtime.c b/vm/native/java_lang_Runtime.c index b5c6a3362..112448c78 100644 --- a/vm/native/java_lang_Runtime.c +++ b/vm/native/java_lang_Runtime.c @@ -93,31 +93,6 @@ static void Dalvik_java_lang_Runtime_nativeLoad(const u4* args, } /* - * public void runFinalization(boolean forced) - * - * Requests that the VM runs finalizers for objects on the heap. If the - * parameter forced is true, then the VM needs to ensure finalization. - * Otherwise this only inspires the VM to make a best-effort attempt to - * run finalizers before returning, but it's not guaranteed to actually - * do anything. - */ -static void Dalvik_java_lang_Runtime_runFinalization(const u4* args, - JValue* pResult) -{ - bool forced = (args[0] != 0); - - dvmWaitForHeapWorkerIdle(); - if (forced) { - // TODO(Google) Need to explicitly implement this, - // although dvmWaitForHeapWorkerIdle() - // should usually provide the "forced" - // behavior already. - } - - RETURN_VOID(); -} - -/* * public long maxMemory() * * Returns GC heap max memory in bytes. @@ -166,8 +141,6 @@ const DalvikNativeMethod dvm_java_lang_Runtime[] = { Dalvik_java_lang_Runtime_nativeExit }, { "nativeLoad", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/String;", Dalvik_java_lang_Runtime_nativeLoad }, - { "runFinalization", "(Z)V", - Dalvik_java_lang_Runtime_runFinalization }, { "totalMemory", "()J", Dalvik_java_lang_Runtime_totalMemory }, { NULL, NULL, NULL }, |
