diff options
| -rw-r--r-- | build/Android.common.mk | 6 | ||||
| -rw-r--r-- | build/Android.oat.mk | 8 | ||||
| -rw-r--r-- | compiler/image_writer.cc | 9 | ||||
| -rw-r--r-- | dex2oat/dex2oat.cc | 4 | ||||
| -rw-r--r-- | runtime/arch/x86_64/quick_entrypoints_x86_64.S | 41 | ||||
| -rw-r--r-- | runtime/class_linker.cc | 11 | ||||
| -rw-r--r-- | runtime/elf_file.cc | 6 | ||||
| -rw-r--r-- | runtime/oat.cc | 3 | ||||
| -rw-r--r-- | test/044-proxy/expected.txt | 1 | ||||
| -rw-r--r-- | test/044-proxy/src/BasicTest.java | 15 | ||||
| -rw-r--r-- | test/Android.mk | 2 |
11 files changed, 81 insertions, 25 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk index f22eb37beb..30f730c580 100644 --- a/build/Android.common.mk +++ b/build/Android.common.mk @@ -37,6 +37,12 @@ ART_BUILD_TARGET_DEBUG ?= true ART_BUILD_HOST_NDEBUG ?= $(WITH_HOST_DALVIK) ART_BUILD_HOST_DEBUG ?= $(WITH_HOST_DALVIK) +ifeq ($(BUILD_HOST_64bit),) +ART_HOST_ARCH := x86 +else +ART_HOST_ARCH := x86_64 +endif + ifeq ($(ART_BUILD_TARGET_NDEBUG),false) $(info Disabling ART_BUILD_TARGET_NDEBUG) endif diff --git a/build/Android.oat.mk b/build/Android.oat.mk index 6012421a59..def585b787 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -40,19 +40,13 @@ TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/core.art TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) -ifeq ($(BUILD_HOST_64bit),) -host_arch := x86 -else -host_arch := x86_64 -endif - $(HOST_CORE_IMG_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY) @echo "host dex2oat: $@ ($?)" @mkdir -p $(dir $@) $(hide) $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix \ --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) \ --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(LIBART_IMG_HOST_BASE_ADDRESS) \ - --instruction-set=$(host_arch) --host --android-root=$(HOST_OUT) + --instruction-set=$(ART_HOST_ARCH) --host --android-root=$(HOST_OUT) $(TARGET_CORE_IMG_OUT): $(TARGET_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY) @echo "target dex2oat: $@ ($?)" diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index f4b507a64a..8885652adc 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -639,14 +639,17 @@ void ImageWriter::FixupMethod(ArtMethod* orig, ArtMethod* copy) { (!orig->IsStatic() || orig->IsConstructor() || orig->GetDeclaringClass()->IsInitialized())) { // We have code for a non-static or initialized method, just use the code. copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(quick_code); - } else if (quick_code == nullptr && orig->IsNative() && !orig->IsStatic()) { - // Non-static native method missing compiled code, use generic JNI version. + } else if (quick_code == nullptr && orig->IsNative() && + (!orig->IsStatic() || orig->GetDeclaringClass()->IsInitialized())) { + // Non-static or initialized native method missing compiled code, use generic JNI version. copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_generic_jni_trampoline_offset_)); } else if (quick_code == nullptr && !orig->IsNative()) { // We don't have code at all for a non-native method, use the interpreter. copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_to_interpreter_bridge_offset_)); } else { - // We have code for a static method, but need to go through the resolution stub for class initialization. + CHECK(!orig->GetDeclaringClass()->IsInitialized()); + // We have code for a static method, but need to go through the resolution stub for class + // initialization. copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_resolution_trampoline_offset_)); } const byte* portable_code = GetOatAddress(orig->GetPortableOatCodeOffset()); diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index cc78816546..327d3fba28 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -738,8 +738,12 @@ static int dex2oat(int argc, char** argv) { #if defined(__arm__) InstructionSet instruction_set = kThumb2; +#elif defined(__aarch64__) + InstructionSet instruction_set = kArm64; #elif defined(__i386__) InstructionSet instruction_set = kX86; +#elif defined(__x86_64__) + InstructionSet instruction_set = kX86_64; #elif defined(__mips__) InstructionSet instruction_set = kMips; #else diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S index 81d5f4c501..340758f3ef 100644 --- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S +++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S @@ -421,7 +421,7 @@ DEFINE_FUNCTION art_quick_invoke_static_stub .Lreturn_float_quick2: movss %xmm0, (%r8) // Store the floating point result. ret -END_FUNCTION art_quick_invoke_stub +END_FUNCTION art_quick_invoke_static_stub MACRO3(NO_ARG_DOWNCALL, c_name, cxx_name, return_macro) DEFINE_FUNCTION VAR(c_name, 0) @@ -646,7 +646,43 @@ UNIMPLEMENTED art_quick_set_obj_static UNIMPLEMENTED art_quick_get32_static UNIMPLEMENTED art_quick_get64_static UNIMPLEMENTED art_quick_get_obj_static -UNIMPLEMENTED art_quick_proxy_invoke_handler + +DEFINE_FUNCTION art_quick_proxy_invoke_handler + // Save callee and GPR args, mixed together to agree with core spills bitmap of ref. and args + // callee save frame. + PUSH r15 // Callee save. + PUSH r14 // Callee save. + PUSH r13 // Callee save. + PUSH r12 // Callee save. + PUSH r9 // Quick arg 5. + PUSH r8 // Quick arg 4. + PUSH rsi // Quick arg 1. + PUSH rbp // Callee save. + PUSH rbx // Callee save. + PUSH rdx // Quick arg 2. + PUSH rcx // Quick arg 3. + // Create space for FPR args and create 2 slots, 1 of padding and 1 for the ArtMethod*. + subq LITERAL(80), %rsp + CFI_ADJUST_CFA_OFFSET(80) + // Save FPRs. + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + movq %xmm4, 48(%rsp) + movq %xmm5, 56(%rsp) + movq %xmm6, 64(%rsp) + movq %xmm7, 72(%rsp) + // Store proxy method to bottom of stack. + movq %rdi, 0(%rsp) + movq %gs:THREAD_SELF_OFFSET, %rdx // Pass Thread::Current(). + movq %rsp, %rcx // Pass SP. + call PLT_SYMBOL(artQuickProxyInvokeHandler) // (proxy method, receiver, Thread*, SP) + movq %rax, %xmm0 // Copy return value in case of float returns. + addq LITERAL(168), %rsp // Pop arguments. + CFI_ADJUST_CFA_OFFSET(-168) + RETURN_OR_DELIVER_PENDING_EXCEPTION +END_FUNCTION art_quick_proxy_invoke_handler /* * Called to resolve an imt conflict. @@ -659,6 +695,7 @@ DEFINE_FUNCTION art_quick_resolution_trampoline movq %rsp, %rcx call PLT_SYMBOL(artQuickResolutionTrampoline) // (called, receiver, Thread*, SP) movq %rax, %r10 // Remember returned code pointer in R10. + movq (%rsp), %rdi // Load called method into RDI. RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME testq %r10, %r10 // If code pointer is NULL goto deliver pending exception. jz 1f diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 6255c8c4f0..b709da372c 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1597,7 +1597,10 @@ const void* ClassLinker::GetQuickOatCodeFor(mirror::ArtMethod* method) { } const void* result = GetOatMethodFor(method).GetQuickCode(); if (result == nullptr) { - if (method->IsPortableCompiled()) { + if (method->IsNative()) { + // No code and native? Use generic trampoline. + result = GetQuickGenericJniTrampoline(); + } else if (method->IsPortableCompiled()) { // No code? Do we expect portable code? result = GetQuickToPortableBridge(); } else { @@ -1707,12 +1710,12 @@ void ClassLinker::FixupStaticTrampolines(mirror::Class* klass) { bool have_portable_code = false; if (enter_interpreter) { // Use interpreter entry point. - - // check whether the method is native, in which case it's generic JNI - portable_code = GetPortableToInterpreterBridge(); + // Check whether the method is native, in which case it's generic JNI. if (quick_code == nullptr && portable_code == nullptr && method->IsNative()) { quick_code = GetQuickGenericJniTrampoline(); + portable_code = GetPortableToQuickBridge(); } else { + portable_code = GetPortableToInterpreterBridge(); quick_code = GetQuickToInterpreterBridge(); } } else { diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc index fe338063bb..4de46e368b 100644 --- a/runtime/elf_file.cc +++ b/runtime/elf_file.cc @@ -978,7 +978,11 @@ void ElfFile::GdbJITSupport() { !check_section_name(all, 11, ".debug_str")) { return; } - +#ifdef __LP64__ + if (true) { + return; // No ELF debug support in 64bit. + } +#endif // This is not needed if we have no .text segment. uint32_t text_start_addr = 0; for (uint32_t i = 0; i < segments_.size(); i++) { diff --git a/runtime/oat.cc b/runtime/oat.cc index d4eea85bb3..454786df8c 100644 --- a/runtime/oat.cc +++ b/runtime/oat.cc @@ -132,7 +132,8 @@ const void* OatHeader::GetInterpreterToInterpreterBridge() const { uint32_t OatHeader::GetInterpreterToInterpreterBridgeOffset() const { DCHECK(IsValid()); - CHECK_GE(interpreter_to_interpreter_bridge_offset_, executable_offset_); + CHECK(interpreter_to_interpreter_bridge_offset_ == 0 || + interpreter_to_interpreter_bridge_offset_ >= executable_offset_); return interpreter_to_interpreter_bridge_offset_; } diff --git a/test/044-proxy/expected.txt b/test/044-proxy/expected.txt index 12df250b95..105d9296f7 100644 --- a/test/044-proxy/expected.txt +++ b/test/044-proxy/expected.txt @@ -54,6 +54,7 @@ Proxy interfaces: [interface Quads, interface Colors, interface Trace] Proxy methods: [public final java.lang.String $Proxy1.blob(), public final double $Proxy1.blue(int), public final R0a $Proxy1.checkMe(), public final R0aa $Proxy1.checkMe(), public final R0base $Proxy1.checkMe(), public final void $Proxy1.circle(int), public final boolean $Proxy1.equals(java.lang.Object), public final void $Proxy1.getTrace(), public final int $Proxy1.green(double), public final int $Proxy1.hashCode(), public final int $Proxy1.mauve(java.lang.String), public final int $Proxy1.rectangle(int,int), public final int $Proxy1.red(float), public final int $Proxy1.square(int,int), public final java.lang.String $Proxy1.toString(), public final int $Proxy1.trapezoid(int,double,int), public final void $Proxy1.upCheck() throws java.lang.InterruptedException, public final void $Proxy1.upChuck()] Decl annos: [] Param annos (0) : [] +Modifiers: 17 Dupe threw expected exception Clash threw expected exception Clash2 threw expected exception diff --git a/test/044-proxy/src/BasicTest.java b/test/044-proxy/src/BasicTest.java index ea46f49f2b..d4ce71fa11 100644 --- a/test/044-proxy/src/BasicTest.java +++ b/test/044-proxy/src/BasicTest.java @@ -90,6 +90,7 @@ public class BasicTest { Annotation[][] paramAnnos = meth.getParameterAnnotations(); System.out.println("Param annos (" + paramAnnos.length + ") : " + Arrays.deepToString(paramAnnos)); + System.out.println("Modifiers: " + meth.getModifiers()); } static Object createProxy(Object proxyMe) { @@ -244,14 +245,15 @@ class MyInvocationHandler implements InvocationHandler { // invocation of toString() in the print statements below. if (method.getDeclaringClass() == java.lang.Object.class) { //System.out.println("!!! object " + method.getName()); - if (method.getName().equals("toString")) + if (method.getName().equals("toString")) { return super.toString(); - else if (method.getName().equals("hashCode")) + } else if (method.getName().equals("hashCode")) { return Integer.valueOf(super.hashCode()); - else if (method.getName().equals("equals")) + } else if (method.getName().equals("equals")) { return Boolean.valueOf(super.equals(args[0])); - else + } else { throw new RuntimeException("huh?"); + } } if (method.getDeclaringClass() == Trace.class) { @@ -277,10 +279,11 @@ class MyInvocationHandler implements InvocationHandler { } try { - if (true) + if (true) { result = method.invoke(mObj, args); - else + } else { result = -1; + } System.out.println("Success: method " + method.getName() + " res=" + result); } catch (InvocationTargetException ite) { diff --git a/test/Android.mk b/test/Android.mk index f4a0426bf1..bae4680b5b 100644 --- a/test/Android.mk +++ b/test/Android.mk @@ -115,7 +115,7 @@ test-art-target-oat-$(1): $(ART_TEST_OUT)/oat-test-dex-$(1).jar test-art-target- $(hide) rm /tmp/test-art-target-oat-$(1) $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).odex: $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar $(HOST_CORE_IMG_OUT) | $(DEX2OAT) - $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$(PWD)/$$< --oat-file=$(PWD)/$$@ --instruction-set=$(HOST_ARCH) --host --android-root=$(HOST_OUT) + $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$(PWD)/$$< --oat-file=$(PWD)/$$@ --instruction-set=$(ART_HOST_ARCH) --host --android-root=$(HOST_OUT) .PHONY: test-art-host-oat-default-$(1) test-art-host-oat-default-$(1): $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).odex test-art-host-dependencies |