From 3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Mon, 21 Mar 2011 13:35:24 -0700 Subject: 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 --- vm/native/java_lang_Runtime.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'vm/native/java_lang_Runtime.c') 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 @@ -92,31 +92,6 @@ static void Dalvik_java_lang_Runtime_nativeLoad(const u4* args, RETURN_PTR(result); } -/* - * 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() * @@ -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 }, -- cgit v1.2.3