summaryrefslogtreecommitdiffstats
path: root/vm/compiler/codegen
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-08-09 11:20:23 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-08-09 11:20:23 -0700
commit6a1b6119ffd715eb7a303fc2e118f662c575655f (patch)
tree1f2bfecbcf82a25601421ad5cc2638eec8532fd4 /vm/compiler/codegen
parente19b6bd17c794e7ff2b17fa378f1b5357df83a5a (diff)
parent730ba5cab6d55cdc57cdefd47c3b55878f4eacfb (diff)
downloadandroid_dalvik-6a1b6119ffd715eb7a303fc2e118f662c575655f.tar.gz
android_dalvik-6a1b6119ffd715eb7a303fc2e118f662c575655f.tar.bz2
android_dalvik-6a1b6119ffd715eb7a303fc2e118f662c575655f.zip
am 730ba5ca: Merge "Fix the protection of code cache for x86 JIT"
* commit '730ba5cab6d55cdc57cdefd47c3b55878f4eacfb': Fix the protection of code cache for x86 JIT
Diffstat (limited to 'vm/compiler/codegen')
-rw-r--r--vm/compiler/codegen/x86/CodegenInterface.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/vm/compiler/codegen/x86/CodegenInterface.cpp b/vm/compiler/codegen/x86/CodegenInterface.cpp
index 451c5e537..337bd61ae 100644
--- a/vm/compiler/codegen/x86/CodegenInterface.cpp
+++ b/vm/compiler/codegen/x86/CodegenInterface.cpp
@@ -1085,14 +1085,14 @@ void dvmCompilerMIR2LIR(CompilationUnit *cUnit, JitTranslationInfo *info)
info->codeAddress = NULL;
stream = (char*)gDvmJit.codeCache + gDvmJit.codeCacheByteUsed;
+ streamStart = stream; /* trace start before alignment */
// TODO: compile into a temporary buffer and then copy into the code cache.
// That would let us leave the code cache unprotected for a shorter time.
size_t unprotected_code_cache_bytes =
- gDvmJit.codeCacheSize - gDvmJit.codeCacheByteUsed - CODE_CACHE_PADDING;
- UNPROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ gDvmJit.codeCacheSize - gDvmJit.codeCacheByteUsed;
+ UNPROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
- streamStart = stream; /* trace start before alignment */
stream += EXTRA_BYTES_FOR_CHAINING; /* This is needed for chaining. Add the bytes before the alignment */
stream = (char*)(((unsigned int)stream + 0xF) & ~0xF); /* Align trace to 16-bytes */
streamMethodStart = stream; /* code start */
@@ -1252,7 +1252,7 @@ void dvmCompilerMIR2LIR(CompilationUnit *cUnit, JitTranslationInfo *info)
if(cg_ret < 0) {
endOfTrace(true/*freeOnly*/);
cUnit->baseAddr = NULL;
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
return;
}
} else {
@@ -1293,7 +1293,7 @@ void dvmCompilerMIR2LIR(CompilationUnit *cUnit, JitTranslationInfo *info)
gDvmJit.codeCacheFull = true;
cUnit->baseAddr = NULL;
endOfTrace(true/*freeOnly*/);
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
return;
}
}
@@ -1387,7 +1387,7 @@ gen_fallthrough:
gDvmJit.codeCacheFull = true;
cUnit->baseAddr = NULL;
endOfTrace(true); /* need to free structures */
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
return;
}
}
@@ -1403,7 +1403,7 @@ gen_fallthrough:
*/
ALOGI("JIT code cache full after endOfTrace (trace uses %uB)", (stream - streamStart));
cUnit->baseAddr = NULL;
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
return;
}
@@ -1425,7 +1425,7 @@ gen_fallthrough:
ALOGI("JIT code cache full after ChainingCellCounts (trace uses %uB)", (stream - streamStart));
gDvmJit.codeCacheFull = true;
cUnit->baseAddr = NULL;
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
return;
}
@@ -1434,7 +1434,7 @@ gen_fallthrough:
*pOffset = streamCountStart - streamMethodStart; /* from codeAddr */
pOffset[1] = streamChainingStart - streamMethodStart;
- PROTECT_CODE_CACHE(stream, unprotected_code_cache_bytes);
+ PROTECT_CODE_CACHE(streamStart, unprotected_code_cache_bytes);
gDvmJit.codeCacheByteUsed += (stream - streamStart);
if (cUnit->printMe) {