am aad0d97e: Call out the functions that we actually import.
* commit 'aad0d97e772d80467c248007fa096b191884d823':
Call out the functions that we actually import.
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 132bf25..e9cd99b 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 8b6f185..c884f8c 100644
--- a/src/compiler/codegen/mips/Mips32/Factory.cc
+++ b/src/compiler/codegen/mips/Mips32/Factory.cc
@@ -430,7 +430,6 @@
int rIndex, int rSrc, int scale, OpSize size)
{
LIR *first = NULL;
- LIR *res;
MipsOpCode opcode = kMipsNop;
int rNewIndex = rIndex;
int tReg = oatAllocTemp(cUnit);
@@ -459,23 +458,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 3698d2d..8472548 100644
--- a/src/compiler/codegen/x86/X86/Factory.cc
+++ b/src/compiler/codegen/x86/X86/Factory.cc
@@ -581,15 +581,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)) {
@@ -633,8 +630,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) {
@@ -643,8 +639,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 598a8b3..ae64500 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -369,7 +369,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..8ced7e4 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;
@@ -130,53 +134,77 @@
// Calls POSIX setgroups() using the int[] object as an argument.
// A NULL argument is tolerated.
-static int SetGids(JNIEnv* env, jintArray javaGids) {
+static void SetGids(JNIEnv* env, jintArray javaGids) {
if (javaGids == NULL) {
- return 0;
+ return;
}
COMPILE_ASSERT(sizeof(gid_t) == sizeof(jint), sizeof_gid_and_jint_are_differerent);
ScopedIntArrayRO gids(env, javaGids);
- if (gids.get() == NULL) {
- return -1;
+ CHECK(gids.get() != NULL);
+ int rc = setgroups(gids.size(), reinterpret_cast<const gid_t*>(&gids[0]));
+ if (rc == -1) {
+ PLOG(FATAL) << "setgroups failed";
}
- return setgroups(gids.size(), (const gid_t *) &gids[0]);
}
// Sets the resource limits via setrlimit(2) for the values in the
// two-dimensional array of integers that's passed in. The second dimension
// contains a tuple of length 3: (resource, rlim_cur, rlim_max). NULL is
// treated as an empty array.
-//
-// -1 is returned on error.
-static int SetRLimits(JNIEnv* env, jobjectArray javaRlimits) {
+static void SetRLimits(JNIEnv* env, jobjectArray javaRlimits) {
if (javaRlimits == NULL) {
- return 0;
+ return;
}
rlimit rlim;
memset(&rlim, 0, sizeof(rlim));
- for (int i = 0; i < env->GetArrayLength(javaRlimits); i++) {
+ for (int i = 0; i < env->GetArrayLength(javaRlimits); ++i) {
ScopedLocalRef<jobject> javaRlimitObject(env, env->GetObjectArrayElement(javaRlimits, i));
ScopedIntArrayRO javaRlimit(env, reinterpret_cast<jintArray>(javaRlimitObject.get()));
if (javaRlimit.size() != 3) {
- LOG(ERROR) << "rlimits array must have a second dimension of size 3";
- return -1;
+ LOG(FATAL) << "rlimits array must have a second dimension of size 3";
}
rlim.rlim_cur = javaRlimit[1];
rlim.rlim_max = javaRlimit[2];
- int err = setrlimit(javaRlimit[0], &rlim);
- if (err < 0) {
- return -1;
+ int rc = setrlimit(javaRlimit[0], &rlim);
+ if (rc == -1) {
+ PLOG(FATAL) << "setrlimit(" << javaRlimit[0] << ", "
+ << "{" << rlim.rlim_cur << ", " << rlim.rlim_max << "}) failed";
}
}
- return 0;
}
#if defined(HAVE_ANDROID_OS)
+
+// The debug malloc library needs to know whether it's the zygote or a child.
+extern "C" int gMallocLeakZygoteChild;
+
+static void EnableDebugger() {
+ // To let a non-privileged gdbserver attach to this
+ // process, we must set our dumpable flag.
+ if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
+ PLOG(ERROR) << "prctl(PR_SET_DUMPABLE) failed for pid " << getpid();
+ }
+ // We don't want core dumps, though, so set the core dump size to 0.
+ rlimit rl;
+ rl.rlim_cur = 0;
+ rl.rlim_max = RLIM_INFINITY;
+ if (setrlimit(RLIMIT_CORE, &rl) == -1) {
+ PLOG(ERROR) << "setrlimit(RLIMIT_CORE) failed for pid " << getpid();
+ }
+}
+
+static void EnableKeepCapabilities() {
+ int rc = prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
+ if (rc == -1) {
+ PLOG(FATAL) << "prctl(PR_SET_KEEPCAPS) failed";
+ }
+}
+
static void SetCapabilities(int64_t permitted, int64_t effective) {
__user_cap_header_struct capheader;
__user_cap_data_struct capdata;
@@ -194,8 +222,23 @@
PLOG(FATAL) << "capset(" << permitted << ", " << effective << ") failed";
}
}
+
+static void SetSchedulerPolicy() {
+ errno = -set_sched_policy(0, SP_DEFAULT);
+ if (errno != 0) {
+ PLOG(FATAL) << "set_sched_policy(0, SP_DEFAULT) failed";
+ }
+}
+
#else
+
+static int gMallocLeakZygoteChild = 0;
+
+static void EnableDebugger() {}
+static void EnableKeepCapabilities() {}
static void SetCapabilities(int64_t, int64_t) {}
+static void SetSchedulerPolicy() {}
+
#endif
static void EnableDebugFeatures(uint32_t debug_flags) {
@@ -228,26 +271,9 @@
}
Dbg::SetJdwpAllowed((debug_flags & DEBUG_ENABLE_DEBUGGER) != 0);
-#ifdef HAVE_ANDROID_OS
if ((debug_flags & DEBUG_ENABLE_DEBUGGER) != 0) {
- /* To let a non-privileged gdbserver attach to this
- * process, we must set its dumpable bit flag. However
- * we are not interested in generating a coredump in
- * case of a crash, so also set the coredump size to 0
- * to disable that
- */
- if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) {
- PLOG(ERROR) << "could not set dumpable bit flag for pid " << getpid();
- } else {
- rlimit rl;
- rl.rlim_cur = 0;
- rl.rlim_max = RLIM_INFINITY;
- if (setrlimit(RLIMIT_CORE, &rl) < 0) {
- PLOG(ERROR) << "could not disable core file generation for pid " << getpid();
- }
- }
+ EnableDebugger();
}
-#endif
debug_flags &= ~DEBUG_ENABLE_DEBUGGER;
// These two are for backwards compatibility with Dalvik.
@@ -259,10 +285,6 @@
}
}
-#ifdef HAVE_ANDROID_OS
-extern "C" int gMallocLeakZygoteChild;
-#endif
-
// Utility routine to fork zygote and specialize the child process.
static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
jint debug_flags, jobjectArray javaRlimits,
@@ -282,52 +304,41 @@
pid_t pid = fork();
if (pid == 0) {
- // The child process
-
-#ifdef HAVE_ANDROID_OS
+ // The child process.
gMallocLeakZygoteChild = 1;
- // keep caps across UID change, unless we're staying root */
+ // Keep capabilities across UID change, unless we're staying root.
if (uid != 0) {
- int err = prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
- if (err < 0) {
- PLOG(FATAL) << "cannot PR_SET_KEEPCAPS";
- }
- }
-#endif // HAVE_ANDROID_OS
-
- int err = SetGids(env, javaGids);
- if (err < 0) {
- PLOG(FATAL) << "setgroups failed";
+ EnableKeepCapabilities();
}
- err = SetRLimits(env, javaRlimits);
- if (err < 0) {
- PLOG(FATAL) << "setrlimit failed";
- }
+ SetGids(env, javaGids);
- err = setgid(gid);
- if (err < 0) {
+ SetRLimits(env, javaRlimits);
+
+ int rc = setgid(gid);
+ if (rc == -1) {
PLOG(FATAL) << "setgid(" << gid << ") failed";
}
- err = setuid(uid);
- if (err < 0) {
+ rc = setuid(uid);
+ if (rc == -1) {
PLOG(FATAL) << "setuid(" << uid << ") failed";
}
- SetCapabilities(permittedCapabilities, effectiveCapabilities);
-
-#if 1
- UNIMPLEMENTED(WARNING) << "enable this code when cutils/sched_policy.h has SP_DEFAULT";
-#else
- err = set_sched_policy(0, SP_DEFAULT);
- if (err < 0) {
- errno = -err;
- PLOG(FATAL) << "set_sched_policy(0, SP_DEFAULT) 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);
+
+ SetSchedulerPolicy();
+
// Our system thread ID, etc, has changed so reset Thread state.
self->InitAfterFork();
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>