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
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index baa4b48..6cb701f 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -502,7 +502,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
* 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 @@
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 @@
(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