diff options
author | Ian Rogers <irogers@google.com> | 2014-03-01 04:49:17 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-03-01 04:49:17 +0000 |
commit | e4a74a6ac8d1486b1227504044a60002e69a9fec (patch) | |
tree | 117d99c16f201b2f14adfe0922e56b9ff433c133 | |
parent | 3c506f9877b4a106d93169b6bb5610b24a84d61c (diff) | |
parent | b48b9eb6d181a1f52e2e605cf26a21505f1d46ed (diff) | |
download | art-e4a74a6ac8d1486b1227504044a60002e69a9fec.zip art-e4a74a6ac8d1486b1227504044a60002e69a9fec.tar.gz art-e4a74a6ac8d1486b1227504044a60002e69a9fec.tar.bz2 |
Merge "Fix clang to compile and run host tests."
30 files changed, 146 insertions, 123 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk index 704da68..28546e9 100644 --- a/build/Android.common.mk +++ b/build/Android.common.mk @@ -91,10 +91,12 @@ LLVM_ROOT_PATH := external/llvm # Don't fail a dalvik minimal host build. -include $(LLVM_ROOT_PATH)/llvm.mk -# Clang build. -# ART_TARGET_CLANG := true +# Clang build support. +ART_TARGET_CLANG := false ifeq ($(HOST_OS),darwin) -ART_HOST_CLANG := true + ART_HOST_CLANG := true +else + ART_HOST_CLANG := false endif # directory used for dalvik-cache on device diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk index 2ddd09e..0b0c445 100644 --- a/build/Android.gtest.mk +++ b/build/Android.gtest.mk @@ -155,7 +155,6 @@ define build-art-test LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils LOCAL_STATIC_LIBRARIES += libgtest LOCAL_MODULE_PATH := $(ART_NATIVETEST_OUT) - include $(LLVM_DEVICE_BUILD_MK) include $(BUILD_EXECUTABLE) art_gtest_exe := $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE) ART_TARGET_GTEST_EXECUTABLES += $$(art_gtest_exe) @@ -168,7 +167,6 @@ define build-art-test # Mac OS complains about unresolved symbols if you don't include this. LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host endif - include $(LLVM_HOST_BUILD_MK) include $(BUILD_HOST_EXECUTABLE) art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe) diff --git a/compiler/Android.mk b/compiler/Android.mk index 8f840cc..b1b6fc5 100644 --- a/compiler/Android.mk +++ b/compiler/Android.mk @@ -106,7 +106,7 @@ endif LIBART_COMPILER_CFLAGS := ifeq ($(ART_USE_PORTABLE_COMPILER),true) -LIBART_COMPILER_SRC_FILES += +LIBART_COMPILER_SRC_FILES += \ dex/portable/mir_to_gbc.cc \ elf_writer_mclinker.cc \ jni/portable/jni_compiler.cc \ @@ -120,11 +120,12 @@ LIBART_COMPILER_SRC_FILES += llvm/runtime_support_builder.cc \ llvm/runtime_support_builder_arm.cc \ llvm/runtime_support_builder_x86.cc - LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 +LIBART_COMPILER_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 endif LIBART_COMPILER_ENUM_OPERATOR_OUT_HEADER_FILES := \ - dex/compiler_enums.h + dex/compiler_enums.h \ + dex/quick/dex_file_method_inliner.h # $(1): target or host # $(2): ndebug or debug @@ -211,12 +212,15 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT ifeq ($(TARGET_ARCH),arm64) $$(info TODOAArch64: $$(LOCAL_PATH)/Android.mk Add Arm64 specific MCLinker libraries) endif # TARGET_ARCH != arm64 + include $(LLVM_DEVICE_BUILD_MK) else # host LOCAL_STATIC_LIBRARIES += libmcldARMInfo libmcldARMTarget LOCAL_STATIC_LIBRARIES += libmcldX86Info libmcldX86Target LOCAL_STATIC_LIBRARIES += libmcldMipsInfo libmcldMipsTarget + include $(LLVM_HOST_BUILD_MK) endif LOCAL_STATIC_LIBRARIES += libmcldCore libmcldObject libmcldADT libmcldFragment libmcldTarget libmcldCodeGen libmcldLDVariant libmcldMC libmcldSupport libmcldLD + include $(LLVM_GEN_INTRINSICS_MK) endif LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime @@ -228,13 +232,9 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk ifeq ($$(art_target_or_host),target) LOCAL_SHARED_LIBRARIES += libcutils - include $(LLVM_GEN_INTRINSICS_MK) - include $(LLVM_DEVICE_BUILD_MK) include $(BUILD_SHARED_LIBRARY) else # host LOCAL_STATIC_LIBRARIES += libcutils - include $(LLVM_GEN_INTRINSICS_MK) - include $(LLVM_HOST_BUILD_MK) include $(BUILD_HOST_SHARED_LIBRARY) endif diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h index 0999d09..9bcc040 100644 --- a/compiler/common_compiler_test.h +++ b/compiler/common_compiler_test.h @@ -240,7 +240,7 @@ class CommonCompilerTest : public CommonRuntimeTest { #if GCC_VERSION >= 40303 __builtin___clear_cache(reinterpret_cast<void*>(base), reinterpret_cast<void*>(base + len)); #else - LOG(FATAL) << "UNIMPLEMENTED: cache flush"; + LOG(WARNING) << "UNIMPLEMENTED: cache flush"; #endif } diff --git a/compiler/compiler_backend.h b/compiler/compiler_backend.h index 01a69af..2d68b21 100644 --- a/compiler/compiler_backend.h +++ b/compiler/compiler_backend.h @@ -23,7 +23,7 @@ namespace art { class Backend; -class CompilationUnit; +struct CompilationUnit; class CompilerDriver; class CompiledMethod; class MIRGraph; diff --git a/compiler/dex/frontend.h b/compiler/dex/frontend.h index 8ce1206..22a7b8c 100644 --- a/compiler/dex/frontend.h +++ b/compiler/dex/frontend.h @@ -105,7 +105,7 @@ class LLVMInfo { UniquePtr<art::llvm::IRBuilder> ir_builder_; }; -struct CompiledMethod; +class CompiledMethod; class CompilerDriver; } // namespace art diff --git a/compiler/dex/pass.h b/compiler/dex/pass.h index 255892e..9457d5b 100644 --- a/compiler/dex/pass.h +++ b/compiler/dex/pass.h @@ -22,8 +22,8 @@ namespace art { // Forward declarations. -class BasicBlock; -class CompilationUnit; +struct BasicBlock; +struct CompilationUnit; class Pass; /** diff --git a/compiler/dex/portable/mir_to_gbc.cc b/compiler/dex/portable/mir_to_gbc.cc index 3187fbb..70438ec 100644 --- a/compiler/dex/portable/mir_to_gbc.cc +++ b/compiler/dex/portable/mir_to_gbc.cc @@ -30,6 +30,7 @@ #include "dex/compiler_internals.h" #include "dex/dataflow_iterator-inl.h" #include "dex/frontend.h" +#include "llvm/ir_builder.h" #include "llvm/llvm_compilation_unit.h" #include "llvm/utils_llvm.h" #include "mir_to_gbc.h" diff --git a/compiler/dex/portable/mir_to_gbc.h b/compiler/dex/portable/mir_to_gbc.h index 2b681f6..e97634c 100644 --- a/compiler/dex/portable/mir_to_gbc.h +++ b/compiler/dex/portable/mir_to_gbc.h @@ -17,11 +17,18 @@ #ifndef ART_COMPILER_DEX_PORTABLE_MIR_TO_GBC_H_ #define ART_COMPILER_DEX_PORTABLE_MIR_TO_GBC_H_ +#include <llvm/ADT/ArrayRef.h> +#include <llvm/IR/BasicBlock.h> +#include <llvm/IR/IRBuilder.h> +#include <llvm/IR/LLVMContext.h> +#include <llvm/IR/Module.h> + #include "invoke_type.h" #include "compiled_method.h" #include "dex/compiler_enums.h" #include "dex/compiler_ir.h" #include "dex/backend.h" +#include "llvm/intrinsic_helper.h" #include "llvm/llvm_compilation_unit.h" #include "safe_map.h" diff --git a/compiler/dex/quick/dex_file_method_inliner.h b/compiler/dex/quick/dex_file_method_inliner.h index 3dcb964..b4d8dd6 100644 --- a/compiler/dex/quick/dex_file_method_inliner.h +++ b/compiler/dex/quick/dex_file_method_inliner.h @@ -31,7 +31,7 @@ namespace verifier { class MethodVerifier; } // namespace verifier -class CallInfo; +struct CallInfo; class Mir2Lir; enum InlineMethodOpcode : uint16_t { @@ -61,6 +61,7 @@ enum InlineMethodOpcode : uint16_t { kInlineOpIGet, kInlineOpIPut, }; +std::ostream& operator<<(std::ostream& os, const InlineMethodOpcode& rhs); enum InlineMethodFlags : uint16_t { kNoInlineMethodFlags = 0x0000, @@ -78,13 +79,13 @@ enum IntrinsicFlags { // kIntrinsicIsEmptyOrLength kIntrinsicFlagLength = kIntrinsicFlagNone, - kIntrinsicFlagIsEmpty = 1, + kIntrinsicFlagIsEmpty = kIntrinsicFlagMin, // kIntrinsicIndexOf - kIntrinsicFlagBase0 = 1, + kIntrinsicFlagBase0 = kIntrinsicFlagMin, // kIntrinsicUnsafeGet, kIntrinsicUnsafePut, kIntrinsicUnsafeCas - kIntrinsicFlagIsLong = 1, + kIntrinsicFlagIsLong = kIntrinsicFlagMin, // kIntrinsicUnsafeGet, kIntrinsicUnsafePut kIntrinsicFlagIsVolatile = 2, // kIntrinsicUnsafePut, kIntrinsicUnsafeCas @@ -187,7 +188,6 @@ class DexFileMethodInliner { */ bool GenSpecial(Mir2Lir* backend, uint32_t method_idx); - private: /** * To avoid multiple lookups of a class by its descriptor, we cache its * type index in the IndexCache. These are the indexes into the IndexCache @@ -311,6 +311,7 @@ class DexFileMethodInliner { kProtoCacheLast }; + private: /** * The maximum number of method parameters we support in the ProtoDef. */ diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 377eb6f..1bd2c1b 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -48,7 +48,7 @@ class AOTCompilationStats; class CompilerOptions; class DexCompilationUnit; class DexFileToMethodInlinerMap; -class InlineIGetIPutData; +struct InlineIGetIPutData; class OatWriter; class ParallelCompilationManager; class TimingLogger; diff --git a/compiler/utils/arena_bit_vector.cc b/compiler/utils/arena_bit_vector.cc index 6f03524..220ff14 100644 --- a/compiler/utils/arena_bit_vector.cc +++ b/compiler/utils/arena_bit_vector.cc @@ -42,6 +42,8 @@ class ArenaBitVectorAllocator : public Allocator { ArenaBitVector::ArenaBitVector(ArenaAllocator* arena, unsigned int start_bits, bool expandable, OatBitMapKind kind) - : BitVector(start_bits, expandable, new (arena) ArenaBitVectorAllocator(arena)), kind_(kind) {} + : BitVector(start_bits, expandable, new (arena) ArenaBitVectorAllocator(arena)), kind_(kind) { + UNUSED(kind_); +} } // namespace art diff --git a/compiler/utils/arm/managed_register_arm.cc b/compiler/utils/arm/managed_register_arm.cc index 57c2305..1fdc110 100644 --- a/compiler/utils/arm/managed_register_arm.cc +++ b/compiler/utils/arm/managed_register_arm.cc @@ -21,16 +21,6 @@ namespace art { namespace arm { -// We need all registers for caching of locals. -// Register R9 .. R15 are reserved. -static const int kNumberOfAvailableCoreRegisters = (R8 - R0) + 1; -static const int kNumberOfAvailableSRegisters = kNumberOfSRegisters; -static const int kNumberOfAvailableDRegisters = kNumberOfDRegisters; -static const int kNumberOfAvailableOverlappingDRegisters = - kNumberOfOverlappingDRegisters; -static const int kNumberOfAvailableRegisterPairs = kNumberOfRegisterPairs; - - // Returns true if this managed-register overlaps the other managed-register. bool ArmManagedRegister::Overlaps(const ArmManagedRegister& other) const { if (IsNoRegister() || other.IsNoRegister()) return false; diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index c9be4ed..296254d 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -282,7 +282,9 @@ class AssemblerBuffer { byte* cursor_; byte* limit_; AssemblerFixup* fixup_; +#ifndef NDEBUG bool fixups_processed_; +#endif // Head of linked list of slow paths SlowPath* slow_path_; diff --git a/compiler/utils/mips/managed_register_mips.cc b/compiler/utils/mips/managed_register_mips.cc index 195dafb..5a8c048 100644 --- a/compiler/utils/mips/managed_register_mips.cc +++ b/compiler/utils/mips/managed_register_mips.cc @@ -21,17 +21,6 @@ namespace art { namespace mips { -// These core registers are never available for allocation. -static const Register kReservedCoreRegistersArray[] = { S0, S1 }; - -// We need all registers for caching. -static const int kNumberOfAvailableCoreRegisters = (S7 - T0) + 1; -static const int kNumberOfAvailableFRegisters = kNumberOfFRegisters; -static const int kNumberOfAvailableDRegisters = kNumberOfDRegisters; -static const int kNumberOfAvailableOverlappingDRegisters = - kNumberOfOverlappingDRegisters; -static const int kNumberOfAvailableRegisterPairs = kNumberOfRegisterPairs; - bool MipsManagedRegister::Overlaps(const MipsManagedRegister& other) const { if (IsNoRegister() || other.IsNoRegister()) return false; CHECK(IsValidManagedRegister()); diff --git a/compiler/utils/x86/managed_register_x86.cc b/compiler/utils/x86/managed_register_x86.cc index 4697d06..7fae7a8 100644 --- a/compiler/utils/x86/managed_register_x86.cc +++ b/compiler/utils/x86/managed_register_x86.cc @@ -21,19 +21,6 @@ namespace art { namespace x86 { -// These cpu registers are never available for allocation. -static const Register kReservedCpuRegistersArray[] = { ESP }; - - -// We reduce the number of available registers for allocation in debug-code -// mode in order to increase register pressure. - -// We need all registers for caching. -static const int kNumberOfAvailableCpuRegisters = kNumberOfCpuRegisters; -static const int kNumberOfAvailableXmmRegisters = kNumberOfXmmRegisters; -static const int kNumberOfAvailableRegisterPairs = kNumberOfRegisterPairs; - - // Define register pairs. // This list must be kept in sync with the RegisterPair enum. #define REGISTER_PAIR_LIST(P) \ diff --git a/disassembler/Android.mk b/disassembler/Android.mk index 1ce7b13..ca08b09 100644 --- a/disassembler/Android.mk +++ b/disassembler/Android.mk @@ -90,13 +90,9 @@ define build-libart-disassembler LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk ifeq ($$(art_target_or_host),target) LOCAL_SHARED_LIBRARIES += libcutils - include $(LLVM_GEN_INTRINSICS_MK) - include $(LLVM_DEVICE_BUILD_MK) include $(BUILD_SHARED_LIBRARY) else # host LOCAL_STATIC_LIBRARIES += libcutils - include $(LLVM_GEN_INTRINSICS_MK) - include $(LLVM_HOST_BUILD_MK) include $(BUILD_HOST_SHARED_LIBRARY) endif endef 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; diff --git a/tools/generate-operator-out.py b/tools/generate-operator-out.py index 19266b4..56b8674 100755 --- a/tools/generate-operator-out.py +++ b/tools/generate-operator-out.py @@ -23,7 +23,7 @@ import string import sys -_ENUM_START_RE = re.compile(r'\benum\b\s+(\S+)\s+\{') +_ENUM_START_RE = re.compile(r'\benum\b\s+(\S+)\s+:?.*\{') _ENUM_VALUE_RE = re.compile(r'([A-Za-z0-9_]+)(.*)') _ENUM_END_RE = re.compile(r'^\s*\};$') _ENUMS = {} |