Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 72032 invoked from network); 25 May 2007 06:00:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 May 2007 06:00:40 -0000 Received: (qmail 84704 invoked by uid 500); 25 May 2007 06:00:45 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 84608 invoked by uid 500); 25 May 2007 06:00:45 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 84597 invoked by uid 99); 25 May 2007 06:00:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 May 2007 23:00:45 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,UPPERCASE_25_50 X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 May 2007 23:00:39 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 28F541A981A; Thu, 24 May 2007 23:00:19 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r541558 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H2057/ vm/include/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/vm/ vm/jitrino/src/vm/drl/ vm/vmcore/src/jit/ Date: Fri, 25 May 2007 06:00:18 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070525060019.28F541A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Thu May 24 23:00:17 2007 New Revision: 541558 URL: http://svn.apache.org/viewvc?view=rev&rev=541558 Log: Applied HARMONY-2057 [drlvm][jit] Jitrino.OPT's bpp.version=6 algorithm (the default) considers that all VM helpers are interruptable. Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2057/ harmony/enhanced/drlvm/trunk/src/test/regression/H2057/SyncTest.java harmony/enhanced/drlvm/trunk/src/test/regression/H2057/run.test.xml Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2057/SyncTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2057/SyncTest.java?view=auto&rev=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/src/test/regression/H2057/SyncTest.java (added) +++ harmony/enhanced/drlvm/trunk/src/test/regression/H2057/SyncTest.java Thu May 24 23:00:17 2007 @@ -0,0 +1,51 @@ + +package org.apache.harmony.drlvm.tests.regression.H2057; + +import junit.framework.TestCase; + +public class SyncTest extends TestCase { + + + public void testMain() { + Waiter w = new Waiter(); + w.start(); + while(!w.passed){} + } + +} + +class Stopper extends Thread { + Waiter w; + Stopper(Waiter w) {this.w=w;} + + public void run() { +// System.out.println("stopper started.."); + try {sleep(1000);} catch (Exception e) {e.printStackTrace();} +// System.out.println("stopping.."); + w.finish(); +// System.out.println("stopped.."); + } +} + +class Waiter extends Thread { + boolean done = false; + boolean passed = false; + + synchronized void finish(){ +// System.out.println("inside finish().."); + done = true; + } + + public void run() { +// System.out.println("waiter started.."); + new Stopper(this).start(); + int i=0; + while(!done) { + synchronized(this) { + i++; + } + } + passed = true; +// System.out.println("passed!"); + } +} Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2057/run.test.xml URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2057/run.test.xml?view=auto&rev=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/src/test/regression/H2057/run.test.xml (added) +++ harmony/enhanced/drlvm/trunk/src/test/regression/H2057/run.test.xml Thu May 24 23:00:17 2007 @@ -0,0 +1,9 @@ + + + + + + + Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h Thu May 24 23:00:17 2007 @@ -699,9 +699,29 @@ * Write barrier for GC. */ -} VM_RT_SUPPORT; //VM_RT_SUPPORT +} VM_RT_SUPPORT; +/** + * VM RT helpers can be interrupted differently. + */ +typedef +enum HELPER_INTERRUPTIBILITY_KIND { +/** + * Disallowed to interrupt a thread inside the helper. + */ + INTERRUPTIBLE_NEVER, +/** + * Some helpers can be run in fast path mode, + * when they are not interruptible, or in slow path, when they are. + */ + INTERRUPTIBLE_SOMETIMES, +/** + * Helper call can always be interrupted. + */ + INTERRUPTIBLE_ALWAYS + +} HELPER_INTERRUPTIBILITY_KIND; NativeCodePtr rth_get_lil_helper(VM_RT_SUPPORT f); @@ -727,7 +747,7 @@ * Checks if helper is a suspension point */ -VMEXPORT Boolean vm_helper_is_gc_interruptible(VM_RT_SUPPORT f); +VMEXPORT HELPER_INTERRUPTIBILITY_KIND vm_helper_get_interruptibility_kind(VM_RT_SUPPORT f); #ifdef __cplusplus Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp Thu May 24 23:00:17 2007 @@ -393,11 +393,14 @@ if (!ri) { return false; } else { - if ( ri->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress ) { - return true; - } if ( ri->getKind() == Opnd::RuntimeInfo::Kind_MethodDirectAddr && ((MethodDesc*)ri->getValue(0))->isNative() ) + { + return true; + } + CompilationInterface* ci = CompilationContext::getCurrentContext()->getVMCompilationInterface(); + if ( ri->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress && + ci->isInterruptible((CompilationInterface::RuntimeHelperId)(POINTER_SIZE_INT)ri->getValue(0)) ) { return true; } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Thu May 24 23:00:17 2007 @@ -2238,7 +2238,7 @@ if (!isInternalHelper) { CompilationInterface* ci = CompilationContext::getCurrentContext()->getVMCompilationInterface(); isNonGCVMHelper = rt && rt->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress - && !ci->isGCInterruptible((CompilationInterface::RuntimeHelperId)(POINTER_SIZE_INT)rt->getValue(0)); + && !ci->mayBeInterruptible((CompilationInterface::RuntimeHelperId)(POINTER_SIZE_INT)rt->getValue(0)); } bool isGCPoint = !isInternalHelper && !isNonGCVMHelper; return isGCPoint; Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h Thu May 24 23:00:17 2007 @@ -380,7 +380,8 @@ static RuntimeHelperId str2rid( const char * helperName ); VmCallingConvention getRuntimeHelperCallingConvention(RuntimeHelperId id); - bool isGCInterruptible(RuntimeHelperId id); + bool isInterruptible(RuntimeHelperId id); + bool mayBeInterruptible(RuntimeHelperId id); void* getRuntimeHelperAddress(RuntimeHelperId); void* getRuntimeHelperAddressForType(RuntimeHelperId, Type*); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp Thu May 24 23:00:17 2007 @@ -595,11 +595,16 @@ } bool -CompilationInterface::isGCInterruptible(RuntimeHelperId runtimeHelperId) { +CompilationInterface::isInterruptible(RuntimeHelperId runtimeHelperId) { VM_RT_SUPPORT drlHelperId = translateHelperId(runtimeHelperId); - return vm_helper_is_gc_interruptible(drlHelperId); + return INTERRUPTIBLE_ALWAYS == vm_helper_get_interruptibility_kind(drlHelperId); } +bool +CompilationInterface::mayBeInterruptible(RuntimeHelperId runtimeHelperId) { + VM_RT_SUPPORT drlHelperId = translateHelperId(runtimeHelperId); + return INTERRUPTIBLE_NEVER != vm_helper_get_interruptibility_kind(drlHelperId); +} bool CompilationInterface::compileMethod(MethodDesc *method) { Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?view=diff&rev=541558&r1=541557&r2=541558 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Thu May 24 23:00:17 2007 @@ -2403,100 +2403,100 @@ * Checks if helper is a suspension point */ -VMEXPORT Boolean vm_helper_is_gc_interruptible(VM_RT_SUPPORT f) +VMEXPORT HELPER_INTERRUPTIBILITY_KIND vm_helper_get_interruptibility_kind(VM_RT_SUPPORT f) { switch(f) { case VM_RT_MULTIANEWARRAY_RESOLVED: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_LDC_STRING: - return TRUE; + return INTERRUPTIBLE_ALWAYS; // Exceptions case VM_RT_THROW: case VM_RT_THROW_SET_STACK_TRACE: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_THROW_LAZY: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_IDX_OUT_OF_BOUNDS: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_NULL_PTR_EXCEPTION: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_DIVIDE_BY_ZERO_EXCEPTION: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_ARRAY_STORE_EXCEPTION: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_THROW_LINKING_EXCEPTION: - return TRUE; + return INTERRUPTIBLE_ALWAYS; // Type tests case VM_RT_CHECKCAST: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_INSTANCEOF: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_AASTORE: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_AASTORE_TEST: - return TRUE; + return INTERRUPTIBLE_ALWAYS; // Misc case VM_RT_GET_INTERFACE_VTABLE_VER0: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_INITIALIZE_CLASS: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_GC_SAFE_POINT: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_GC_GET_TLS_BASE: - return FALSE; + return INTERRUPTIBLE_NEVER; // JVMTI case VM_RT_JVMTI_METHOD_ENTER_CALLBACK: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_JVMTI_METHOD_EXIT_CALLBACK: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_JVMTI_FIELD_ACCESS_CALLBACK: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_JVMTI_FIELD_MODIFICATION_CALLBACK: - return TRUE; + return INTERRUPTIBLE_ALWAYS; // Non-VM case VM_RT_F2I: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_F2L: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_D2I: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_D2L: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LSHL: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LSHR: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LUSHR: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LMUL: #ifdef VM_LONG_OPT case VM_RT_LMUL_CONST_MULTIPLIER: #endif - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LREM: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_LDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_ULDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_CONST_LDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_CONST_LREM: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_IMUL: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_IREM: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_IDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_FREM: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_FDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_DREM: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_DDIV: - return FALSE; + return INTERRUPTIBLE_NEVER; case VM_RT_NEWOBJ_WITHRESOLVE: case VM_RT_NEWARRAY_WITHRESOLVE: case VM_RT_INITIALIZE_CLASS_WITHRESOLVE: @@ -2508,32 +2508,32 @@ case VM_RT_GET_INVOKEINTERFACE_ADDR_WITHRESOLVE: case VM_RT_GET_INVOKEVIRTUAL_ADDR_WITHRESOLVE: case VM_RT_GET_INVOKE_SPECIAL_ADDR_WITHRESOLVE: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_NEW_VECTOR_USING_VTABLE: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_WRITE_BARRIER_FASTCALL: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_MONITOR_ENTER: case VM_RT_MONITOR_ENTER_NON_NULL: - return TRUE; + return INTERRUPTIBLE_SOMETIMES; case VM_RT_MONITOR_ENTER_STATIC: - return TRUE; + return INTERRUPTIBLE_SOMETIMES; case VM_RT_MONITOR_EXIT: case VM_RT_MONITOR_EXIT_NON_NULL: - return TRUE; + return INTERRUPTIBLE_SOMETIMES; case VM_RT_MONITOR_EXIT_STATIC: - return TRUE; + return INTERRUPTIBLE_SOMETIMES; case VM_RT_CHAR_ARRAYCOPY_NO_EXC: - return TRUE; + return INTERRUPTIBLE_ALWAYS; case VM_RT_GC_HEAP_WRITE_REF: - return FALSE; + return INTERRUPTIBLE_NEVER; default: ASSERT(false, "Unexpected helper id" << f); - return TRUE; + return INTERRUPTIBLE_SOMETIMES; } }