summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-02-28 16:20:21 -0800
committerIan Rogers <irogers@google.com>2014-02-28 19:03:57 -0800
commitb48b9eb6d181a1f52e2e605cf26a21505f1d46ed (patch)
tree117d99c16f201b2f14adfe0922e56b9ff433c133 /runtime
parent3c506f9877b4a106d93169b6bb5610b24a84d61c (diff)
downloadart-b48b9eb6d181a1f52e2e605cf26a21505f1d46ed.zip
art-b48b9eb6d181a1f52e2e605cf26a21505f1d46ed.tar.gz
art-b48b9eb6d181a1f52e2e605cf26a21505f1d46ed.tar.bz2
Fix clang to compile and run host tests.
Don't use the computed goto interpreter with clang 3.4 as it causes compilation to hang. Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it sets clang incompatible cflags. Most fixes are self-evident, for the quick dex file method inliner the enums were being used with ostreams, so fix the enums and operator out python script to allow this. Note this change effects portable but this is untestable as portable was broken by ELF file and mc linker changes. Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
Diffstat (limited to 'runtime')
-rw-r--r--runtime/Android.mk38
-rw-r--r--runtime/arch/x86/asm_support_x86.S64
-rw-r--r--runtime/gc/allocator/rosalloc.h3
-rw-r--r--runtime/gc/collector/mark_sweep.cc2
-rw-r--r--runtime/interpreter/interpreter.cc34
-rw-r--r--runtime/interpreter/interpreter_common.h8
-rw-r--r--runtime/jdwp/jdwp.h4
-rw-r--r--runtime/mirror/object-inl.h5
-rw-r--r--runtime/runtime.h2
-rw-r--r--runtime/runtime_linux.cc2
-rw-r--r--runtime/thread.h2
-rw-r--r--runtime/zip_archive_test.cc4
12 files changed, 108 insertions, 60 deletions
diff --git a/runtime/Android.mk b/runtime/Android.mk
index d6d2b42..10ef64b 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -74,7 +74,6 @@ LIBART_COMMON_SRC_FILES := \
intern_table.cc \
interpreter/interpreter.cc \
interpreter/interpreter_common.cc \
- interpreter/interpreter_goto_table_impl.cc \
interpreter/interpreter_switch_impl.cc \
jdwp/jdwp_event.cc \
jdwp/jdwp_expand_buf.cc \
@@ -185,6 +184,10 @@ LIBART_COMMON_SRC_FILES += \
entrypoints/quick/quick_throw_entrypoints.cc \
entrypoints/quick/quick_trampoline_entrypoints.cc
+# Source files that only compile with GCC.
+LIBART_GCC_ONLY_SRC_FILES := \
+ interpreter/interpreter_goto_table_impl.cc
+
LIBART_LDFLAGS := -Wl,--no-fatal-warnings
LIBART_TARGET_SRC_FILES := \
@@ -300,6 +303,7 @@ endif
# $(1): target or host
# $(2): ndebug or debug
+# 3(3): true or false for LOCAL_CLANG
define build-libart
ifneq ($(1),target)
ifneq ($(1),host)
@@ -311,9 +315,15 @@ define build-libart
$$(error expected ndebug or debug for argument 2, received $(2))
endif
endif
+ ifneq ($(3),true)
+ ifneq ($(3),false)
+ $$(error expected true or false for argument 3, received $(3))
+ endif
+ endif
art_target_or_host := $(1)
art_ndebug_or_debug := $(2)
+ art_clang := $(3)
include $(CLEAR_VARS)
ifeq ($$(art_target_or_host),target)
@@ -354,11 +364,14 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
$(foreach arch,$(ART_SUPPORTED_ARCH),
LOCAL_LDFLAGS_$(arch) := $$(LIBART_TARGET_LDFLAGS_$(arch)))
+ ifeq ($$(art_clang),false)
+ LOCAL_SRC_FILES += $(LIBART_GCC_ONLY_SRC_FILES)
+ else
+ LOCAL_CLANG := true
+ endif
ifeq ($$(art_target_or_host),target)
- LOCAL_CLANG := $(ART_TARGET_CLANG)
LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
else # host
- LOCAL_CLANG := $(ART_HOST_CLANG)
LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
endif
ifeq ($$(art_ndebug_or_debug),debug)
@@ -389,7 +402,14 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
LOCAL_LDLIBS += -lrt
endif
endif
- include $(LLVM_GEN_INTRINSICS_MK)
+ ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ include $(LLVM_GEN_INTRINSICS_MK)
+ ifeq ($$(art_target_or_host),target)
+ include $(LLVM_DEVICE_BUILD_MK)
+ else # host
+ include $(LLVM_HOST_BUILD_MK)
+ endif
+ endif
LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
@@ -398,27 +418,25 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
endif
ifeq ($$(art_target_or_host),target)
- include $(LLVM_DEVICE_BUILD_MK)
include $(BUILD_SHARED_LIBRARY)
else # host
- include $(LLVM_HOST_BUILD_MK)
include $(BUILD_HOST_SHARED_LIBRARY)
endif
endef
ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
- $(eval $(call build-libart,target,ndebug))
+ $(eval $(call build-libart,target,ndebug,$(ART_TARGET_CLANG)))
endif
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
- $(eval $(call build-libart,target,debug))
+ $(eval $(call build-libart,target,debug,$(ART_TARGET_CLANG)))
endif
# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
ifeq ($(WITH_HOST_DALVIK),true)
ifeq ($(ART_BUILD_NDEBUG),true)
- $(eval $(call build-libart,host,ndebug))
+ $(eval $(call build-libart,host,ndebug,$(ART_HOST_CLANG)))
endif
ifeq ($(ART_BUILD_DEBUG),true)
- $(eval $(call build-libart,host,debug))
+ $(eval $(call build-libart,host,debug,$(ART_HOST_CLANG)))
endif
endif
diff --git a/runtime/arch/x86/asm_support_x86.S b/runtime/arch/x86/asm_support_x86.S
index 9ec1995..267717a 100644
--- a/runtime/arch/x86/asm_support_x86.S
+++ b/runtime/arch/x86/asm_support_x86.S
@@ -19,38 +19,25 @@
#include "asm_support_x86.h"
-#if defined(__APPLE__)
- // Mac OS' as(1) doesn't let you name macro parameters.
+#if defined(__clang__)
+ // Clang's as(1) doesn't let you name macro parameters.
#define MACRO0(macro_name) .macro macro_name
#define MACRO1(macro_name, macro_arg1) .macro macro_name
#define MACRO2(macro_name, macro_arg1, macro_args2) .macro macro_name
#define MACRO3(macro_name, macro_arg1, macro_args2, macro_args3) .macro macro_name
#define END_MACRO .endmacro
- // Mac OS' as(1) uses $0, $1, and so on for macro arguments, and function names
- // are mangled with an extra underscore prefix. The use of $x for arguments
- // mean that literals need to be represented with $$x in macros.
- #define SYMBOL(name) _ ## name
- #define PLT_SYMBOL(name) _ ## name
+ // Clang's as(1) uses $0, $1, and so on for macro arguments.
#define VAR(name,index) SYMBOL($index)
#define PLT_VAR(name, index) SYMBOL($index)
#define REG_VAR(name,index) %$index
#define CALL_MACRO(name,index) $index
+ #define FUNCTION_TYPE(name,index) .type $index, @function
+ #define SIZE(name,index) .size $index, .-$index
+
+ // The use of $x for arguments mean that literals need to be represented with $$x in macros.
#define LITERAL(value) $value
#define MACRO_LITERAL(value) $$value
-
- // Mac OS' doesn't like cfi_* directives
- #define CFI_STARTPROC
- #define CFI_ENDPROC
- #define CFI_ADJUST_CFA_OFFSET(size)
- #define CFI_DEF_CFA(reg,size)
- #define CFI_DEF_CFA_REGISTER(reg)
- #define CFI_RESTORE(reg)
- #define CFI_REL_OFFSET(reg,size)
-
- // Mac OS' doesn't support certain directives
- #define FUNCTION_TYPE(name)
- #define SIZE(name)
#else
// Regular gas(1) lets you name macro parameters.
#define MACRO0(macro_name) .macro macro_name
@@ -65,16 +52,19 @@
// no special meaning to $, so literals are still just $x. The use of altmacro means % is a
// special character meaning care needs to be taken when passing registers as macro arguments.
.altmacro
- #define SYMBOL(name) name
- #define PLT_SYMBOL(name) name@PLT
#define VAR(name,index) name&
#define PLT_VAR(name, index) name&@PLT
#define REG_VAR(name,index) %name
#define CALL_MACRO(name,index) name&
+ #define FUNCTION_TYPE(name,index) .type name&, @function
+ #define SIZE(name,index) .size name, .-name
+
#define LITERAL(value) $value
#define MACRO_LITERAL(value) $value
+#endif
- // CFI support
+ // CFI support.
+#if !defined(__APPLE__)
#define CFI_STARTPROC .cfi_startproc
#define CFI_ENDPROC .cfi_endproc
#define CFI_ADJUST_CFA_OFFSET(size) .cfi_adjust_cfa_offset size
@@ -82,9 +72,25 @@
#define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg
#define CFI_RESTORE(reg) .cfi_restore reg
#define CFI_REL_OFFSET(reg,size) .cfi_rel_offset reg,size
+#else
+ // Mac OS' doesn't like cfi_* directives.
+ #define CFI_STARTPROC
+ #define CFI_ENDPROC
+ #define CFI_ADJUST_CFA_OFFSET(size)
+ #define CFI_DEF_CFA(reg,size)
+ #define CFI_DEF_CFA_REGISTER(reg)
+ #define CFI_RESTORE(reg)
+ #define CFI_REL_OFFSET(reg,size)
+#endif
- #define FUNCTION_TYPE(name) .type name&, @function
- #define SIZE(name) .size name, .-name
+ // Symbols.
+#if !defined(__APPLE__)
+ #define SYMBOL(name) name
+ #define PLT_SYMBOL(name) name
+#else
+ // Mac OS' symbols have an _ prefix.
+ #define SYMBOL(name) _ ## name
+ #define PLT_SYMBOL(name) _ ## name
#endif
/* Cache alignment for function entry */
@@ -93,7 +99,7 @@ MACRO0(ALIGN_FUNCTION_ENTRY)
END_MACRO
MACRO1(DEFINE_FUNCTION, c_name)
- FUNCTION_TYPE(\c_name)
+ FUNCTION_TYPE(\c_name, 0)
.globl VAR(c_name, 0)
ALIGN_FUNCTION_ENTRY
VAR(c_name, 0):
@@ -102,7 +108,7 @@ END_MACRO
MACRO1(END_FUNCTION, c_name)
CFI_ENDPROC
- SIZE(\c_name)
+ SIZE(\c_name, 0)
END_MACRO
MACRO1(PUSH, reg)
@@ -118,7 +124,7 @@ MACRO1(POP, reg)
END_MACRO
MACRO1(UNIMPLEMENTED,name)
- FUNCTION_TYPE(\name)
+ FUNCTION_TYPE(\name, 0)
.globl VAR(name, 0)
ALIGN_FUNCTION_ENTRY
VAR(name, 0):
@@ -126,7 +132,7 @@ VAR(name, 0):
int3
int3
CFI_ENDPROC
- SIZE(\name)
+ SIZE(\name, 0)
END_MACRO
MACRO0(SETUP_GOT_NOSAVE)
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index 5b4ca80..dd2bb5d 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -439,9 +439,6 @@ class RosAlloc {
hash_set<Run*, hash_run, eq_run> full_runs_[kNumOfSizeBrackets];
// The set of free pages.
std::set<FreePageRun*> free_page_runs_ GUARDED_BY(lock_);
- // The free page run whose end address is the end of the memory
- // region that's managed by this allocator, if any.
- FreePageRun* last_free_page_run_;
// The current runs where the allocations are first attempted for
// the size brackes that do not use thread-local
// runs. current_runs_[i] is guarded by size_bracket_locks_[i].
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 7b2bc3b..c39e56f 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -861,7 +861,7 @@ void MarkSweep::ScanGrayObjects(bool paused, byte minimum_age) {
size_t mark_stack_increment = std::min(mark_stack_delta, mark_stack_remaining);
mark_stack_end -= mark_stack_increment;
mark_stack_->PopBackCount(static_cast<int32_t>(mark_stack_increment));
- DCHECK_EQ(mark_stack_end, mark_stack_->End());
+ DCHECK_EQ(mark_stack_end, const_cast<const art::mirror::Object **>(mark_stack_->End()));
// Add the new task to the thread pool.
auto* task = new CardScanTask(thread_pool, this, space->GetMarkBitmap(), card_begin,
card_begin + card_increment, minimum_age,
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 40d4ea3..abe7fe1 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -286,11 +286,39 @@ static void InterpreterJni(Thread* self, ArtMethod* method, const StringPiece& s
}
enum InterpreterImplKind {
- kSwitchImpl, // switch-based interpreter implementation.
- kComputedGotoImplKind // computed-goto-based interpreter implementation.
+ kSwitchImpl, // Switch-based interpreter implementation.
+ kComputedGotoImplKind // Computed-goto-based interpreter implementation.
};
-static const InterpreterImplKind kInterpreterImplKind = kComputedGotoImplKind;
+#if !defined(__clang__)
+static constexpr InterpreterImplKind kInterpreterImplKind = kComputedGotoImplKind;
+#else
+// Clang 3.4 fails to build the goto interpreter implementation.
+static constexpr InterpreterImplKind kInterpreterImplKind = kSwitchImpl;
+template<bool do_access_check, bool transaction_active>
+JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
+ ShadowFrame& shadow_frame, JValue result_register) {
+ LOG(FATAL) << "UNREACHABLE";
+ exit(0);
+}
+// Explicit definitions of ExecuteGotoImpl.
+template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+JValue ExecuteGotoImpl<true, false>(Thread* self, MethodHelper& mh,
+ const DexFile::CodeItem* code_item,
+ ShadowFrame& shadow_frame, JValue result_register);
+template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+JValue ExecuteGotoImpl<false, false>(Thread* self, MethodHelper& mh,
+ const DexFile::CodeItem* code_item,
+ ShadowFrame& shadow_frame, JValue result_register);
+template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+JValue ExecuteGotoImpl<true, true>(Thread* self, MethodHelper& mh,
+ const DexFile::CodeItem* code_item,
+ ShadowFrame& shadow_frame, JValue result_register);
+template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+JValue ExecuteGotoImpl<false, true>(Thread* self, MethodHelper& mh,
+ const DexFile::CodeItem* code_item,
+ ShadowFrame& shadow_frame, JValue result_register);
+#endif
static JValue Execute(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
ShadowFrame& shadow_frame, JValue result_register)
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index a03e420..589e0b0 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -515,11 +515,11 @@ static inline uint32_t FindNextInstructionFollowingException(Thread* self,
return found_dex_pc;
}
-static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
- __attribute__((cold, noreturn, noinline));
+static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
+ __attribute__((cold, noreturn))
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) {
LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(&mh.GetDexFile());
exit(0); // Unreachable, keep GCC happy.
}
diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h
index 1ec795f..fdbdfeb 100644
--- a/runtime/jdwp/jdwp.h
+++ b/runtime/jdwp/jdwp.h
@@ -96,9 +96,9 @@ struct JdwpOptions {
};
struct JdwpEvent;
-struct JdwpNetStateBase;
+class JdwpNetStateBase;
struct ModBasket;
-struct Request;
+class Request;
/*
* State for JDWP functions.
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index 478cc36..484c21a 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -323,9 +323,9 @@ inline size_t Object::SizeOf() {
size_t result;
constexpr auto kNewFlags = static_cast<VerifyObjectFlags>(kVerifyFlags & ~kVerifyThis);
if (IsArrayInstance<kVerifyFlags>()) {
- result = AsArray<kNewFlags>()->SizeOf<>();
+ result = AsArray<kNewFlags>()->template SizeOf<kNewFlags>();
} else if (IsClass<kNewFlags>()) {
- result = AsClass<kNewFlags>()->SizeOf<kNewFlags>();
+ result = AsClass<kNewFlags>()->template SizeOf<kNewFlags>();
} else {
result = GetClass<kNewFlags>()->GetObjectSize();
}
@@ -485,7 +485,6 @@ inline void Object::SetFieldObjectWithoutWriteBarrier(MemberOffset field_offset,
if (kVerifyFlags & kVerifyWrites) {
VerifyObject(new_value);
}
- HeapReference<Object> objref(HeapReference<Object>::FromMirrorPtr(new_value));
byte* raw_addr = reinterpret_cast<byte*>(this) + field_offset.Int32Value();
HeapReference<Object>* objref_addr = reinterpret_cast<HeapReference<Object>*>(raw_addr);
if (UNLIKELY(is_volatile)) {
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 249bb45..7f8e915 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -60,7 +60,7 @@ class ClassLinker;
class CompilerCallbacks;
class DexFile;
class InternTable;
-struct JavaVMExt;
+class JavaVMExt;
class MonitorList;
class MonitorPool;
class SignalCatcher;
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc
index 4a166d7..f15e0bf 100644
--- a/runtime/runtime_linux.cc
+++ b/runtime/runtime_linux.cc
@@ -24,7 +24,7 @@
#include "base/logging.h"
#include "base/mutex.h"
#include "base/stringprintf.h"
-#include "thread.h"
+#include "thread-inl.h"
#include "utils.h"
namespace art {
diff --git a/runtime/thread.h b/runtime/thread.h
index fcae9e4..6df2b1c 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -67,7 +67,7 @@ class Closure;
class Context;
struct DebugInvokeReq;
class DexFile;
-struct JavaVMExt;
+class JavaVMExt;
struct JNIEnvExt;
class Monitor;
class Runtime;
diff --git a/runtime/zip_archive_test.cc b/runtime/zip_archive_test.cc
index 0bf6767..c43fee5 100644
--- a/runtime/zip_archive_test.cc
+++ b/runtime/zip_archive_test.cc
@@ -32,10 +32,10 @@ class ZipArchiveTest : public CommonRuntimeTest {};
TEST_F(ZipArchiveTest, FindAndExtract) {
std::string error_msg;
UniquePtr<ZipArchive> zip_archive(ZipArchive::Open(GetLibCoreDexFileName().c_str(), &error_msg));
- ASSERT_TRUE(zip_archive.get() != false) << error_msg;
+ ASSERT_TRUE(zip_archive.get() != nullptr) << error_msg;
ASSERT_TRUE(error_msg.empty());
UniquePtr<ZipEntry> zip_entry(zip_archive->Find("classes.dex", &error_msg));
- ASSERT_TRUE(zip_entry.get() != false);
+ ASSERT_TRUE(zip_entry.get() != nullptr);
ASSERT_TRUE(error_msg.empty());
ScratchFile tmp;