diff options
author | 2012-07-19 15:28:27 -0700 | |
---|---|---|
committer | 2012-08-14 10:45:52 -0700 | |
commit | 00f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abac (patch) | |
tree | 6a2172ece15c4699e6c2a67ce76f019db0a9a21d /src/compiler/codegen/GenCommon.cc | |
parent | 634ea28f78c4a138e6a1de54eae8696095422415 (diff) |
Global lock levels.
Introduce the notion of the mutators/GC being a shared-exclusive (aka
reader-writer) lock. Introduce globally ordered locks, analysable by
annotalysis, statically at compile time. Add locking attributes to
methods.
More subtly, remove the heap_lock_ and split between various locks that
are held for smaller periods (where work doesn't get blocked). Remove
buggy Dalvik style thread transitions. Make GC use CMS in all cases when
concurrent is enabled. Fix bug where suspend counts rather than debug
suspend counts were sent to JDWP. Move the PathClassLoader to
WellKnownClasses. In debugger refactor calls to send request and
possibly suspend. Break apart different VmWait thread states. Move
identity hash code to a shared method.
Change-Id: Icdbfc3ce3fcccd14341860ac7305d8e97b51f5c6
Diffstat (limited to 'src/compiler/codegen/GenCommon.cc')
-rw-r--r-- | src/compiler/codegen/GenCommon.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc index baa4b48bbe..6cb701f829 100644 --- a/src/compiler/codegen/GenCommon.cc +++ b/src/compiler/codegen/GenCommon.cc @@ -502,7 +502,6 @@ void genNewArray(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest, oatFlushAllRegs(cUnit); /* Everything to home location */ int funcOffset; if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx, - cUnit->dex_cache, *cUnit->dex_file, type_idx)) { funcOffset = ENTRYPOINT_OFFSET(pAllocArrayFromCode); @@ -527,7 +526,6 @@ void genFilledNewArray(CompilationUnit* cUnit, CallInfo* info) oatFlushAllRegs(cUnit); /* Everything to home location */ int funcOffset; if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx, - cUnit->dex_cache, *cUnit->dex_file, typeIdx)) { funcOffset = ENTRYPOINT_OFFSET(pCheckAndAllocArrayFromCode); @@ -637,10 +635,8 @@ void genSput(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlSrc, bool isVolatile; bool isReferrersClass; - OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, - *cUnit->dex_file, *cUnit->dex_cache, - cUnit->code_item, cUnit->method_idx, - cUnit->access_flags); + OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, *cUnit->dex_file, + cUnit->code_item, cUnit->method_idx, cUnit->access_flags); bool fastPath = cUnit->compiler->ComputeStaticFieldInfo(fieldIdx, &mUnit, @@ -735,7 +731,7 @@ void genSget(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlDest, bool isReferrersClass; OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, - *cUnit->dex_file, *cUnit->dex_cache, + *cUnit->dex_file, cUnit->code_item, cUnit->method_idx, cUnit->access_flags); @@ -978,7 +974,7 @@ bool fastInstance(CompilationUnit* cUnit, uint32_t fieldIdx, int& fieldOffset, bool& isVolatile, bool isPut) { OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, - *cUnit->dex_file, *cUnit->dex_cache, + *cUnit->dex_file, cUnit->code_item, cUnit->method_idx, cUnit->access_flags); return cUnit->compiler->ComputeInstanceFieldInfo(fieldIdx, &mUnit, @@ -1102,7 +1098,6 @@ void genConstClass(CompilationUnit* cUnit, uint32_t type_idx, int resReg = oatAllocTemp(cUnit); RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true); if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx, - cUnit->dex_cache, *cUnit->dex_file, type_idx)) { // Call out to helper which resolves type and verifies access. @@ -1121,7 +1116,7 @@ void genConstClass(CompilationUnit* cUnit, uint32_t type_idx, Array::DataOffset(sizeof(Class*)).Int32Value() + (sizeof(Class*) * type_idx); loadWordDisp(cUnit, resReg, offset_of_type, rlResult.lowReg); - if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache(cUnit->dex_cache, + if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache(*cUnit->dex_file, type_idx) || SLOW_TYPE_PATH) { // Slow path, at runtime test if type is null and if so initialize oatFlushAllRegs(cUnit); @@ -1164,7 +1159,7 @@ void genConstString(CompilationUnit* cUnit, uint32_t string_idx, int32_t offset_of_string = Array::DataOffset(sizeof(String*)).Int32Value() + (sizeof(String*) * string_idx); if (!cUnit->compiler->CanAssumeStringIsPresentInDexCache( - cUnit->dex_cache, string_idx) || SLOW_STRING_PATH) { + *cUnit->dex_file, string_idx) || SLOW_STRING_PATH) { // slow path, resolve string if not in dex cache oatFlushAllRegs(cUnit); oatLockCallTemps(cUnit); // Using explicit registers @@ -1222,7 +1217,7 @@ void genNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDes // access because the verifier was unable to? int funcOffset; if (cUnit->compiler->CanAccessInstantiableTypeWithoutChecks( - cUnit->method_idx, cUnit->dex_cache, *cUnit->dex_file, type_idx)) { + cUnit->method_idx, *cUnit->dex_file, type_idx)) { funcOffset = ENTRYPOINT_OFFSET(pAllocObjectFromCode); } else { funcOffset = ENTRYPOINT_OFFSET(pAllocObjectFromCodeWithAccessCheck); @@ -1248,7 +1243,6 @@ void genInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest loadCurrMethodDirect(cUnit, rARG1); // rARG1 <= current Method* int classReg = rARG2; // rARG2 will hold the Class* if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx, - cUnit->dex_cache, *cUnit->dex_file, type_idx)) { // Check we have access to type_idx and if not throw IllegalAccessError, @@ -1268,7 +1262,7 @@ void genInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest * type_idx); loadWordDisp(cUnit, classReg, offset_of_type, classReg); if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache( - cUnit->dex_cache, type_idx)) { + *cUnit->dex_file, type_idx)) { // Need to test presence of type in dex cache at runtime LIR* hopBranch = opCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL); // Not resolved @@ -1333,7 +1327,6 @@ void genCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc) loadCurrMethodDirect(cUnit, rARG1); // rARG1 <= current Method* int classReg = rARG2; // rARG2 will hold the Class* if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx, - cUnit->dex_cache, *cUnit->dex_file, type_idx)) { // Check we have access to type_idx and if not throw IllegalAccessError, @@ -1352,7 +1345,7 @@ void genCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc) (sizeof(Class*) * type_idx); loadWordDisp(cUnit, classReg, offset_of_type, classReg); if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache( - cUnit->dex_cache, type_idx)) { + *cUnit->dex_file, type_idx)) { // Need to test presence of type in dex cache at runtime LIR* hopBranch = opCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL); // Not resolved |