Merge "Add thread pool class" into dalvik-dev
diff --git a/Android.mk b/Android.mk
index 3e17072..162becb 100644
--- a/Android.mk
+++ b/Android.mk
@@ -87,9 +87,6 @@
ifeq ($(ART_USE_LLVM_COMPILER),true)
include $(build_path)/Android.libart-compiler-llvm.mk
endif
-ifeq ($(ART_USE_GREENLAND_COMPILER),true)
-include $(build_path)/Android.libart-compiler-greenland.mk
-endif
include $(build_path)/Android.executable.mk
include $(build_path)/Android.oat.mk
diff --git a/build/Android.common.mk b/build/Android.common.mk
index f4c7c98..d141149 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -24,7 +24,6 @@
ART_USE_PORTABLE_COMPILER := true
endif
ifeq ($(ART_USE_PORTABLE_COMPILER),true)
-WITH_ART_USE_QUICK_COMPILER := true
WITH_ART_USE_LLVM_COMPILER := true
endif
@@ -39,48 +38,8 @@
ART_USE_LLVM_COMPILER := true
endif
-ART_USE_DEXLANG_FRONTEND := false
-ifeq ($(ART_USE_LLVM_COMPILER),true)
- ifneq ($(wildcard art/USE_DEXLANG_FRONTEND),)
- $(info Enabling ART_USE_DEXLANG_FRONTEND because of existence of art/USE_DEXLANG_FRONTEND)
- ART_USE_DEXLANG_FRONTEND := true
- endif
- ifeq ($(WITH_ART_USE_DEXLANG_FRONTEND),true)
- $(info Enabling ART_USE_DEXLANG_FRONTEND because WITH_ART_USE_DEXLANG_FRONTEND=true)
- ART_USE_DEXLANG_FRONTEND := true
- endif
-endif
-
-ART_USE_GREENLAND_COMPILER := false
-ifneq ($(wildcard art/USE_GREENLAND_COMPILER),)
-$(info Enabling ART_USE_GREENLAND_COMPILER because of existence of art/USE_GREENLAND_COMPILER)
-ART_USE_GREENLAND_COMPILER := true
-endif
-ifeq ($(WITH_ART_USE_GREENLAND_COMPILER),true)
-$(info Enabling ART_USE_GREENLAND_COMPILER because WITH_ART_USE_GREENLAND_COMPILER=true)
-ART_USE_GREENLAND_COMPILER := true
-endif
-
-ART_USE_QUICK_COMPILER := false
-ifneq ($(wildcard art/USE_QUICK_COMPILER),)
-ART_USE_QUICK_COMPILER := true
-$(info Enabling ART_USE_QUICK_COMPILER because of existence of art/USE_QUICK_COMPILER)
-endif
-ifeq ($(WITH_ART_USE_QUICK_COMPILER),true)
-ART_USE_QUICK_COMPILER := true
-$(info Enabling ART_USE_QUICK_COMPILER because WITH_ART_USE_QUICK_COMPILER=true)
-endif
-
-ifeq ($(words $(filter true,$(ART_USE_LLVM_COMPILER) $(ART_USE_GREENLAND_COMPILER) $(ART_USE_QUICK_COMPILER))),0)
-ART_REQUIRE_LLVM := false
-else #!0
-ART_REQUIRE_LLVM := true
-endif #!0
-
-ifeq ($(ART_REQUIRE_LLVM),true)
LLVM_ROOT_PATH := external/llvm
include $(LLVM_ROOT_PATH)/llvm.mk
-endif
# directory used for gtests on device
ART_NATIVETEST_DIR := /data/nativetest/art
@@ -276,18 +235,6 @@
src/compiler_llvm/runtime_support_llvm.cc
endif
-ifeq ($(ART_USE_GREENLAND_COMPILER),true)
-LIBART_COMMON_SRC_FILES += \
- src/greenland/inferred_reg_category_map.cc \
- src/greenland/runtime_entry_points.cc \
- src/greenland/runtime/support_alloc.cc \
- src/greenland/runtime/support_cast.cc \
- src/greenland/runtime/support_dexcache.cc \
- src/greenland/runtime/support_exception.cc \
- src/greenland/runtime/support_field.cc \
- src/greenland/runtime/support_thread.cc
-endif
-
LIBART_COMMON_SRC_FILES += \
src/oat/runtime/context.cc \
src/oat/runtime/support_alloc.cc \
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index ac1d64e..d06b200 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -20,17 +20,9 @@
ART_EXECUTABLES_CFLAGS :=
ifeq ($(ART_USE_LLVM_COMPILER),true)
ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1
- ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
- ART_EXECUTABLES_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1
- endif
endif
-
-ifeq ($(ART_USE_GREENLAND_COMPILER),true)
- ART_EXECUTABLES_CFLAGS += -DART_USE_GREENLAND_COMPILER=1
-endif
-
-ifeq ($(ART_USE_QUICK_COMPILER),true)
- ART_EXECUTABLES_CFLAGS += -DART_USE_QUICK_COMPILER=1
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
# $(1): executable ("d" will be appended for debug version)
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 6d865dc..c3674f2 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -22,17 +22,9 @@
ART_TEST_CFLAGS :=
ifeq ($(ART_USE_LLVM_COMPILER),true)
ART_TEST_CFLAGS += -DART_USE_LLVM_COMPILER=1
- ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
- ART_TEST_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1
- endif
endif
-
-ifeq ($(ART_USE_GREENLAND_COMPILER),true)
- ART_TEST_CFLAGS += -DART_USE_GREENLAND_COMPILER=1
-endif
-
-ifeq ($(ART_USE_QUICK_COMPILER),true)
- ART_TEST_CFLAGS += -DART_USE_QUICK_COMPILER=1
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
# $(1): target or host
diff --git a/build/Android.libart-compiler-greenland.mk b/build/Android.libart-compiler-greenland.mk
deleted file mode 100644
index 9baef69..0000000
--- a/build/Android.libart-compiler-greenland.mk
+++ /dev/null
@@ -1,206 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-
-LIBART_COMPILER_GREENLAND_CFLAGS := -DART_USE_GREENLAND_COMPILER=1
-
-LIBART_COMPILER_GREENLAND_SRC_FILES += \
- src/greenland/inferred_reg_category_map.cc \
- src/greenland/dalvik_reg.cc \
- src/greenland/dex_lang.cc \
- src/greenland/gbc_context.cc \
- src/greenland/greenland.cc \
- src/greenland/intrinsic_helper.cc \
- src/greenland/register_allocator.cc \
- src/greenland/target_codegen_machine.cc \
- src/greenland/target_registry.cc \
- src/oat/jni/calling_convention.cc \
- src/oat/jni/jni_compiler.cc \
- src/oat/jni/arm/calling_convention_arm.cc \
- src/oat/jni/mips/calling_convention_mips.cc \
- src/oat/jni/x86/calling_convention_x86.cc
-
-LIBART_COMPILER_GREENLAND_arm_SRC_FILES += \
- src/greenland/arm/arm_codegen_machine.cc \
- src/greenland/arm/arm_invoke_stub_compiler.cc
-
-LIBART_COMPILER_GREENLAND_mips_SRC_FILES += \
- src/greenland/mips/mips_codegen_machine.cc \
- src/greenland/mips/mips_invoke_stub_compiler.cc
-
-LIBART_COMPILER_GREENLAND_x86_SRC_FILES += \
- src/greenland/x86/x86_codegen_machine.cc \
- src/greenland/x86/x86_lir_emitter.cc \
- src/greenland/x86/x86_lir_info.cc \
- src/greenland/x86/x86_invoke_stub_compiler.cc
-
-########################################################################
-
-include $(CLEAR_VARS)
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := target_lir_builder_generator
-LOCAL_MODULE_TAGS := optional
-LOCAL_IS_HOST_MODULE := true
-LOCAL_SRC_FILES := src/greenland/tools/target_lir_builder_generator.cc
-LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
-LOCAL_C_INCLUDES := $(ART_C_INCLUDES)
-include $(BUILD_HOST_EXECUTABLE)
-TARGET_LIR_BUILDER_GENERATOR := $(LOCAL_BUILT_MODULE)
-
-########################################################################
-
-# $(1): target or host
-# $(2): ndebug or debug
-define build-libart-compiler-greenland
- ifneq ($(1),target)
- ifneq ($(1),host)
- $$(error expected target or host for argument 1, received $(1))
- endif
- endif
- ifneq ($(2),ndebug)
- ifneq ($(2),debug)
- $$(error expected ndebug or debug for argument 2, received $(2))
- endif
- endif
-
- art_target_or_host := $(1)
- art_ndebug_or_debug := $(2)
-
- include $(CLEAR_VARS)
- ifeq ($$(art_target_or_host),target)
- include external/stlport/libstlport.mk
- endif
- LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
- ifeq ($$(art_ndebug_or_debug),ndebug)
- LOCAL_MODULE := libart-compiler-greenland
- else # debug
- LOCAL_MODULE := libartd-compiler-greenland
- endif
-
- LOCAL_MODULE_TAGS := optional
- LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-
- LOCAL_SRC_FILES := $(LIBART_COMPILER_GREENLAND_SRC_FILES)
- LOCAL_CFLAGS := $(LIBART_COMPILER_GREENLAND_CFLAGS)
- ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
- else # host
- LOCAL_IS_HOST_MODULE := true
- LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
- endif
-
- LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
-
- ifeq ($$(art_target_or_host),target)
- ENUM_INCLUDE_LIR_TARGETS := arm
- LOCAL_SRC_FILES += \
- $(LIBART_COMPILER_GREENLAND_$(TARGET_ARCH)_SRC_FILES)
- else
- ENUM_INCLUDE_LIR_TARGETS := arm mips x86
- LOCAL_SRC_FILES += \
- $(LIBART_COMPILER_GREENLAND_arm_SRC_FILES) \
- $(LIBART_COMPILER_GREENLAND_mips_SRC_FILES) \
- $(LIBART_COMPILER_GREENLAND_x86_SRC_FILES)
- endif
-
- GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
- ENUM_TARGEET_LIR_BUILDER_INC_FILES := $$(foreach lir_target, $$(ENUM_INCLUDE_LIR_TARGETS), $$(lir_target)_lir_builder_base.inc)
- ENUM_TARGET_LIR_BUILDER_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/, $$(ENUM_TARGEET_LIR_BUILDER_INC_FILES))
-
-$$(ENUM_TARGET_LIR_BUILDER_OUT_GEN): PRIVATE_LIR_TARGET = $$(subst _lir_builder_base.inc,,$$(notdir $$@))
-$$(ENUM_TARGET_LIR_BUILDER_OUT_GEN): %.inc : $$(TARGET_LIR_BUILDER_GENERATOR)
- @echo "target Generated: $$@"
- $$(hide) $$(TARGET_LIR_BUILDER_GENERATOR) $$(PRIVATE_LIR_TARGET) > $$@
-
-LOCAL_GENERATED_SOURCES += $$(ENUM_TARGET_LIR_BUILDER_OUT_GEN)
-
- LOCAL_STATIC_LIBRARIES += \
- libLLVMBitWriter \
- libLLVMBitReader \
- libLLVMScalarOpts \
- libLLVMInstCombine \
- libLLVMTransformUtils \
- libLLVMAnalysis \
- libLLVMTarget \
- libLLVMCore \
- libLLVMSupport
- LOCAL_SHARED_LIBRARIES := liblog libnativehelper
- ifeq ($$(art_target_or_host),target)
- LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
- LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
- LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
- else # host
- LOCAL_STATIC_LIBRARIES += libcutils
- LOCAL_SHARED_LIBRARIES += libz-host
- LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
- LOCAL_LDLIBS := -ldl -lpthread
- ifeq ($(HOST_OS),linux)
- LOCAL_LDLIBS += -lrt
- endif
- endif
- ifeq ($$(art_ndebug_or_debug),debug)
- ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
- else # host
- LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
- endif
- LOCAL_SHARED_LIBRARIES += libartd
- else
- ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
- else # host
- LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
- endif
- LOCAL_SHARED_LIBRARIES += libart
- endif
- ifeq ($$(art_target_or_host),target)
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_DEVICE_BUILD_MK)
- include $(BUILD_SHARED_LIBRARY)
- else # host
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_HOST_BUILD_MK)
- include $(BUILD_HOST_SHARED_LIBRARY)
- endif
-
- ifeq ($$(art_target_or_host),target)
- ifeq ($$(art_ndebug_or_debug),debug)
- $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
- else
- $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
- endif
- else # host
- ifeq ($$(art_ndebug_or_debug),debug)
- $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
- else
- $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
- endif
- endif
-endef
-
-
-ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
- $(eval $(call build-libart-compiler-greenland,target,ndebug))
-endif
-ifeq ($(ART_BUILD_TARGET_DEBUG),true)
- $(eval $(call build-libart-compiler-greenland,target,debug))
-endif
-ifeq ($(ART_BUILD_HOST_NDEBUG),true)
- $(eval $(call build-libart-compiler-greenland,host,ndebug))
-endif
-ifeq ($(ART_BUILD_HOST_DEBUG),true)
- $(eval $(call build-libart-compiler-greenland,host,debug))
-endif
diff --git a/build/Android.libart-compiler-llvm.mk b/build/Android.libart-compiler-llvm.mk
index 332b809..48731f4 100644
--- a/build/Android.libart-compiler-llvm.mk
+++ b/build/Android.libart-compiler-llvm.mk
@@ -16,11 +16,8 @@
LIBART_COMPILER_LLVM_CFLAGS := -DART_USE_LLVM_COMPILER
-ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
- LIBART_COMPILER_LLVM_CFLAGS += -DART_USE_DEXLANG_FRONTEND
-endif
-ifeq ($(ART_USE_QUICK_COMPILER),true)
- LIBART_COMPILER_LLVM_CFLAGS += -DART_USE_QUICK_COMPILER
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
LIBART_COMPILER_LLVM_SRC_FILES += \
@@ -38,37 +35,28 @@
src/compiler_llvm/stub_compiler.cc \
src/greenland/inferred_reg_category_map.cc
-ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
LIBART_COMPILER_LLVM_SRC_FILES += \
+ src/compiler/Dataflow.cc \
+ src/compiler/Frontend.cc \
+ src/compiler/IntermediateRep.cc \
+ src/compiler/Ralloc.cc \
+ src/compiler/SSATransformation.cc \
+ src/compiler/Utility.cc \
+ src/compiler/codegen/RallocUtil.cc \
+ src/compiler/codegen/arm/ArchUtility.cc \
+ src/compiler/codegen/arm/ArmRallocUtil.cc \
+ src/compiler/codegen/arm/Assemble.cc \
+ src/compiler/codegen/arm/armv7-a/Codegen.cc \
+ src/compiler_llvm/dalvik_reg.cc \
src/compiler_llvm/gbc_expander.cc \
- src/greenland/dalvik_reg.cc \
- src/greenland/dex_lang.cc \
+ src/compiler_llvm/method_compiler.cc \
src/greenland/intrinsic_helper.cc \
src/greenland/ir_builder.cc
else
- ifeq ($(ART_USE_QUICK_COMPILER),true)
- LIBART_COMPILER_LLVM_SRC_FILES += \
- src/compiler/Dataflow.cc \
- src/compiler/Frontend.cc \
- src/compiler/IntermediateRep.cc \
- src/compiler/Ralloc.cc \
- src/compiler/SSATransformation.cc \
- src/compiler/Utility.cc \
- src/compiler/codegen/RallocUtil.cc \
- src/compiler/codegen/arm/ArchUtility.cc \
- src/compiler/codegen/arm/ArmRallocUtil.cc \
- src/compiler/codegen/arm/Assemble.cc \
- src/compiler/codegen/arm/armv7-a/Codegen.cc \
- src/compiler_llvm/dalvik_reg.cc \
- src/compiler_llvm/gbc_expander.cc \
- src/compiler_llvm/method_compiler.cc \
- src/greenland/intrinsic_helper.cc \
- src/greenland/ir_builder.cc
- else
- LIBART_COMPILER_LLVM_SRC_FILES += \
- src/compiler_llvm/dalvik_reg.cc \
- src/compiler_llvm/method_compiler.cc
- endif
+ LIBART_COMPILER_LLVM_SRC_FILES += \
+ src/compiler_llvm/dalvik_reg.cc \
+ src/compiler_llvm/method_compiler.cc
endif
# $(1): target or host
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk
index 994bcca..323017a 100644
--- a/build/Android.libart-compiler.mk
+++ b/build/Android.libart-compiler.mk
@@ -26,13 +26,9 @@
src/oat/jni/jni_compiler.cc \
src/oat/jni/arm/calling_convention_arm.cc \
src/oat/jni/mips/calling_convention_mips.cc \
- src/oat/jni/x86/calling_convention_x86.cc
-
-ifeq ($(ART_USE_QUICK_COMPILER), true)
-LIBART_COMPILER_COMMON_SRC_FILES += \
+ src/oat/jni/x86/calling_convention_x86.cc \
src/greenland/ir_builder.cc \
src/greenland/intrinsic_helper.cc
-endif
LIBART_COMPILER_arm_SRC_FILES += \
$(LIBART_COMPILER_COMMON_SRC_FILES) \
@@ -118,17 +114,15 @@
endif
LOCAL_SHARED_LIBRARIES += libart
endif
- ifeq ($(ART_USE_QUICK_COMPILER), true)
- LOCAL_SHARED_LIBRARIES += libbcc
- endif
+ LOCAL_SHARED_LIBRARIES += libbcc
# TODO: temporary hack for testing.
ifeq ($$(libart_compiler_arch),mips)
LOCAL_CFLAGS += -D__mips_hard_float
endif
- ifeq ($(ART_USE_QUICK_COMPILER), true)
- LOCAL_CFLAGS += -DART_USE_QUICK_COMPILER
+ ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
@@ -139,19 +133,15 @@
LOCAL_LDLIBS := -ldl -lpthread
endif
ifeq ($$(art_target_or_host),target)
- ifeq ($(ART_USE_QUICK_COMPILER), true)
- LOCAL_SHARED_LIBRARIES += libcutils
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_DEVICE_BUILD_MK)
- endif
+ LOCAL_SHARED_LIBRARIES += libcutils
+ include $(LLVM_GEN_INTRINSICS_MK)
+ include $(LLVM_DEVICE_BUILD_MK)
include $(BUILD_SHARED_LIBRARY)
else # host
LOCAL_IS_HOST_MODULE := true
- ifeq ($(ART_USE_QUICK_COMPILER), true)
- LOCAL_STATIC_LIBRARIES += libcutils
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_HOST_BUILD_MK)
- endif
+ LOCAL_STATIC_LIBRARIES += libcutils
+ include $(LLVM_GEN_INTRINSICS_MK)
+ include $(LLVM_HOST_BUILD_MK)
include $(BUILD_HOST_SHARED_LIBRARY)
endif
diff --git a/build/Android.libart.mk b/build/Android.libart.mk
index 43ce31a..435056a 100644
--- a/build/Android.libart.mk
+++ b/build/Android.libart.mk
@@ -17,17 +17,9 @@
LIBART_CFLAGS :=
ifeq ($(ART_USE_LLVM_COMPILER),true)
LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1
- ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
- LIBART_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1
- endif
endif
-
-ifeq ($(ART_USE_GREENLAND_COMPILER),true)
- LIBART_CFLAGS += -DART_USE_GREENLAND_COMPILER=1
-endif
-
-ifeq ($(ART_USE_QUICK_COMPILER),true)
- LIBART_CFLAGS += -DART_USE_QUICK_COMPILER=1
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
# $(1): target or host
@@ -115,17 +107,12 @@
LOCAL_LDLIBS += -lrt
endif
endif
+ include $(LLVM_GEN_INTRINSICS_MK)
ifeq ($$(art_target_or_host),target)
- ifeq ($(ART_REQUIRE_LLVM),true)
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_DEVICE_BUILD_MK)
- endif
+ include $(LLVM_DEVICE_BUILD_MK)
include $(BUILD_SHARED_LIBRARY)
else # host
- ifeq ($(ART_REQUIRE_LLVM),true)
- include $(LLVM_GEN_INTRINSICS_MK)
- include $(LLVM_HOST_BUILD_MK)
- endif
+ include $(LLVM_HOST_BUILD_MK)
include $(BUILD_HOST_SHARED_LIBRARY)
endif
endef
diff --git a/src/class_linker.cc b/src/class_linker.cc
index a76c9c8..d28d729 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1584,7 +1584,8 @@
klass->SetClass(GetClassRoot(kJavaLangClass));
uint32_t access_flags = dex_class_def.access_flags_;
// Make sure that none of our runtime-only flags are set.
- CHECK_EQ(access_flags & ~kAccJavaFlagsMask, 0U);
+ // TODO: JACK CLASS ACCESS (HACK TO BE REMOVED)
+ CHECK_EQ(access_flags & ~(kAccJavaFlagsMask | kAccClassJack), 0U);
klass->SetAccessFlags(access_flags);
klass->SetClassLoader(class_loader);
DCHECK_EQ(klass->GetPrimitiveType(), Primitive::kPrimNot);
diff --git a/src/common_test.h b/src/common_test.h
index 560edeb..964db64 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -353,6 +353,16 @@
#elif defined(__i386__)
instruction_set = kX86;
#endif
+
+ // TODO: make selectable
+#if defined(ART_USE_PORTABLE_COMPILER)
+ CompilerBackend compiler_backend = kPortable;
+#elif defined(ART_USE_LLVM_COMPILER)
+ CompilerBackend compiler_backend = kIceland; // TODO: remove
+#else
+ CompilerBackend compiler_backend = kQuick;
+#endif
+
runtime_->SetJniDlsymLookupStub(Compiler::CreateJniDlsymLookupStub(instruction_set));
runtime_->SetAbstractMethodErrorStubArray(Compiler::CreateAbstractMethodErrorStub(instruction_set));
for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) {
@@ -374,7 +384,7 @@
}
class_linker_->FixupDexCaches(runtime_->GetResolutionMethod());
image_classes_.reset(new std::set<std::string>);
- compiler_.reset(new Compiler(instruction_set, true, 2, false, image_classes_.get(),
+ compiler_.reset(new Compiler(compiler_backend, instruction_set, true, 2, false, image_classes_.get(),
true, true));
runtime_->GetHeap()->VerifyHeap(); // Check for heap corruption before the test
diff --git a/src/compiler.cc b/src/compiler.cc
index ddf9e87..4029a01 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -232,7 +232,7 @@
DISALLOW_COPY_AND_ASSIGN(AOTCompilationStats);
};
-static std::string MakeCompilerSoName(InstructionSet instruction_set) {
+static std::string MakeCompilerSoName(CompilerBackend compiler_backend, InstructionSet instruction_set) {
// TODO: is the ARM/Thumb2 instruction set distinction really buying us anything,
// or just causing hassle like this?
if (instruction_set == kThumb2) {
@@ -250,13 +250,12 @@
const char* suffix = (kIsDebugBuild ? "d" : "");
// Work out the filename for the compiler library.
-#if defined(ART_USE_LLVM_COMPILER)
- std::string library_name(StringPrintf("art%s-compiler-llvm", suffix));
-#elif defined(ART_USE_GREENLAND_COMPILER)
- std::string library_name(StringPrintf("art%s-compiler-greenland", suffix));
-#else
- std::string library_name(StringPrintf("art%s-compiler-%s", suffix, instruction_set_name.c_str()));
-#endif
+ std::string library_name;
+ if ((compiler_backend == kPortable) || (compiler_backend == kIceland)) {
+ library_name = StringPrintf("art%s-compiler-llvm", suffix);
+ } else {
+ library_name = StringPrintf("art%s-compiler-%s", suffix, instruction_set_name.c_str());
+ }
std::string filename(StringPrintf(OS_SHARED_LIB_FORMAT_STR, library_name.c_str()));
#if defined(__APPLE__)
@@ -292,16 +291,15 @@
return fn;
}
-Compiler::Compiler(InstructionSet instruction_set, bool image, size_t thread_count,
- bool support_debugging, const std::set<std::string>* image_classes,
+Compiler::Compiler(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image,
+ size_t thread_count, bool support_debugging, const std::set<std::string>* image_classes,
bool dump_stats, bool dump_timings)
- : instruction_set_(instruction_set),
+ : compiler_backend_(compiler_backend),
+ instruction_set_(instruction_set),
compiled_classes_lock_("compiled classes lock"),
compiled_methods_lock_("compiled method lock"),
compiled_invoke_stubs_lock_("compiled invoke stubs lock"),
-#if defined(ART_USE_LLVM_COMPILER)
compiled_proxy_stubs_lock_("compiled proxy stubs lock"),
-#endif
image_(image),
thread_count_(thread_count),
support_debugging_(support_debugging),
@@ -317,7 +315,7 @@
create_invoke_stub_(NULL),
thread_pool_(new ThreadPool(thread_count))
{
- std::string compiler_so_name(MakeCompilerSoName(instruction_set_));
+ std::string compiler_so_name(MakeCompilerSoName(compiler_backend_, instruction_set_));
compiler_library_ = dlopen(compiler_so_name.c_str(), RTLD_LAZY);
if (compiler_library_ == NULL) {
LOG(FATAL) << "Couldn't find compiler library " << compiler_so_name << ": " << dlerror();
@@ -326,36 +324,29 @@
CHECK_PTHREAD_CALL(pthread_key_create, (&tls_key_, NULL), "compiler tls key");
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
- // Initialize compiler_context_
+ // TODO: more work needed to combine initializations and allow per-method backend selection
typedef void (*InitCompilerContextFn)(Compiler&);
-
- InitCompilerContextFn init_compiler_context =
- FindFunction<void (*)(Compiler&)>(compiler_so_name,
- compiler_library_,
- "ArtInitCompilerContext");
+ InitCompilerContextFn init_compiler_context;
+ if ((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)){
+ // Initialize compiler_context_
+ init_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name,
+ compiler_library_, "ArtInitCompilerContext");
+ compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtCompileMethod");
+ } else {
+ init_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name,
+ compiler_library_, "ArtInitQuickCompilerContext");
+ compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtQuickCompileMethod");
+ }
init_compiler_context(*this);
-#elif defined(ART_USE_QUICK_COMPILER)
- // Initialize compiler_context_
- typedef void (*InitCompilerContextFn)(Compiler&);
- InitCompilerContextFn init_compiler_context =
- FindFunction<void (*)(Compiler&)>(compiler_so_name,
- compiler_library_,
- "ArtInitQuickCompilerContext");
-
- init_compiler_context(*this);
-#endif
-
- compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtCompileMethod");
jni_compiler_ = FindFunction<JniCompilerFn>(compiler_so_name, compiler_library_, "ArtJniCompileMethod");
create_invoke_stub_ = FindFunction<CreateInvokeStubFn>(compiler_so_name, compiler_library_, "ArtCreateInvokeStub");
-#if defined(ART_USE_LLVM_COMPILER)
- create_proxy_stub_ = FindFunction<CreateProxyStubFn>(
- compiler_so_name, compiler_library_, "ArtCreateProxyStub");
-#endif
+ if ((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)) {
+ create_proxy_stub_ = FindFunction<CreateProxyStubFn>(
+ compiler_so_name, compiler_library_, "ArtCreateProxyStub");
+ }
CHECK(!Runtime::Current()->IsStarted());
if (!image_) {
@@ -377,12 +368,10 @@
MutexLock mu(self, compiled_invoke_stubs_lock_);
STLDeleteValues(&compiled_invoke_stubs_);
}
-#if defined(ART_USE_LLVM_COMPILER)
{
MutexLock mu(self, compiled_proxy_stubs_lock_);
STLDeleteValues(&compiled_proxy_stubs_);
}
-#endif
{
MutexLock mu(self, compiled_methods_lock_);
STLDeleteElements(&code_to_patch_);
@@ -392,34 +381,21 @@
STLDeleteElements(&methods_to_patch_);
}
CHECK_PTHREAD_CALL(pthread_key_delete, (tls_key_), "delete tls key");
-#if defined(ART_USE_LLVM_COMPILER)
- // Uninitialize compiler_context_
typedef void (*UninitCompilerContextFn)(Compiler&);
-
- std::string compiler_so_name(MakeCompilerSoName(instruction_set_));
-
- UninitCompilerContextFn uninit_compiler_context =
- FindFunction<void (*)(Compiler&)>(compiler_so_name,
- compiler_library_,
- "ArtUnInitCompilerContext");
-
- uninit_compiler_context(*this);
-#elif defined(ART_USE_QUICK_COMPILER)
+ std::string compiler_so_name(MakeCompilerSoName(compiler_backend_, instruction_set_));
+ UninitCompilerContextFn uninit_compiler_context;
// Uninitialize compiler_context_
- typedef void (*UninitCompilerContextFn)(Compiler&);
-
- std::string compiler_so_name(MakeCompilerSoName(instruction_set_));
-
- UninitCompilerContextFn uninit_compiler_context =
- FindFunction<void (*)(Compiler&)>(compiler_so_name,
- compiler_library_,
- "ArtUnInitQuickCompilerContext");
-
+ // TODO: rework to combine initialization/uninitialization
+ if ((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)) {
+ uninit_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name,
+ compiler_library_, "ArtUnInitCompilerContext");
+ } else {
+ uninit_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name,
+ compiler_library_, "ArtUnInitQuickCompilerContext");
+ }
uninit_compiler_context(*this);
-#endif
if (compiler_library_ != NULL) {
VLOG(compiler) << "dlclose(" << compiler_library_ << ")";
-#if !defined(ART_USE_QUICK_COMPILER)
/*
* FIXME: Temporary workaround
* Apparently, llvm is adding dctors to atexit, but if we unload
@@ -432,7 +408,6 @@
* What's the right thing to do here?
*/
dlclose(compiler_library_);
-#endif
}
}
@@ -841,15 +816,15 @@
// invoked, so this can be passed to the out-of-line runtime support code.
direct_code = 0;
direct_method = 0;
-#if !defined(ART_USE_LLVM_COMPILER)
- if (sharp_type != kStatic && sharp_type != kDirect && sharp_type != kInterface) {
- return;
+ if ((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)) {
+ if (sharp_type != kStatic && sharp_type != kDirect) {
+ return;
+ }
+ } else {
+ if (sharp_type != kStatic && sharp_type != kDirect && sharp_type != kInterface) {
+ return;
+ }
}
-#else
- if (sharp_type != kStatic && sharp_type != kDirect) {
- return;
- }
-#endif
bool method_code_in_boot = method->GetDeclaringClass()->GetClassLoader() == NULL;
if (!method_code_in_boot) {
return;
@@ -1446,8 +1421,7 @@
InsertInvokeStub(key, compiled_invoke_stub);
}
-#if defined(ART_USE_LLVM_COMPILER)
- if (!is_static) {
+ if (((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)) && !is_static) {
const CompiledInvokeStub* compiled_proxy_stub = FindProxyStub(shorty);
if (compiled_proxy_stub == NULL) {
compiled_proxy_stub = (*create_proxy_stub_)(*this, shorty, shorty_len);
@@ -1455,7 +1429,6 @@
InsertProxyStub(shorty, compiled_proxy_stub);
}
}
-#endif
if (self->IsExceptionPending()) {
ScopedObjectAccess soa(self);
@@ -1492,7 +1465,6 @@
}
}
-#if defined(ART_USE_LLVM_COMPILER)
const CompiledInvokeStub* Compiler::FindProxyStub(const char* shorty) const {
MutexLock mu(Thread::Current(), compiled_proxy_stubs_lock_);
ProxyStubTable::const_iterator it = compiled_proxy_stubs_.find(shorty);
@@ -1515,7 +1487,6 @@
compiled_proxy_stubs_.Put(shorty, compiled_proxy_stub);
}
}
-#endif
CompiledClass* Compiler::GetCompiledClass(ClassReference ref) const {
MutexLock mu(Thread::Current(), compiled_classes_lock_);
@@ -1537,17 +1508,15 @@
return it->second;
}
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_QUICK_COMPILER)
void Compiler::SetBitcodeFileName(std::string const& filename) {
typedef void (*SetBitcodeFileNameFn)(Compiler&, std::string const&);
SetBitcodeFileNameFn set_bitcode_file_name =
- FindFunction<SetBitcodeFileNameFn>(MakeCompilerSoName(instruction_set_),
+ FindFunction<SetBitcodeFileNameFn>(MakeCompilerSoName(compiler_backend_, instruction_set_),
compiler_library_,
"compilerLLVMSetBitcodeFileName");
set_bitcode_file_name(*this, filename);
}
-#endif
} // namespace art
diff --git a/src/compiler.h b/src/compiler.h
index 20e608d..ba56513 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -41,9 +41,15 @@
class OatCompilationUnit;
class TimingLogger;
+enum CompilerBackend {
+ kQuick,
+ kQuickGBC,
+ kPortable,
+ kIceland // Temporary - remove soon
+};
+
// Thread-local storage compiler worker threads
class CompilerTls {
-#if defined(ART_USE_QUICK_COMPILER)
public:
CompilerTls() : llvm_info_(NULL) {}
~CompilerTls() {}
@@ -54,7 +60,6 @@
private:
void* llvm_info_;
-#endif
};
class Compiler {
@@ -64,9 +69,9 @@
// enabled. "image_classes" lets the compiler know what classes it
// can assume will be in the image, with NULL implying all available
// classes.
- explicit Compiler(InstructionSet instruction_set, bool image, size_t thread_count,
- bool support_debugging, const std::set<std::string>* image_classes,
- bool dump_stats, bool dump_timings);
+ explicit Compiler(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image,
+ size_t thread_count, bool support_debugging,
+ const std::set<std::string>* image_classes, bool dump_stats, bool dump_timings);
~Compiler();
@@ -85,6 +90,10 @@
return instruction_set_;
}
+ CompilerBackend GetCompilerBackend() const {
+ return compiler_backend_;
+ }
+
bool IsImage() const {
return image_;
}
@@ -120,9 +129,7 @@
const CompiledInvokeStub* FindInvokeStub(const std::string& key) const
LOCKS_EXCLUDED(compiled_invoke_stubs_lock_);
-#if defined(ART_USE_LLVM_COMPILER)
const CompiledInvokeStub* FindProxyStub(const char* shorty) const;
-#endif
// Callbacks from compiler to see what runtime checks must be generated.
@@ -176,9 +183,7 @@
size_t literal_offset)
LOCKS_EXCLUDED(compiled_methods_lock_);
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_QUICK_COMPILER)
void SetBitcodeFileName(std::string const& filename);
-#endif
void SetCompilerContext(void* compiler_context) {
compiler_context_ = compiler_context;
@@ -299,13 +304,13 @@
void InsertInvokeStub(const std::string& key, const CompiledInvokeStub* compiled_invoke_stub)
LOCKS_EXCLUDED(compiled_invoke_stubs_lock_);
-#if defined(ART_USE_LLVM_COMPILER)
void InsertProxyStub(const char* shorty, const CompiledInvokeStub* compiled_proxy_stub);
-#endif
std::vector<const PatchInformation*> code_to_patch_;
std::vector<const PatchInformation*> methods_to_patch_;
+ CompilerBackend compiler_backend_;
+
InstructionSet instruction_set_;
typedef SafeMap<const ClassReference, CompiledClass*> ClassTable;
@@ -323,12 +328,10 @@
mutable Mutex compiled_invoke_stubs_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
InvokeStubTable compiled_invoke_stubs_ GUARDED_BY(compiled_invoke_stubs_lock_);
-#if defined(ART_USE_LLVM_COMPILER)
typedef SafeMap<std::string, const CompiledInvokeStub*> ProxyStubTable;
// Proxy stubs created for proxy invocation delegation
mutable Mutex compiled_proxy_stubs_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
ProxyStubTable compiled_proxy_stubs_ GUARDED_BY(compiled_proxy_stubs_lock_);
-#endif
bool image_;
size_t thread_count_;
@@ -342,10 +345,8 @@
const std::set<std::string>* image_classes_;
-#if defined(ART_USE_LLVM_COMPILER)
typedef void (*CompilerCallbackFn)(Compiler& compiler);
typedef MutexLock* (*CompilerMutexLockFn)(Compiler& compiler);
-#endif
void* compiler_library_;
@@ -370,7 +371,6 @@
pthread_key_t tls_key_;
-#if defined(ART_USE_LLVM_COMPILER)
typedef CompiledInvokeStub* (*CreateProxyStubFn)
(Compiler& compiler, const char* shorty, uint32_t shorty_len);
CreateProxyStubFn create_proxy_stub_;
@@ -385,7 +385,6 @@
typedef const AbstractMethod::InvokeStub* (*CompilerGetMethodInvokeStubAddrFn)
(const Compiler& compiler, const CompiledInvokeStub* cm, const AbstractMethod* method);
CompilerGetMethodInvokeStubAddrFn compiler_get_method_invoke_stub_addr_;
-#endif
DISALLOW_COPY_AND_ASSIGN(Compiler);
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index 7eb32c2..11214cf 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -20,20 +20,16 @@
#include "dex_file.h"
#include "dex_instruction.h"
-#if defined(ART_USE_QUICK_COMPILER)
namespace llvm {
class Module;
class LLVMContext;
}
-#endif
namespace art {
-#if defined(ART_USE_QUICK_COMPILER)
namespace greenland {
class IntrinsicHelper;
class IRBuilder;
}
-#endif
#define COMPILER_TRACED(X)
#define COMPILER_TRACEE(X)
@@ -141,10 +137,8 @@
kDebugShowNops,
kDebugCountOpcodes,
kDebugDumpCheckStats,
-#if defined(ART_USE_QUICK_COMPILER)
kDebugDumpBitcodeFile,
kDebugVerifyBitcode,
-#endif
};
enum OatMethodAttributes {
@@ -177,7 +171,6 @@
kReversePostOrderTraversal, // Depth-First-Search / reverse Post-Order
};
-#if defined(ART_USE_QUICK_COMPILER)
class LLVMInfo {
public:
LLVMInfo();
@@ -205,7 +198,6 @@
UniquePtr<art::greenland::IntrinsicHelper> intrinsic_helper_;
UniquePtr<art::greenland::IRBuilder> ir_builder_;
};
-#endif
struct CompilationUnit;
struct BasicBlock;
diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h
index 5a10831..d08af07 100644
--- a/src/compiler/CompilerIR.h
+++ b/src/compiler/CompilerIR.h
@@ -23,10 +23,8 @@
#include "CompilerUtility.h"
#include "oat_compilation_unit.h"
#include "safe_map.h"
-#if defined(ART_USE_QUICK_COMPILER)
#include "greenland/ir_builder.h"
#include "llvm/Module.h"
-#endif
namespace art {
@@ -262,9 +260,7 @@
bool catchEntry;
bool explicitThrow;
bool conditionalBranch;
-#if defined(ART_USE_QUICK_COMPILER)
bool hasReturn;
-#endif
uint16_t startOffset;
uint16_t nestingDepth;
BBType blockType;
@@ -384,7 +380,6 @@
numArenaBlocks(0),
mstats(NULL),
checkstats(NULL),
-#if defined(ART_USE_QUICK_COMPILER)
genBitcode(false),
context(NULL),
module(NULL),
@@ -397,7 +392,6 @@
tempName(0),
numShadowFrameEntries(0),
shadowMap(NULL),
-#endif
#ifndef NDEBUG
liveSReg(0),
#endif
@@ -547,7 +541,6 @@
int numArenaBlocks;
Memstats* mstats;
Checkstats* checkstats;
-#if defined(ART_USE_QUICK_COMPILER)
bool genBitcode;
LLVMInfo* llvm_info;
llvm::LLVMContext* context;
@@ -567,7 +560,6 @@
int numShadowFrameEntries;
int* shadowMap;
std::set<llvm::BasicBlock*> llvmBlocks;
-#endif
#ifndef NDEBUG
/*
* Sanity checking for the register temp tracking. The same ssa
diff --git a/src/compiler/Dataflow.cc b/src/compiler/Dataflow.cc
index 0058575..c59b637 100644
--- a/src/compiler/Dataflow.cc
+++ b/src/compiler/Dataflow.cc
@@ -1854,12 +1854,10 @@
case Instruction::CMPG_FLOAT:
case Instruction::CMPG_DOUBLE:
case Instruction::CMP_LONG:
-#if defined(ART_USE_QUICK_COMPILER)
if (cUnit->genBitcode) {
// Bitcode doesn't allow this optimization.
break;
}
-#endif
if (mir->next != NULL) {
MIR* mirNext = mir->next;
Instruction::Code brOpcode = mirNext->dalvikInsn.opcode;
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index c19751d..c5d5c21 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -21,7 +21,6 @@
#include "object.h"
#include "runtime.h"
-#if defined(ART_USE_QUICK_COMPILER)
#include <llvm/Support/Threading.h>
namespace {
@@ -32,11 +31,9 @@
llvm::llvm_start_multithreaded();
}
}
-#endif
namespace art {
-#if defined(ART_USE_QUICK_COMPILER)
LLVMInfo::LLVMInfo() {
#if !defined(ART_USE_LLVM_COMPILER)
pthread_once(&llvm_multi_init, InitializeLLVMForQuick);
@@ -62,7 +59,6 @@
delete reinterpret_cast<LLVMInfo*>(compiler.GetCompilerContext());
compiler.SetCompilerContext(NULL);
}
-#endif
/* Default optimizer/debug setting for the compiler. */
static uint32_t kCompilerOptimizerDisableFlags = 0 | // Disable specific optimizations
@@ -94,10 +90,8 @@
//(1 << kDebugShowNops) |
//(1 << kDebugCountOpcodes) |
//(1 << kDebugDumpCheckStats) |
-#if defined(ART_USE_QUICK_COMPILER)
//(1 << kDebugDumpBitcodeFile) |
//(1 << kDebugVerifyBitcode) |
-#endif
0;
inline bool contentIsInsn(const u2* codePtr) {
@@ -788,14 +782,12 @@
}
CompiledMethod* compileMethod(Compiler& compiler,
+ const CompilerBackend compilerBackend,
const DexFile::CodeItem* code_item,
uint32_t access_flags, InvokeType invoke_type,
uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file
-#if defined(ART_USE_QUICK_COMPILER)
- , LLVMInfo* llvm_info,
- bool gbcOnly
-#endif
+ const DexFile& dex_file,
+ LLVMInfo* llvm_info
)
{
VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "...";
@@ -824,16 +816,18 @@
cUnit->numIns = code_item->ins_size_;
cUnit->numRegs = code_item->registers_size_ - cUnit->numIns;
cUnit->numOuts = code_item->outs_size_;
-#if defined(ART_USE_QUICK_COMPILER)
DCHECK((cUnit->instructionSet == kThumb2) ||
(cUnit->instructionSet == kX86) ||
(cUnit->instructionSet == kMips));
- cUnit->llvm_info = llvm_info;
- if (cUnit->instructionSet == kThumb2) {
- // TODO: remove this once x86 is tested
+ if ((compilerBackend == kQuickGBC) || (compilerBackend == kPortable)) {
cUnit->genBitcode = true;
}
-#endif
+ DCHECK_NE(compilerBackend, kIceland); // TODO: remove when Portable/Iceland merge complete
+ // TODO: remove this once x86 is tested
+ if (cUnit->genBitcode && (cUnit->instructionSet != kThumb2)) {
+ UNIMPLEMENTED(WARNING) << "GBC generation untested for non-Thumb targets";
+ }
+ cUnit->llvm_info = llvm_info;
/* Adjust this value accordingly once inlining is performed */
cUnit->numDalvikRegisters = code_item->registers_size_;
// TODO: set this from command line
@@ -848,13 +842,9 @@
cUnit->printMe = VLOG_IS_ON(compiler) ||
(cUnit->enableDebug & (1 << kDebugVerbose));
}
-#if defined(ART_USE_QUICK_COMPILER)
- if (cUnit->genBitcode) {
#ifndef NDEBUG
+ if (cUnit->genBitcode) {
cUnit->enableDebug |= (1 << kDebugVerifyBitcode);
-#endif
- //cUnit->printMe = true;
- //cUnit->enableDebug |= (1 << kDebugDumpBitcodeFile);
}
#endif
@@ -1098,21 +1088,14 @@
}
if (cUnit->qdMode) {
-#if !defined(ART_USE_QUICK_COMPILER)
// Bitcode generation requires full dataflow analysis
- cUnit->disableDataflow = true;
-#endif
+ cUnit->disableDataflow = !cUnit->genBitcode;
// Disable optimization which require dataflow/ssa
- cUnit->disableOpt |=
-#if !defined(ART_USE_QUICK_COMPILER)
- (1 << kNullCheckElimination) |
-#endif
- (1 << kBBOpt) |
- (1 << kPromoteRegs);
+ cUnit->disableOpt |= (1 << kBBOpt) | (1 << kPromoteRegs) | (1 << kNullCheckElimination);
if (cUnit->printMe) {
LOG(INFO) << "QD mode enabled: "
<< PrettyMethod(method_idx, dex_file)
- << " too big: " << cUnit->numBlocks;
+ << " num blocks: " << cUnit->numBlocks;
}
}
@@ -1168,12 +1151,11 @@
/* Allocate Registers using simple local allocation scheme */
oatSimpleRegAlloc(cUnit.get());
-#if defined(ART_USE_QUICK_COMPILER)
/* Go the LLVM path? */
if (cUnit->genBitcode) {
// MIR->Bitcode
oatMethodMIR2Bitcode(cUnit.get());
- if (gbcOnly) {
+ if (compilerBackend == kPortable) {
// all done
oatArenaReset(cUnit.get());
return NULL;
@@ -1181,7 +1163,6 @@
// Bitcode->LIR
oatMethodBitcode2LIR(cUnit.get());
} else {
-#endif
if (specialCase != kNoHandler) {
/*
* Custom codegen for special cases. If for any reason the
@@ -1195,9 +1176,7 @@
if (cUnit->firstLIRInsn == NULL) {
oatMethodMIR2LIR(cUnit.get());
}
-#if defined(ART_USE_QUICK_COMPILER)
}
-#endif
// Debugging only
if (cUnit->enableDebug & (1 << kDebugDumpCFG)) {
@@ -1268,55 +1247,30 @@
return result;
}
-#if defined(ART_USE_QUICK_COMPILER)
CompiledMethod* oatCompileMethod(Compiler& compiler,
+ const CompilerBackend backend,
const DexFile::CodeItem* code_item,
uint32_t access_flags, InvokeType invoke_type,
uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file)
+ const DexFile& dex_file,
+ LLVMInfo* llvmInfo)
{
- return compileMethod(compiler, code_item, access_flags, invoke_type, method_idx, class_loader,
- dex_file, NULL, false);
+ return compileMethod(compiler, backend, code_item, access_flags, invoke_type, method_idx, class_loader,
+ dex_file, llvmInfo);
}
-/*
- * Given existing llvm module, context, intrinsic_helper and IRBuilder,
- * add the bitcode for the method described by code_item to the module.
- */
-void oatCompileMethodToGBC(Compiler& compiler,
- const DexFile::CodeItem* code_item,
- uint32_t access_flags, InvokeType invoke_type,
- uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file,
- LLVMInfo* llvm_info)
-{
- compileMethod(compiler, code_item, access_flags, invoke_type, method_idx, class_loader,
- dex_file, llvm_info, true);
-}
-#else
-CompiledMethod* oatCompileMethod(Compiler& compiler,
- const DexFile::CodeItem* code_item,
- uint32_t access_flags, InvokeType invoke_type,
- uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file)
-{
- return compileMethod(compiler, code_item, access_flags, invoke_type, method_idx, class_loader,
- dex_file);
-}
-#endif
-
} // namespace art
-#if !defined(ART_USE_LLVM_COMPILER)
extern "C" art::CompiledMethod*
- ArtCompileMethod(art::Compiler& compiler,
- const art::DexFile::CodeItem* code_item,
- uint32_t access_flags, art::InvokeType invoke_type,
- uint32_t method_idx, jobject class_loader,
- const art::DexFile& dex_file)
+ ArtQuickCompileMethod(art::Compiler& compiler,
+ const art::DexFile::CodeItem* code_item,
+ uint32_t access_flags, art::InvokeType invoke_type,
+ uint32_t method_idx, jobject class_loader,
+ const art::DexFile& dex_file)
{
CHECK_EQ(compiler.GetInstructionSet(), art::oatInstructionSet());
- return art::oatCompileMethod(compiler, code_item, access_flags, invoke_type,
- method_idx, class_loader, dex_file);
+ // TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default
+ art::CompilerBackend backend = compiler.GetCompilerBackend();
+ return art::oatCompileMethod(compiler, backend, code_item, access_flags, invoke_type,
+ method_idx, class_loader, dex_file, NULL /* use thread llvmInfo */);
}
-#endif
diff --git a/src/compiler/Ralloc.cc b/src/compiler/Ralloc.cc
index bf69ce4..ca25b38 100644
--- a/src/compiler/Ralloc.cc
+++ b/src/compiler/Ralloc.cc
@@ -485,19 +485,12 @@
}
}
-#if defined(ART_USE_QUICK_COMPILER)
if (!cUnit->genBitcode) {
/* Remap names */
oatDataFlowAnalysisDispatcher(cUnit, remapNames,
kPreOrderDFSTraversal,
false /* isIterative */);
}
-#else
- /* Remap names */
- oatDataFlowAnalysisDispatcher(cUnit, remapNames,
- kPreOrderDFSTraversal,
- false /* isIterative */);
-#endif
/* Do type & size inference pass */
oatDataFlowAnalysisDispatcher(cUnit, inferTypeAndSize,
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc
index cf07ea4..7920883 100644
--- a/src/compiler/codegen/MethodBitcode.cc
+++ b/src/compiler/codegen/MethodBitcode.cc
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#if defined(ART_USE_QUICK_COMPILER)
#include "object_utils.h"
#include <llvm/Support/ToolOutputFile.h>
@@ -3537,5 +3536,3 @@
} // namespace art
-
-#endif // ART_USE_QUICK_COMPILER
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index ba71aee..a27ea6e 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -154,7 +154,7 @@
llvm::FunctionPass*
CreateGBCExpanderPass(const greenland::IntrinsicHelper& intrinsic_helper,
IRBuilder& irb);
-#elif defined(ART_USE_QUICK_COMPILER)
+#elif defined(ART_USE_PORTABLE_COMPILER)
llvm::FunctionPass*
CreateGBCExpanderPass(const greenland::IntrinsicHelper& intrinsic_helper, IRBuilder& irb,
Compiler* compiler, OatCompilationUnit* oat_compilation_unit);
@@ -166,7 +166,7 @@
CompilationUnit::CompilationUnit(const CompilerLLVM* compiler_llvm,
size_t cunit_idx)
: compiler_llvm_(compiler_llvm), cunit_idx_(cunit_idx) {
-#if !defined(ART_USE_QUICK_COMPILER)
+#if !defined(ART_USE_PORTABLE_COMPILER)
context_.reset(new llvm::LLVMContext());
module_ = new llvm::Module("art", *context_);
#else
@@ -210,7 +210,7 @@
CompilationUnit::~CompilationUnit() {
#if defined(ART_USE_DEXLANG_FRONTEND)
delete dex_lang_ctx_;
-#elif defined(ART_USE_QUICK_COMPILER)
+#elif defined(ART_USE_PORTABLE_COMPILER)
llvm::LLVMContext* llvm_context = context_.release(); // Managed by llvm_info_
CHECK(llvm_context != NULL);
#endif
@@ -330,7 +330,7 @@
// regular FunctionPass.
#if defined(ART_USE_DEXLANG_FRONTEND)
fpm.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get()));
-#elif defined(ART_USE_QUICK_COMPILER)
+#elif defined(ART_USE_PORTABLE_COMPILER)
fpm.add(CreateGBCExpanderPass(*llvm_info_->GetIntrinsicHelper(), *irb_.get(),
compiler_, oat_compilation_unit_));
#endif
@@ -340,7 +340,7 @@
llvm::FunctionPassManager fpm2(module_);
#if defined(ART_USE_DEXLANG_FRONTEND)
fpm2.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get()));
-#elif defined(ART_USE_QUICK_COMPILER)
+#elif defined(ART_USE_PORTABLE_COMPILER)
fpm2.add(CreateGBCExpanderPass(*llvm_info_->GetIntrinsicHelper(), *irb_.get(),
compiler_, oat_compilation_unit_));
#endif
diff --git a/src/compiler_llvm/compilation_unit.h b/src/compiler_llvm/compilation_unit.h
index 6ad7ee1..0b40388 100644
--- a/src/compiler_llvm/compilation_unit.h
+++ b/src/compiler_llvm/compilation_unit.h
@@ -28,7 +28,7 @@
#include "runtime_support_func.h"
#include "safe_map.h"
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
# include "compiler/Dalvik.h"
# include "compiler.h"
# include "oat_compilation_unit.h"
@@ -90,7 +90,7 @@
bitcode_filename_ = bitcode_filename;
}
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
LLVMInfo* GetQuickContext() const {
return llvm_info_.get();
}
@@ -124,7 +124,7 @@
#if defined(ART_USE_DEXLANG_FRONTEND)
greenland::DexLang::Context* dex_lang_ctx_;
#endif
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
UniquePtr<LLVMInfo> llvm_info_;
Compiler* compiler_;
OatCompilationUnit* oat_compilation_unit_;
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index a964b40..aa5ec82 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -38,14 +38,15 @@
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/Threading.h>
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
namespace art {
-void oatCompileMethodToGBC(Compiler& compiler,
- const DexFile::CodeItem* code_item,
- uint32_t access_flags, InvokeType invoke_type,
- uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file,
- LLVMInfo* llvm_info);
+void oatCompileMethod(Compiler& compiler,
+ const CompilerBackend compilerBackend,
+ const DexFile::CodeItem* code_item,
+ uint32_t access_flags, InvokeType invoke_type,
+ uint32_t method_idx, jobject class_loader,
+ const DexFile& dex_file,
+ LLVMInfo* llvm_info);
}
#endif
@@ -152,7 +153,7 @@
return new CompiledMethod(cunit->GetInstructionSet(),
cunit->GetCompiledCode());
-#elif defined(ART_USE_QUICK_COMPILER)
+#elif defined(ART_USE_PORTABLE_COMPILER)
std::string methodName(PrettyMethod(oat_compilation_unit->GetDexMethodIndex(),
*oat_compilation_unit->GetDexFile()));
if (insn_set_ == kX86) {
@@ -162,16 +163,17 @@
return method_compiler->Compile();
} else {
- // Use quick
- oatCompileMethodToGBC(*compiler_,
- oat_compilation_unit->GetCodeItem(),
- oat_compilation_unit->access_flags_,
- invoke_type,
- oat_compilation_unit->GetDexMethodIndex(),
- oat_compilation_unit->GetClassLoader(),
- *oat_compilation_unit->GetDexFile(),
- cunit->GetQuickContext()
- );
+ // TODO: consolidate ArtCompileMethods
+ oatCompileMethod(*compiler_,
+ kPortable,
+ oat_compilation_unit->GetCodeItem(),
+ oat_compilation_unit->access_flags_,
+ invoke_type,
+ oat_compilation_unit->GetDexMethodIndex(),
+ oat_compilation_unit->GetClassLoader(),
+ *oat_compilation_unit->GetDexFile(),
+ cunit->GetQuickContext()
+ );
cunit->SetCompiler(compiler_);
cunit->SetOatCompilationUnit(oat_compilation_unit);
diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h
index 39223ef..0867e56 100644
--- a/src/compiler_llvm/compiler_llvm.h
+++ b/src/compiler_llvm/compiler_llvm.h
@@ -77,7 +77,7 @@
CompiledMethod* CompileDexMethod(OatCompilationUnit* oat_compilation_unit,
InvokeType invoke_type);
-#if defined(ART_USE_LLVM_COMPILER) && defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
CompiledMethod* CompileGBCMethod(OatCompilationUnit* oat_compilation_unit, std::string* func);
#endif
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index 484dd77..18cef41 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -370,7 +370,7 @@
func_ = &func;
changed_ = false; // Assume unchanged
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
basic_blocks_.resize(code_item_->insns_size_in_code_units_);
basic_block_landing_pads_.resize(code_item_->tries_size_, NULL);
basic_block_unwind_ = NULL;
@@ -1032,7 +1032,7 @@
bool is_div, JType op_jty) {
llvm::Value* dividend = call_inst.getArgOperand(0);
llvm::Value* divisor = call_inst.getArgOperand(1);
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
uint32_t dex_pc = LV2UInt(call_inst.getMetadata("DexOff")->getOperand(0));
EmitGuard_DivZeroException(dex_pc, divisor, op_jty);
#endif
@@ -1145,7 +1145,7 @@
};
llvm::Value* entry_addr = irb_.CreateGEP(shadow_frame_, gep_index);
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
if (obj->getType() != irb_.getJObjectTy()) {
obj = irb_.getJNull();
}
@@ -1155,7 +1155,7 @@
}
void GBCExpanderPass::Expand_PopShadowFrame() {
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
if (old_shadow_frame_ == NULL) {
return;
}
@@ -1191,7 +1191,7 @@
// alloca instructions)
EmitStackOverflowCheck(&*first_non_alloca);
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
irb_.Runtime().EmitTestSuspend();
#endif
@@ -2385,7 +2385,7 @@
}
void GBCExpanderPass::EmitUpdateDexPC(uint32_t dex_pc) {
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
if (shadow_frame_ == NULL) {
return;
}
@@ -2477,7 +2477,7 @@
// Get return type
char ret_shorty = shorty[0];
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
ret_shorty = art::remapShorty(ret_shorty);
#endif
llvm::Type* ret_type = irb_.getJType(ret_shorty, kAccurate);
@@ -2492,7 +2492,7 @@
}
for (uint32_t i = 1; i < shorty_size; ++i) {
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
char shorty_type = art::remapShorty(shorty[i]);
args_type.push_back(irb_.getJType(shorty_type, kAccurate));
#else
@@ -2627,7 +2627,7 @@
// Emit the code to return default value (zero) for the given return type.
char ret_shorty = oat_compilation_unit_->GetShorty()[0];
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
ret_shorty = art::remapShorty(ret_shorty);
#endif
if (ret_shorty == 'V') {
diff --git a/src/compiler_llvm/stub_compiler.cc b/src/compiler_llvm/stub_compiler.cc
index 3ac5f2a..4854c9f 100644
--- a/src/compiler_llvm/stub_compiler.cc
+++ b/src/compiler_llvm/stub_compiler.cc
@@ -151,7 +151,7 @@
llvm::Value* code_addr = irb_.CreateLoad(code_field_addr, kTBAAJRuntime);
llvm::CallInst* retval = irb_.CreateCall(code_addr, args);
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
for (size_t i = 1; i < shorty_size; ++i) {
switch(shorty[i]) {
case 'Z':
@@ -216,7 +216,7 @@
llvm::Function* func =
llvm::Function::Create(accurate_func_type, llvm::Function::ExternalLinkage,
func_name, module_);
-#if defined(ART_USE_QUICK_COMPILER)
+#if defined(ART_USE_PORTABLE_COMPILER)
switch(shorty[0]) {
case 'Z':
case 'C':
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 20872e1..a8f42af 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -83,11 +83,9 @@
UsageError(" to the file descriptor specified by --oat-fd.");
UsageError(" Example: --oat-location=/data/art-cache/system@app@Calculator.apk.oat");
UsageError("");
-#if defined(ART_USE_LLVM_COMPILER)
UsageError(" --bitcode=<file.bc>: specifies the optional bitcode filename.");
UsageError(" Example: --bitcode=/system/framework/boot.bc");
UsageError("");
-#endif
UsageError(" --image=<file.art>: specifies the output image filename.");
UsageError(" Example: --image=/system/framework/boot.art");
UsageError("");
@@ -111,6 +109,10 @@
UsageError(" Example: --instruction-set=x86");
UsageError(" Default: arm");
UsageError("");
+ UsageError(" --compiler-backend=(Quick|QuickGBC|Portable): select compiler backend");
+ UsageError(" set.");
+ UsageError(" Example: --instruction-set=Portable");
+ UsageError(" Default: Quick");
UsageError(" --runtime-arg <argument>: used to specify various arguments for the runtime,");
UsageError(" such as initial heap size, maximum heap size, and verbose output.");
UsageError(" Use a separate --runtime-arg switch for each argument.");
@@ -122,14 +124,15 @@
class Dex2Oat {
public:
- static bool Create(Dex2Oat** p_dex2oat, Runtime::Options& options, InstructionSet instruction_set,
- size_t thread_count, bool support_debugging)
+ static bool Create(Dex2Oat** p_dex2oat, Runtime::Options& options, CompilerBackend compiler_backend,
+ InstructionSet instruction_set, size_t thread_count, bool support_debugging)
SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_) {
if (!CreateRuntime(options, instruction_set)) {
*p_dex2oat = NULL;
return false;
}
- *p_dex2oat = new Dex2Oat(Runtime::Current(), instruction_set, thread_count, support_debugging);
+ *p_dex2oat = new Dex2Oat(Runtime::Current(), compiler_backend, instruction_set, thread_count,
+ support_debugging);
return true;
}
@@ -209,9 +212,7 @@
const std::string* host_prefix,
const std::vector<const DexFile*>& dex_files,
File* oat_file,
-#if defined(ART_USE_LLVM_COMPILER)
const std::string& bitcode_filename,
-#endif
bool image,
const std::set<std::string>* image_classes,
bool dump_stats,
@@ -234,7 +235,8 @@
Runtime::Current()->SetCompileTimeClassPath(class_loader, class_path_files);
}
- UniquePtr<Compiler> compiler(new Compiler(instruction_set_,
+ UniquePtr<Compiler> compiler(new Compiler(compiler_backend_,
+ instruction_set_,
image,
thread_count_,
support_debugging_,
@@ -242,9 +244,9 @@
dump_stats,
dump_timings));
-#if defined(ART_USE_LLVM_COMPILER)
- compiler->SetBitcodeFileName(bitcode_filename);
-#endif
+ if ((compiler_backend_ == kPortable) || (compiler_backend_ == kIceland)) {
+ compiler->SetBitcodeFileName(bitcode_filename);
+ }
Thread::Current()->TransitionFromRunnableToSuspended(kNative);
@@ -295,9 +297,10 @@
}
private:
- explicit Dex2Oat(Runtime* runtime, InstructionSet instruction_set, size_t thread_count,
- bool support_debugging)
- : instruction_set_(instruction_set),
+ explicit Dex2Oat(Runtime* runtime, CompilerBackend compiler_backend, InstructionSet instruction_set,
+ size_t thread_count, bool support_debugging)
+ : compiler_backend_(compiler_backend),
+ instruction_set_(instruction_set),
runtime_(runtime),
thread_count_(thread_count),
support_debugging_(support_debugging),
@@ -431,6 +434,8 @@
return false;
}
+ const CompilerBackend compiler_backend_;
+
const InstructionSet instruction_set_;
Runtime* runtime_;
@@ -487,9 +492,7 @@
std::string oat_filename;
std::string oat_location;
int oat_fd = -1;
-#if defined(ART_USE_LLVM_COMPILER)
std::string bitcode_filename;
-#endif
const char* image_classes_filename = NULL;
std::string image_filename;
std::string boot_image_filename;
@@ -498,6 +501,13 @@
std::vector<const char*> runtime_args;
int thread_count = sysconf(_SC_NPROCESSORS_CONF);
bool support_debugging = false;
+#if defined(ART_USE_PORTABLE_COMPILER)
+ CompilerBackend compiler_backend = kPortable;
+#elif defined(ART_USE_LLVM_COMPILER)
+ CompilerBackend compiler_backend = kIceland;
+#else
+ CompilerBackend compiler_backend = kQuick;
+#endif
#if defined(__arm__)
InstructionSet instruction_set = kThumb2;
#elif defined(__i386__)
@@ -543,10 +553,8 @@
}
} else if (option.starts_with("--oat-location=")) {
oat_location = option.substr(strlen("--oat-location=")).data();
-#if defined(ART_USE_LLVM_COMPILER)
} else if (option.starts_with("--bitcode=")) {
bitcode_filename = option.substr(strlen("--bitcode=")).data();
-#endif
} else if (option.starts_with("--image=")) {
image_filename = option.substr(strlen("--image=")).data();
} else if (option.starts_with("--image-classes=")) {
@@ -571,6 +579,18 @@
} else if (instruction_set_str == "x86") {
instruction_set = kX86;
}
+ } else if (option.starts_with("--compiler-backend=")) {
+ StringPiece backend_str = option.substr(strlen("--compiler-backend=")).data();
+ if (backend_str == "Quick") {
+ compiler_backend = kQuick;
+ } else if (backend_str == "QuickGBC") {
+ compiler_backend = kQuickGBC;
+ } else if (backend_str == "Iceland") {
+ // TODO: remove this when Portable/Iceland merge complete
+ compiler_backend = kIceland;
+ } else if (backend_str == "Portable") {
+ compiler_backend = kPortable;
+ }
} else if (option == "--runtime-arg") {
if (++i >= argc) {
Usage("Missing required argument for --runtime-arg");
@@ -704,7 +724,7 @@
}
Dex2Oat* p_dex2oat;
- if (!Dex2Oat::Create(&p_dex2oat, options, instruction_set, thread_count, support_debugging)) {
+ if (!Dex2Oat::Create(&p_dex2oat, options, compiler_backend, instruction_set, thread_count, support_debugging)) {
LOG(ERROR) << "Failed to create dex2oat";
return EXIT_FAILURE;
}
@@ -755,9 +775,7 @@
host_prefix.get(),
dex_files,
oat_file.get(),
-#if defined(ART_USE_LLVM_COMPILER)
bitcode_filename,
-#endif
image,
image_classes.get(),
dump_stats,
diff --git a/src/greenland/ir_builder.h b/src/greenland/ir_builder.h
index baa0ae7..ba8e5e1 100644
--- a/src/greenland/ir_builder.h
+++ b/src/greenland/ir_builder.h
@@ -33,7 +33,6 @@
namespace art {
namespace greenland {
-#if defined(ART_USE_QUICK_COMPILER)
class InserterWithDexOffset
: public llvm::IRBuilderDefaultInserter<true> {
public:
@@ -54,9 +53,6 @@
};
typedef llvm::IRBuilder<true, llvm::NoFolder, InserterWithDexOffset> LLVMIRBuilder;
-#else
-typedef llvm::IRBuilder<true> LLVMIRBuilder;
-#endif
class IRBuilder : public LLVMIRBuilder {
public:
diff --git a/src/modifiers.h b/src/modifiers.h
index 070130f..ee2d4ff 100644
--- a/src/modifiers.h
+++ b/src/modifiers.h
@@ -43,6 +43,8 @@
static const uint32_t kAccConstructor = 0x00010000; // method (dex only)
static const uint32_t kAccDeclaredSynchronized = 0x00020000; // method (dex only)
static const uint32_t kAccClassIsProxy = 0x00040000; // class (dex only)
+// TODO: JACK CLASS ACCESS (HACK TO BE REMOVED)
+static const uint32_t kAccClassJack = 0x000080000; // class (dex only)
// Special runtime-only flags.
// Note: if only kAccClassIsReference is set, we have a soft reference.
diff --git a/src/oat_file.cc b/src/oat_file.cc
index 4e05325..145d2e2 100644
--- a/src/oat_file.cc
+++ b/src/oat_file.cc
@@ -70,11 +70,7 @@
bool OatFile::Map(File& file,
byte* requested_base,
-#if defined(ART_USE_LLVM_COMPILER)
- RelocationBehavior reloc,
-#else
RelocationBehavior /*UNUSED*/,
-#endif
bool writable) {
OatHeader oat_header;
bool success = file.ReadFully(&oat_header, sizeof(oat_header));
diff --git a/src/oat_test.cc b/src/oat_test.cc
index 64c502d..bb6305a 100644
--- a/src/oat_test.cc
+++ b/src/oat_test.cc
@@ -65,7 +65,15 @@
jobject class_loader = NULL;
if (compile) {
- compiler_.reset(new Compiler(kThumb2, false, 2, false, NULL, true, true));
+ // TODO: make selectable
+#if defined(ART_USE_PORTABLE_COMPILER)
+ CompilerBackend compiler_backend = kPortable;
+#elif defined(ART_USE_LLVM_COMPILER)
+ CompilerBackend compiler_backend = kIceland; // TODO: remove
+#else
+ CompilerBackend compiler_backend = kQuick;
+#endif
+ compiler_.reset(new Compiler(compiler_backend, kThumb2, false, 2, false, NULL, true, true));
compiler_->CompileAll(class_loader, class_linker->GetBootClassPath());
}
diff --git a/src/oatdump.cc b/src/oatdump.cc
index 4231ecf..0db71c9 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -247,7 +247,10 @@
UniquePtr<const OatFile::OatClass> oat_class(oat_dex_file.GetOatClass(class_def_index));
CHECK(oat_class.get() != NULL);
os << StringPrintf("%zd: %s (type_idx=%d) (", class_def_index, descriptor, class_def.class_idx_)
- << oat_class->GetStatus() << ")\n";
+ << oat_class->GetStatus() << ")"
+ // TODO: JACK CLASS ACCESS (HACK TO BE REMOVED)
+ << ( (class_def.access_flags_ & kAccClassJack) == kAccClassJack ? " (Jack)" : "" )
+ << "\n";
DumpOatClass(os, *oat_class.get(), *(dex_file.get()), class_def);
}
diff --git a/src/thread.cc b/src/thread.cc
index 0551844..2f8a9a7 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -292,9 +292,6 @@
SetUpAlternateSignalStack();
InitCpu();
InitFunctionPointers();
-#ifdef ART_USE_GREENLAND_COMPILER
- InitRuntimeEntryPoints(&runtime_entry_points_);
-#endif
InitCardTable();
InitTid();
diff --git a/src/thread.h b/src/thread.h
index 8dbfb55..798e96a 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -36,9 +36,6 @@
#include "stack_indirect_reference_table.h"
#include "trace.h"
#include "UniquePtr.h"
-#ifdef ART_USE_GREENLAND_COMPILER
-#include "greenland/runtime_entry_points.h"
-#endif
namespace art {
@@ -777,9 +774,6 @@
// Runtime support function pointers
// TODO: move this near the top, since changing its offset requires all oats to be recompiled!
EntryPoints entrypoints_;
-#ifdef ART_USE_GREENLAND_COMPILER
- RuntimeEntryPoints runtime_entry_points_;
-#endif
private:
// How many times has our pthread key's destructor been called?
diff --git a/src/trace.cc b/src/trace.cc
index d0132e1..753b80f 100644
--- a/src/trace.cc
+++ b/src/trace.cc
@@ -241,6 +241,7 @@
void Trace::SaveAndUpdateCode(AbstractMethod* method) {
#if defined(ART_USE_LLVM_COMPILER)
+ UNUSED(method);
UNIMPLEMENTED(FATAL);
#else
void* trace_stub = GetLogTraceEntryPoint();
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index 67507bc..bd77a3c 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -32,7 +32,7 @@
#include "runtime.h"
#include "stringpiece.h"
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
#include "greenland/backend_types.h"
#include "greenland/inferred_reg_category_map.h"
#endif
@@ -962,7 +962,7 @@
return true;
}
-#if !defined(ART_USE_LLVM_COMPILER) && !defined(ART_USE_GREENLAND_COMPILER)
+#if !defined(ART_USE_LLVM_COMPILER)
static const std::vector<uint8_t>* CreateLengthPrefixedDexGcMap(const std::vector<uint8_t>& gc_map) {
std::vector<uint8_t>* length_prefixed_gc_map = new std::vector<uint8_t>;
length_prefixed_gc_map->push_back((gc_map.size() & 0xff000000) >> 24);
@@ -1012,7 +1012,7 @@
Compiler::MethodReference ref(dex_file_, method_idx_);
-#if !defined(ART_USE_LLVM_COMPILER) && !defined(ART_USE_GREENLAND_COMPILER)
+#if !defined(ART_USE_LLVM_COMPILER)
/* Generate a register map and add it to the method. */
UniquePtr<const std::vector<uint8_t> > map(GenerateGcMap());
@@ -1026,7 +1026,7 @@
const std::vector<uint8_t>* dex_gc_map = CreateLengthPrefixedDexGcMap(*(map.get()));
verifier::MethodVerifier::SetDexGcMap(ref, *dex_gc_map);
-#else // defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#else // defined(ART_USE_LLVM_COMPILER)
/* Generate Inferred Register Category for LLVM-based Code Generator */
const InferredRegCategoryMap* table = GenerateInferredRegCategoryMap();
verifier::MethodVerifier::SetInferredRegCategoryMap(ref, *table);
@@ -3262,7 +3262,7 @@
Mutex* MethodVerifier::rejected_classes_lock_ = NULL;
MethodVerifier::RejectedClassesTable* MethodVerifier::rejected_classes_ = NULL;
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
Mutex* MethodVerifier::inferred_reg_category_maps_lock_ = NULL;
MethodVerifier::InferredRegCategoryMapTable* MethodVerifier::inferred_reg_category_maps_ = NULL;
#endif
@@ -3281,7 +3281,7 @@
rejected_classes_ = new MethodVerifier::RejectedClassesTable;
}
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
inferred_reg_category_maps_lock_ = new Mutex("verifier GC maps lock");
{
MutexLock mu(self, *inferred_reg_category_maps_lock_);
@@ -3309,7 +3309,7 @@
delete rejected_classes_lock_;
rejected_classes_lock_ = NULL;
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
{
MutexLock mu(self, *inferred_reg_category_maps_lock_);
STLDeleteValues(inferred_reg_category_maps_);
@@ -3334,7 +3334,7 @@
return (rejected_classes_->find(ref) != rejected_classes_->end());
}
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
const greenland::InferredRegCategoryMap* MethodVerifier::GenerateInferredRegCategoryMap() {
uint32_t insns_size = code_item_->insns_size_in_code_units_;
uint16_t regs_size = code_item_->registers_size_;
diff --git a/src/verifier/method_verifier.h b/src/verifier/method_verifier.h
index 6765c10..42283a2 100644
--- a/src/verifier/method_verifier.h
+++ b/src/verifier/method_verifier.h
@@ -39,7 +39,7 @@
struct ReferenceMap2Visitor;
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
namespace greenland {
class InferredRegCategoryMap;
} // namespace greenland
@@ -143,7 +143,7 @@
// The verifier
class MethodVerifier {
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
typedef greenland::InferredRegCategoryMap InferredRegCategoryMap;
#endif
@@ -203,7 +203,7 @@
static void Init();
static void Shutdown();
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
static const InferredRegCategoryMap* GetInferredRegCategoryMap(Compiler::MethodReference ref)
LOCKS_EXCLUDED(inferred_reg_category_maps_lock_);
#endif
@@ -554,7 +554,7 @@
// Get a type representing the declaring class of the method.
const RegType& GetDeclaringClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
/*
* Generate the inferred register category for LLVM-based code generator.
* Returns a pointer to a two-dimension Class array, or NULL on failure.
@@ -589,7 +589,7 @@
static Mutex* rejected_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
static RejectedClassesTable* rejected_classes_;
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
+#if defined(ART_USE_LLVM_COMPILER)
// All the inferred register category maps that the verifier has created.
typedef SafeMap<const Compiler::MethodReference,
const InferredRegCategoryMap*> InferredRegCategoryMapTable;