From 385828e36ea70effe9aa18a954d008b1f7dc1d63 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Fri, 4 Mar 2011 16:48:33 -0800 Subject: Handle relocatable class objects in JIT'ed code. 1) Split the original literal pool into class object literals and constants. Elements in the class object pool have to match the specicial values perfectly (ie no +delta space optimizations) since they might be relocated. 2) Implement dvmJitScanAllClassPointers(void (*callback)(void *)) which is the entry routine to report all memory locations in the code cache that contain class objects (ie class object pool and predicted chaining cells for virtual calls). 3) Major codegen changes on how/when the class object pool are populated and how predicted chains are patched. Before this change the compiler thread is always in the VM_WAIT state, which won't prevent GC from running. Since the class object pointers captured by a worker thread are no longer guaranteed to be stable at JIT time, change various internal data structures to capture the class descriptor/loader tuple instead. The conversion from descriptor/loader tuple to actual class object pointers are only performed when the thread state is RUNNING or at GC safe point. 4) Separate the class object installation phase out of the main dvmCompilerAssembleLIR routine so that the impact to blocking GC requests is minimal. Add new stats to report the potential block time. For example: Potential GC blocked by compiler: max 46 us / avg 25 us 5) Various cleanup in the trace structure walkup code. Modified the verbose print routine to show the class descriptor in the class literal pool. For example: D/dalvikvm( 1450): -------- end of chaining cells (0x007c) D/dalvikvm( 1450): 0x44020628 (00b4): .class (Lcom/android/unit_tests/PerformanceTests$EmptyClass;) D/dalvikvm( 1450): 0x4402062c (00b8): .word (0xaca8d1a5) D/dalvikvm( 1450): 0x44020630 (00bc): .word (0x401abc02) D/dalvikvm( 1450): End Bug: 3482956 Change-Id: I2e736b00d63adc255c33067544606b8b96b72ffc --- vm/compiler/codegen/CompilerCodegen.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vm/compiler/codegen/CompilerCodegen.h') diff --git a/vm/compiler/codegen/CompilerCodegen.h b/vm/compiler/codegen/CompilerCodegen.h index 9cd4847c0..efa913f90 100644 --- a/vm/compiler/codegen/CompilerCodegen.h +++ b/vm/compiler/codegen/CompilerCodegen.h @@ -34,6 +34,10 @@ void dvmCompilerMethodMIR2LIR(CompilationUnit *cUnit); /* Assemble LIR into machine code */ void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info); +/* Install class objects in the literal pool */ +void dvmJitInstallClassObjectPointers(CompilationUnit *cUnit, + char *codeAddress); + /* Patch inline cache content for polymorphic callsites */ bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr); @@ -41,9 +45,6 @@ bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr); void dvmCompilerCodegenDump(CompilationUnit *cUnit); /* Implemented in the codegen//Assembler.c */ -void* dvmJitChain(void *tgtAddr, u4* branchAddr); -u4* dvmJitUnchain(void *codeAddr); -void dvmJitUnchainAll(void); void dvmCompilerPatchInlineCache(void); /* Implemented in codegen//Ralloc.c */ -- cgit v1.2.3