am a22ea035: Restore the logging of compilation progress on target device.
* commit 'a22ea0351a9ea781b14f05a7c0d7fde27e5fd9bb':
Restore the logging of compilation progress on target device.
diff --git a/build/Android.common.mk b/build/Android.common.mk
index c950298..b8e6c99 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -79,8 +79,9 @@
ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
-# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4
+# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++)
ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions
+ART_HOST_DEBUG_LDLIBS := -lsupc++
ifneq ($(HOST_OS),linux)
# Some Mac OS pthread header files are broken with -fkeep-inline-functions.
diff --git a/build/Android.libart.mk b/build/Android.libart.mk
index c7a85ef..a6a7070 100644
--- a/build/Android.libart.mk
+++ b/build/Android.libart.mk
@@ -79,6 +79,7 @@
LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
else # host
LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
+ LOCAL_LDLIBS += $(ART_HOST_DEBUG_LDLIBS)
LOCAL_STATIC_LIBRARIES := libgtest_host
endif
else
@@ -102,7 +103,7 @@
LOCAL_STATIC_LIBRARIES += libcutils
LOCAL_SHARED_LIBRARIES += libz-host
LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
- LOCAL_LDLIBS := -ldl -lpthread
+ LOCAL_LDLIBS += -ldl -lpthread
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif
diff --git a/src/compiler.cc b/src/compiler.cc
index ce1803c..2cfdb7e 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -316,13 +316,14 @@
compiler_(NULL),
compiler_context_(NULL),
jni_compiler_(NULL),
- create_invoke_stub_(NULL)
-#if defined(ART_USE_LLVM_COMPILER)
- , compiler_enable_auto_elf_loading_(NULL),
+#if !defined(ART_USE_LLVM_COMPILER)
+ create_invoke_stub_(NULL) {
+#else
+ create_invoke_stub_(NULL),
+ compiler_enable_auto_elf_loading_(NULL),
compiler_get_method_code_addr_(NULL),
- compiler_get_method_invoke_stub_addr_(NULL)
+ compiler_get_method_invoke_stub_addr_(NULL) {
#endif
-{
std::string compiler_so_name(MakeCompilerSoName(instruction_set_));
compiler_library_ = dlopen(compiler_so_name.c_str(), RTLD_LAZY);
if (compiler_library_ == NULL) {
diff --git a/src/compiler/codegen/GenInvoke.cc b/src/compiler/codegen/GenInvoke.cc
index 6d3c240..2217059 100644
--- a/src/compiler/codegen/GenInvoke.cc
+++ b/src/compiler/codegen/GenInvoke.cc
@@ -667,7 +667,7 @@
oatFreeTemp(cUnit, regPtr);
storeValue(cUnit, rlDest, rlResult);
if (rangeCheck) {
- launchPad->operands[2] = NULL; // no resumption
+ launchPad->operands[2] = 0; // no resumption
launchPad->operands[3] = (uintptr_t)bb;
}
// Record that we've already inlined & null checked
@@ -852,10 +852,10 @@
//TUNING: check if rlCmp.sRegLow is already null checked
LIR* launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, (int)mir, type);
oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
- (intptr_t)launchPad);
+ (intptr_t)launchPad);
opCmpImmBranch(cUnit, kCondEq, regCmp, 0, launchPad);
opReg(cUnit, kOpBlx, rTgt);
- launchPad->operands[2] = NULL; // No return possible
+ launchPad->operands[2] = 0; // No return possible
launchPad->operands[3] = (uintptr_t)bb;
// Record that we've already inlined & null checked
mir->optimizationFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
diff --git a/src/compiler/codegen/mips/Mips32/Factory.cc b/src/compiler/codegen/mips/Mips32/Factory.cc
index 0a7dd9d..edda3af 100644
--- a/src/compiler/codegen/mips/Mips32/Factory.cc
+++ b/src/compiler/codegen/mips/Mips32/Factory.cc
@@ -432,7 +432,6 @@
int rIndex, int rSrc, int scale, OpSize size)
{
LIR *first = NULL;
- LIR *res;
MipsOpCode opcode = kMipsNop;
int rNewIndex = rIndex;
int tReg = oatAllocTemp(cUnit);
@@ -461,23 +460,23 @@
opcode = kMipsFswc1;
break;
#endif
- case kWord:
- opcode = kMipsSw;
- break;
- case kUnsignedHalf:
- case kSignedHalf:
- opcode = kMipsSh;
- break;
- case kUnsignedByte:
- case kSignedByte:
- opcode = kMipsSb;
- break;
- default:
- LOG(FATAL) << "Bad case in storeBaseIndexed";
- }
- res = newLIR3(cUnit, opcode, rSrc, 0, tReg);
- oatFreeTemp(cUnit, rNewIndex);
- return first;
+ case kWord:
+ opcode = kMipsSw;
+ break;
+ case kUnsignedHalf:
+ case kSignedHalf:
+ opcode = kMipsSh;
+ break;
+ case kUnsignedByte:
+ case kSignedByte:
+ opcode = kMipsSb;
+ break;
+ default:
+ LOG(FATAL) << "Bad case in storeBaseIndexed";
+ }
+ newLIR3(cUnit, opcode, rSrc, 0, tReg);
+ oatFreeTemp(cUnit, rNewIndex);
+ return first;
}
LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
diff --git a/src/compiler/codegen/x86/X86/Factory.cc b/src/compiler/codegen/x86/X86/Factory.cc
index c3fb6a6..a940828 100644
--- a/src/compiler/codegen/x86/X86/Factory.cc
+++ b/src/compiler/codegen/x86/X86/Factory.cc
@@ -583,15 +583,12 @@
int rSrc, int rSrcHi,
OpSize size, int sReg) {
LIR *store = NULL;
- LIR *store2 = NULL;
bool isArray = rIndex != INVALID_REG;
bool pair = false;
- bool is64bit = false;
X86OpCode opcode = kX86Nop;
switch (size) {
case kLong:
case kDouble:
- is64bit = true;
if (FPREG(rSrc)) {
opcode = isArray ? kX86MovsdAR : kX86MovsdMR;
if (DOUBLEREG(rSrc)) {
@@ -635,8 +632,7 @@
store = newLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
} else {
store = newLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
- store2 = newLIR3(cUnit, opcode, rBase, displacement + HIWORD_OFFSET,
- rSrcHi);
+ newLIR3(cUnit, opcode, rBase, displacement + HIWORD_OFFSET, rSrcHi);
}
} else {
if (!pair) {
@@ -645,8 +641,8 @@
} else {
store = newLIR5(cUnit, opcode, rBase, rIndex, scale,
displacement + LOWORD_OFFSET, rSrc);
- store2 = newLIR5(cUnit, opcode, rBase, rIndex, scale,
- displacement + HIWORD_OFFSET, rSrcHi);
+ newLIR5(cUnit, opcode, rBase, rIndex, scale,
+ displacement + HIWORD_OFFSET, rSrcHi);
}
}
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index e433670..70bfd1e 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -333,7 +333,6 @@
target_options.NoFramePointerElim = true;
target_options.NoFramePointerElimNonLeaf = true;
target_options.UseSoftFloat = false;
- target_options.EnableFastISel = true;
// Create the llvm::TargetMachine
llvm::OwningPtr<llvm::TargetMachine> target_machine(
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 42a3266..3ceb0c8 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -215,7 +215,7 @@
UniquePtr<SirtRef<ClassLoader> > class_loader(new SirtRef<ClassLoader>(NULL));
if (class_loader.get() == NULL) {
LOG(ERROR) << "Failed to create SirtRef for class loader";
- return false;
+ return NULL;
}
if (!boot_image_option.empty()) {
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 73c70cb..cf1e188 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -1016,9 +1016,7 @@
* Get the monitor that the thread is waiting on.
*/
static JdwpError handleTR_CurrentContendedMonitor(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
- ObjectId threadId;
-
- threadId = ReadObjectId(&buf);
+ ReadObjectId(&buf); // threadId
// TODO: create an Object to represent the monitor (we're currently
// just using a raw Monitor struct in the VM)
@@ -1143,8 +1141,7 @@
}
static JdwpError handleCLR_VisibleClasses(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
- ObjectId classLoaderObject;
- classLoaderObject = ReadObjectId(&buf);
+ ReadObjectId(&buf); // classLoaderObject
// TODO: we should only return classes which have the given class loader as a defining or
// initiating loader. The former would be easy; the latter is hard, because we don't have
// any such notion.
diff --git a/src/jdwp/jdwp_socket.cc b/src/jdwp/jdwp_socket.cc
index 9ff50f5..01eba12 100644
--- a/src/jdwp/jdwp_socket.cc
+++ b/src/jdwp/jdwp_socket.cc
@@ -558,7 +558,6 @@
JdwpReqHeader hdr;
uint32_t length, id;
uint8_t flags, cmdSet, cmd;
- uint16_t error;
bool reply;
int dataLen;
@@ -571,7 +570,7 @@
flags = Read1(&buf);
if ((flags & kJDWPFlagReply) != 0) {
reply = true;
- error = Read2BE(&buf);
+ Read2BE(&buf); // error
} else {
reply = false;
cmdSet = Read1(&buf);
diff --git a/src/native/dalvik_system_Zygote.cc b/src/native/dalvik_system_Zygote.cc
index b4f69fb..566f0b3 100644
--- a/src/native/dalvik_system_Zygote.cc
+++ b/src/native/dalvik_system_Zygote.cc
@@ -36,6 +36,10 @@
#include <sys/prctl.h>
#endif
+#if defined(__linux__)
+#include <sys/personality.h>
+#endif
+
namespace art {
static pid_t gSystemServerPid = 0;
@@ -316,6 +320,15 @@
PLOG(FATAL) << "setuid(" << uid << ") failed";
}
+#if defined(__linux__)
+ // Work around ARM kernel ASLR lossage (http://b/5817320).
+ int old_personality = personality(0xffffffff);
+ int new_personality = personality(old_personality | ADDR_NO_RANDOMIZE);
+ if (new_personality == -1) {
+ PLOG(WARNING) << "personality(" << new_personality << ") failed";
+ }
+#endif
+
SetCapabilities(permittedCapabilities, effectiveCapabilities);
#if 1
diff --git a/src/native/java_lang_Runtime.cc b/src/native/java_lang_Runtime.cc
index 1b5520b..4789f4e 100644
--- a/src/native/java_lang_Runtime.cc
+++ b/src/native/java_lang_Runtime.cc
@@ -32,11 +32,8 @@
Runtime::Current()->GetHeap()->CollectGarbage(false);
}
-static void Runtime_nativeExit(JNIEnv*, jclass, jint status, jboolean isExit) {
- // isExit is true for System.exit and false for System.halt.
- if (isExit) {
- Runtime::Current()->CallExitHook(status);
- }
+static void Runtime_nativeExit(JNIEnv*, jclass, jint status) {
+ Runtime::Current()->CallExitHook(status);
exit(status);
}
@@ -80,7 +77,7 @@
NATIVE_METHOD(Runtime, freeMemory, "()J"),
NATIVE_METHOD(Runtime, gc, "()V"),
NATIVE_METHOD(Runtime, maxMemory, "()J"),
- NATIVE_METHOD(Runtime, nativeExit, "(IZ)V"),
+ NATIVE_METHOD(Runtime, nativeExit, "(I)V"),
NATIVE_METHOD(Runtime, nativeLoad, "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/String;"),
NATIVE_METHOD(Runtime, totalMemory, "()J"),
};
diff --git a/src/oat/jni/arm/jni_internal_arm.cc b/src/oat/jni/arm/jni_internal_arm.cc
index 2227742..78c3903 100644
--- a/src/oat/jni/arm/jni_internal_arm.cc
+++ b/src/oat/jni/arm/jni_internal_arm.cc
@@ -71,12 +71,7 @@
// Can either get 3 or 2 arguments into registers
size_t reg_bytes = (is_static ? 3 : 2) * kPointerSize;
- // Bytes passed by stack
- size_t stack_bytes;
- if (num_arg_array_bytes > reg_bytes) {
- stack_bytes = num_arg_array_bytes - reg_bytes;
- } else {
- stack_bytes = 0;
+ if (num_arg_array_bytes <= reg_bytes) {
reg_bytes = num_arg_array_bytes;
}
diff --git a/src/oat/runtime/support_stubs.cc b/src/oat/runtime/support_stubs.cc
index ac5d6f9..2a46c8b 100644
--- a/src/oat/runtime/support_stubs.cc
+++ b/src/oat/runtime/support_stubs.cc
@@ -89,8 +89,10 @@
bool is_static;
bool is_virtual;
uint32_t dex_method_idx;
+#if !defined(__i386__)
const char* shorty;
uint32_t shorty_len;
+#endif
if (type == Runtime::kUnknownMethod) {
DCHECK(called->IsRuntimeMethod());
// less two as return address may span into next dex instruction
@@ -109,15 +111,19 @@
(instr_code == Instruction::INVOKE_DIRECT_RANGE));
DecodedInstruction dec_insn(instr);
dex_method_idx = dec_insn.vB;
+#if !defined(__i386__)
shorty = linker->MethodShorty(dex_method_idx, caller, &shorty_len);
+#endif
} else {
DCHECK(!called->IsRuntimeMethod());
is_static = type == Runtime::kStaticMethod;
is_virtual = false;
dex_method_idx = called->GetDexMethodIndex();
+#if !defined(__i386__)
MethodHelper mh(called);
shorty = mh.GetShorty();
shorty_len = mh.GetShortyLength();
+#endif
}
#if !defined(__i386__)
// Discover shorty (avoid GCs)
diff --git a/src/oat_writer.cc b/src/oat_writer.cc
index 4d11237..ffdb0c8 100644
--- a/src/oat_writer.cc
+++ b/src/oat_writer.cc
@@ -258,8 +258,10 @@
uint32_t method_idx, const DexFile* dex_file) {
// derived from CompiledMethod if available
uint32_t code_offset = 0;
+#if defined(ART_USE_LLVM_COMPILER)
uint16_t code_elf_idx = static_cast<uint16_t>(-1u);
uint16_t code_elf_func_idx = static_cast<uint16_t>(-1u);
+#endif
uint32_t frame_size_in_bytes = kStackAlignment;
uint32_t core_spill_mask = 0;
uint32_t fp_spill_mask = 0;
@@ -268,15 +270,19 @@
uint32_t gc_map_offset = 0;
// derived from CompiledInvokeStub if available
uint32_t invoke_stub_offset = 0;
+#if defined(ART_USE_LLVM_COMPILER)
uint16_t invoke_stub_elf_idx = static_cast<uint16_t>(-1u);
uint16_t invoke_stub_elf_func_idx = static_cast<uint16_t>(-1u);
+#endif
CompiledMethod* compiled_method =
compiler_->GetCompiledMethod(Compiler::MethodReference(dex_file, method_idx));
if (compiled_method != NULL) {
if (compiled_method->IsExecutableInElf()) {
+#if defined(ART_USE_LLVM_COMPILER)
code_elf_idx = compiled_method->GetElfIndex();
code_elf_func_idx = compiled_method->GetElfFuncIndex();
+#endif
frame_size_in_bytes = compiled_method->GetFrameSizeInBytes();
} else {
offset = compiled_method->AlignCode(offset);
@@ -359,8 +365,10 @@
const CompiledInvokeStub* compiled_invoke_stub = compiler_->FindInvokeStub(is_static, shorty);
if (compiled_invoke_stub != NULL) {
if (compiled_invoke_stub->IsExecutableInElf()) {
+#if defined(ART_USE_LLVM_COMPILER)
invoke_stub_elf_idx = compiled_invoke_stub->GetElfIndex();
invoke_stub_elf_func_idx = compiled_invoke_stub->GetElfFuncIndex();
+#endif
} else {
offset = CompiledMethod::AlignCode(offset, compiler_->GetInstructionSet());
DCHECK_ALIGNED(offset, kArmAlignment);
@@ -600,10 +608,6 @@
const CompiledMethod* compiled_method =
compiler_->GetCompiledMethod(Compiler::MethodReference(&dex_file, method_idx));
- uint32_t frame_size_in_bytes = 0;
- uint32_t core_spill_mask = 0;
- uint32_t fp_spill_mask = 0;
-
OatMethodOffsets method_offsets =
oat_classes_[oat_class_index]->method_offsets_[class_def_method_index];
@@ -647,9 +651,6 @@
code_offset += code_size;
}
DCHECK_CODE_OFFSET();
- frame_size_in_bytes = compiled_method->GetFrameSizeInBytes();
- core_spill_mask = compiled_method->GetCoreSpillMask();
- fp_spill_mask = compiled_method->GetFpSpillMask();
const std::vector<uint32_t>& mapping_table = compiled_method->GetMappingTable();
size_t mapping_table_size = mapping_table.size() * sizeof(mapping_table[0]);
diff --git a/src/stack.cc b/src/stack.cc
index 5dda584..d724a72 100644
--- a/src/stack.cc
+++ b/src/stack.cc
@@ -102,13 +102,8 @@
*/
int Frame::GetVRegOffset(const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills,
- size_t frame_size, int reg)
-{
-#if defined(ART_USE_LLVM_COMPILER)
- LOG(FATAL) << "LLVM compiler don't support this function";
- return 0;
-#else
- DCHECK_EQ( frame_size & (kStackAlignment - 1), 0U);
+ size_t frame_size, int reg) {
+ DCHECK_EQ(frame_size & (kStackAlignment - 1), 0U);
int num_spills = __builtin_popcount(core_spills) + __builtin_popcount(fp_spills) + 1 /* filler */;
int num_ins = code_item->ins_size_;
int num_regs = code_item->registers_size_ - num_ins;
@@ -122,7 +117,6 @@
} else {
return frame_size + ((reg - num_regs) * sizeof(uint32_t)) + sizeof(uint32_t); // Dalvik in
}
-#endif
}
uint32_t Frame::GetVReg(const DexFile::CodeItem* code_item, uint32_t core_spills,
diff --git a/src/stringpiece.h b/src/stringpiece.h
index 7299120..7ff826d 100644
--- a/src/stringpiece.h
+++ b/src/stringpiece.h
@@ -30,6 +30,7 @@
#include <string.h>
#include <algorithm>
+#include <cstddef>
#include <iosfwd>
#include <string>