OSDN Git Service

Merge remote-tracking branch 'korg/froyo' into froyo-x86 froyo-x86 android-x86-2.2-r2
authorChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 26 Jun 2011 06:35:28 +0000 (14:35 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 26 Jun 2011 06:35:28 +0000 (14:35 +0800)
20 files changed:
dalvikdefines.h [new file with mode: 0644]
libdex/Android.mk
libdex/OptInvocation.c
libdex/ZipArchive.c
vm/Android.mk
vm/Dvm.mk
vm/Init.c
vm/Jni.c
vm/analysis/DexOptimize.c
vm/arch/x86-atom/Call386ABI.S
vm/mterp/config-x86-atom
vm/mterp/out/InterpAsm-x86-atom.S
vm/mterp/out/InterpC-x86-atom.c
vm/mterp/x86-atom/OP_BREAKPOINT.S [new file with mode: 0644]
vm/mterp/x86-atom/OP_EXECUTE_INLINE.S
vm/mterp/x86-atom/OP_EXECUTE_INLINE_RANGE.S [new file with mode: 0644]
vm/mterp/x86-atom/OP_GOTO_32.S
vm/mterp/x86-atom/OP_MONITOR_EXIT.S
vm/mterp/x86-atom/entry.S
vm/mterp/x86-atom/footer.S

diff --git a/dalvikdefines.h b/dalvikdefines.h
new file mode 100644 (file)
index 0000000..4329fcf
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+/*
+ * Dalvik implementation specific definitions.
+ */
+
+#ifndef _DALVIK_DEFINES_H
+#define _DALVIK_DEFINES_H
+
+#if defined(ANDROID)
+
+/* Use GCC visibility */
+#define DVM_EXPORT __attribute__((visibility("default")))
+#define DEX_EXPORT DVM_EXPORT
+
+#else
+
+#define DVM_EXPORT
+#define DEX_EXPORT
+
+#endif
+
+#endif /* ! _DALVIK_DEFINES_H */
index df45f04..4a6ef9a 100644 (file)
@@ -44,8 +44,25 @@ dex_include_files := \
 ifneq ($(SDK_ONLY),true)  # SDK_only doesn't need device version
 
 include $(CLEAR_VARS)
+
+# Make a debugging version when building the simulator (if not told
+# otherwise) and when explicitly asked.
+dvm_make_debug_vm := false
+ifeq ($(strip $(DEBUG_DALVIK_VM)),)
+  ifeq ($(dvm_simulator),true)
+    dvm_make_debug_vm := true
+  endif
+else
+  dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
+endif
+
 LOCAL_SRC_FILES := $(dex_src_files)
 LOCAL_C_INCLUDES += $(dex_include_files)
+LOCAL_CFLAGS += -include "dalvikdefines.h"
+ifeq ($(dvm_make_debug_vm),false)
+  # hide ELF symbols to reduce code size
+  LOCAL_CFLAGS += -fvisibility=hidden
+endif
 LOCAL_MODULE := libdex
 include $(BUILD_STATIC_LIBRARY)
 
@@ -60,5 +77,6 @@ endif # !SDK_ONLY
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(dex_src_files)
 LOCAL_C_INCLUDES += $(dex_include_files)
+LOCAL_CFLAGS += -include "dalvikdefines.h"
 LOCAL_MODULE := libdex
 include $(BUILD_HOST_STATIC_LIBRARY)
index 8ce918b..ae0e237 100644 (file)
@@ -116,6 +116,7 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
  *
  * Returns 0 on success, errno on failure.
  */
+DEX_EXPORT
 int dexOptCreateEmptyHeader(int fd)
 {
     DexOptHeader optHdr;
index 7c7e18e..48e8fd9 100644 (file)
@@ -300,6 +300,7 @@ int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive)
 /*
  * Prepare to access a ZipArchive in an open file descriptor.
  */
+DEX_EXPORT
 int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive)
 {
     MemMapping map;
@@ -347,6 +348,7 @@ bail:
  *
  * NOTE: the ZipArchive may not have been fully created.
  */
+DEX_EXPORT
 void dexZipCloseArchive(ZipArchive* pArchive)
 {
     LOGV("Closing archive %p\n", pArchive);
@@ -370,6 +372,7 @@ void dexZipCloseArchive(ZipArchive* pArchive)
  *
  * Returns 0 if not found.
  */
+DEX_EXPORT
 ZipEntry dexZipFindEntry(const ZipArchive* pArchive, const char* entryName)
 {
     int nameLen = strlen(entryName);
@@ -424,6 +427,7 @@ ZipEntry findEntryByIndex(ZipArchive* pArchive, int idx)
  * Returns "false" if the offsets to the fields or the contents of the fields
  * appear to be bogus.
  */
+DEX_EXPORT
 bool dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry,
     int* pMethod, long* pUncompLen, long* pCompLen, off_t* pOffset,
     long* pModWhen, long* pCrc32)
@@ -599,6 +603,7 @@ bail:
  * TODO: this doesn't verify the data's CRC, but probably should (especially
  * for uncompressed data).
  */
+DEX_EXPORT
 bool dexZipExtractEntryToFile(const ZipArchive* pArchive,
     const ZipEntry entry, int fd)
 {
index 0ef00f5..19713e1 100644 (file)
@@ -41,7 +41,7 @@ include $(LOCAL_PATH)/ReconfigureDvm.mk
 
 # Overwrite default settings
 ifeq ($(TARGET_SIMULATOR),false)
-    LOCAL_PRELINK_MODULE := true
+    LOCAL_PRELINK_MODULE := $(if $(filter-out x86,$(TARGET_ARCH)),true,false)
 endif
 LOCAL_MODULE_TAGS := user
 LOCAL_MODULE := libdvm
index baf41c6..ddc8519 100644 (file)
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -26,6 +26,7 @@
 #
 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
+LOCAL_CFLAGS += -include "dalvikdefines.h"
 
 #
 # Optional features.  These may impact the size or performance of the VM.
@@ -64,6 +65,7 @@ ifeq ($(dvm_make_debug_vm),true)
   # - GDB helpers enabled
   # - LOGV
   # - assert()
+  # - full ELF symbols
   #
   LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
   LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
@@ -83,6 +85,7 @@ else  # !dvm_make_debug_vm
   # - all development features disabled
   # - compiler optimizations enabled (redundant for "release" builds)
   # - (debugging and profiling still enabled)
+  # - minimize ELF symbols to reduce code size by 10%
   #
   #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
   # "-O2" is redundant for device (release) but useful for sim (debug)
@@ -91,6 +94,8 @@ else  # !dvm_make_debug_vm
   LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
   # if you want to try with assertions on the device, add:
   #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
+  # use GCC Visibility to reduce the footprint of runtime library
+  LOCAL_CFLAGS += -fvisibility=hidden
 endif  # !dvm_make_debug_vm
 
 # bug hunting: checksum and verify interpreted stack when making JNI calls
index 6630395..ab1be0e 100644 (file)
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -1491,6 +1491,7 @@ static bool dvmInitJDWP(void)
  *
  * Returns 0 on success.
  */
+DVM_EXPORT
 int dvmPrepForDexOpt(const char* bootClassPath, DexOptimizerMode dexOptMode,
     DexClassVerifyMode verifyMode, int dexoptFlags)
 {
index 6692f3b..9ce2f80 100644 (file)
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -4255,6 +4255,7 @@ void dvmLateEnableCheckedJni(void)
 /*
  * Not supported.
  */
+DVM_EXPORT
 jint JNI_GetDefaultJavaVMInitArgs(void* vm_args)
 {
     return JNI_ERR;
@@ -4265,6 +4266,7 @@ jint JNI_GetDefaultJavaVMInitArgs(void* vm_args)
  *
  * We always have zero or one.
  */
+DVM_EXPORT
 jint JNI_GetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs)
 {
     if (gDvm.vmList != NULL) {
@@ -4286,6 +4288,7 @@ jint JNI_GetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs)
  * The current thread becomes the main VM thread.  We return immediately,
  * which effectively means the caller is executing in a native method.
  */
+DVM_EXPORT
 jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args)
 {
     const JavaVMInitArgs* args = (JavaVMInitArgs*) vm_args;
index a5b8b6f..b134a3f 100644 (file)
@@ -508,6 +508,7 @@ bool dvmOptimizeDexFile(int fd, off_t dexOffset, long dexLength,
  *
  * Returns "true" on success.
  */
+DVM_EXPORT
 bool dvmContinueOptimization(int fd, off_t dexOffset, long dexLength,
     const char* fileName, u4 modWhen, u4 crc, bool isBootstrap)
 {
index 9e3b916..cfbcb9b 100644 (file)
@@ -91,12 +91,6 @@ CallABI_ENTER:
     lea         (%esp), %ebp
 
    /*
-    * Update and align (16 bytes) stack pointer
-    */
-
-    lea         -32(%esp), %esp
-
-   /*
     * Check if argInfo is valid. Is always valid so should remove this check?
     */
 
@@ -107,19 +101,12 @@ CallABI_ENTER:
     subl        %ecx, %esp              # %esp<- expanded for arg region
 
    /*
-    * Is the alignment right?
+    * Prepare for 16 byte alignment
     */
 
-#if 1
-    test        $4, %esp
-    jnz         1f
-    subl        $4, %esp
-1:
-    test        $8, %esp
-    jnz         1f
-    subl        $8, %esp
-1:
-#endif
+    and         $0xfffffff0, %esp
+    subl        $24, %esp
+
 
     movl        8(%ebp), %eax           # %eax<- clazz
     cmpl        $0, %eax                # Check virtual or static
@@ -149,8 +136,42 @@ CallABI_ENTER:
     movl        32(%ebp), %ecx          # %ecx<- return pointer
     je          2f                      # handle double return
     jl          1f                      # handle float return
+
+   /*
+    *  If a native function returns a result smaller than 8-bytes
+    *  then higher bytes may contain garbage.
+    *  This code does type-checking based on size of return result.
+    *  We zero higher bytes instead of allowing the garbage to go through.
+    */
+
+    cmpl        $3,%ebx
+    je          S8
+    cmpl        $4,%ebx
+    je          S4
+    cmpl        $7,%ebx
+    je          S1
+    cmpl        $6,%ebx
+    jne         S2
+U2:
+    movzwl      %ax, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+
+S1:
+    movsbl      %al, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S2:
+    movswl      %ax, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S4:
+    cltd
     movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S8:
     movl        %edx, 4(%ecx)           # save 64-bit return
+    movl        %eax, (%ecx)            # save 32-bit return
     jmp         CallABI_EXIT            # exit call
 
 2:
index a8acc65..61e2e72 100644 (file)
@@ -60,6 +60,7 @@ op-start x86-atom
 #op OP_APUT_SHORT c
 #op OP_APUT_WIDE c
 #op OP_ARRAY_LENGTH c
+#op OP_BREAKPOINT c
 #op OP_CHECK_CAST c
 #op OP_CMPG_DOUBLE c
 #op OP_CMPG_FLOAT c
@@ -90,6 +91,7 @@ op-start x86-atom
 #op OP_DOUBLE_TO_FLOAT c
 #op OP_DOUBLE_TO_INT c
 #op OP_DOUBLE_TO_LONG c
+#op OP_EXECUTE_INLINE_RANGE c
 #op OP_EXECUTE_INLINE c
 #op OP_FILL_ARRAY_DATA c
 #op OP_FILLED_NEW_ARRAY_RANGE c
@@ -283,10 +285,6 @@ op-start x86-atom
 #op OP_XOR_LONG_2ADDR c
 #op OP_XOR_LONG c
 
-# TODO: provide native implementations
-op OP_BREAKPOINT c
-op OP_EXECUTE_INLINE_RANGE c
-
 op-end
 
 # arch-specific entry point to interpreter
index 778fa48..d4b7545 100644 (file)
@@ -1903,7 +1903,7 @@ dalvik_inst:
     * For: monitor-exit
     *
     * Description: Release a monitor for the indicated object. If this instruction needs
-    *              to throw an execption, it must do so as if teh pc has already
+    *              to throw an execption, it must do so as if the pc has already
     *              advanced pased the instruction.
     *
     * Format: AA|op (11x)
@@ -14867,31 +14867,11 @@ OP_IF_LEZ_2f:
 /* ------------------------------ */
     .balign 64
 .L_OP_BREAKPOINT: /* 0xec */
-   /* Copyright (C) 2008 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.
-    */
+/* File: x86-atom/OP_BREAKPOINT.S */
+/* File: x86/unused.S */
+    jmp     common_abort
 
-   /*
-    * File: stub.S
-    */
 
-    SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
-    pushl       rGLUE                   # push parameter glue
-    call        dvmMterp_OP_BREAKPOINT      # call c-based implementation
-    lea         4(%esp), %esp
-    LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
-    FINISH_A                            # jump to next instruction
 /* ------------------------------ */
     .balign 64
 .L_OP_THROW_VERIFICATION_ERROR: /* 0xed */
@@ -14968,14 +14948,14 @@ OP_IF_LEZ_2f:
     *
     * Format:
     *
-    * Syntax: vAA, {vC, vD, vE, vF}, inline@BBBB
+    * Syntax: A, {vC, vD, vE, vF}, inline@BBBB
     */
 
     FETCH       1, %ecx                 # %ecx<- BBBB
     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
     addl        $offGlue_retval, %eax  # %eax<- &glue->retval
     EXPORT_PC
-    shr         $4, rINST              # rINST<- B
+    shr         $4, rINST              # rINST<- A
     movl        %eax, -8(%esp)          # push parameter glue->retval
     lea         -24(%esp), %esp
     jmp         .LOP_EXECUTE_INLINE_continue
@@ -14983,7 +14963,8 @@ OP_IF_LEZ_2f:
 /* ------------------------------ */
     .balign 64
 .L_OP_EXECUTE_INLINE_RANGE: /* 0xef */
-   /* Copyright (C) 2008 The Android Open Source Project
+/* File: x86-atom/OP_EXECUTE_INLINE_RANGE.S */
+   /* Copyright (C) 2010 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.
@@ -14999,15 +14980,28 @@ OP_IF_LEZ_2f:
     */
 
    /*
-    * File: stub.S
+    * File: OP_EXECUTE_INLINE_RANGE.S
+    *
+    * Code: Executes a "native inline" instruction. Uses no substitutions.
+    *
+    * For: execute-inline
+    *
+    * Description: Executes a "native inline" instruction. This instruction
+    *              is generated by the optimizer.
+    *
+    * Format:
+    *
+    * Syntax: AA, {vCCCC..v(CCCC+AA-1)}, inline@BBBB
     */
 
-    SAVE_PC_FP_TO_GLUE %edx             # save program counter and frame pointer
-    pushl       rGLUE                   # push parameter glue
-    call        dvmMterp_OP_EXECUTE_INLINE_RANGE      # call c-based implementation
-    lea         4(%esp), %esp
-    LOAD_PC_FP_FROM_GLUE                # restore program counter and frame pointer
-    FINISH_A                            # jump to next instruction
+    FETCH       1, %ecx                 # %ecx<- BBBB
+    movl        rGLUE, %eax             # %eax<- MterpGlue pointer
+    addl        $offGlue_retval, %eax  # %eax<- &glue->retval
+    EXPORT_PC
+    movl        %eax, -8(%esp)          # push parameter glue->retval
+    lea         -24(%esp), %esp
+    jmp         .LOP_EXECUTE_INLINE_RANGE_continue
+
 /* ------------------------------ */
     .balign 64
 .L_OP_INVOKE_DIRECT_EMPTY: /* 0xf0 */
@@ -17955,6 +17949,45 @@ dvmAsmSisterStart:
     lea         24(%esp), %esp          # update stack pointer
     je          common_exceptionThrown  # handle exception
     FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
+/* continuation for OP_EXECUTE_INLINE_RANGE */
+
+   /*
+    * Extract args, call function.
+    *  rINST = #of args (0-4)
+    *  %ecx = call index
+    */
+
+.LOP_EXECUTE_INLINE_RANGE_continue:
+    FETCH       2, %edx                 # %edx<- FEDC
+    cmp         $1, rINST              # determine number of arguments
+    jl          0f                      # handle zero args
+    je          1f                      # handle one arg
+    cmp         $3, rINST
+    jl          2f                      # handle two args
+    je          3f                      # handle three args
+4:
+    movl        12(rFP, %edx, 4), rINST     # rINST<- vF
+    movl        rINST, 12(%esp)         # push parameter vF
+3:
+    movl        8(rFP, %edx, 4), rINST     # rINST<- vE
+    movl        rINST, 8(%esp)          # push parameter E
+2:
+    movl        4(rFP, %edx, 4), rINST     # rINST<- vD
+    movl        rINST, 4(%esp)          # push parameter D
+1:
+    movl        (rFP, %edx, 4), %edx    # rINST<- vC
+    movl        %edx, (%esp)            # push parameter C
+0:
+    shl         $4, %ecx
+    movl        $gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations
+    call        *(%eax, %ecx)           # call function
+
+    cmp         $0, %eax               # check boolean result of inline
+    FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
+    lea         24(%esp), %esp          # update stack pointer
+    je          common_exceptionThrown  # handle exception
+    FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
+
     .size   dvmAsmSisterStart, .-dvmAsmSisterStart
     .global dvmAsmSisterEnd
 dvmAsmSisterEnd:
@@ -18331,10 +18364,10 @@ dvmAsmInstructionJmpTable = .LdvmAsmInstructionJmpTable
 .long .L_OP_UNUSED_E9
 .long .L_OP_UNUSED_EA
 .long .L_OP_UNUSED_EB
-.long .L_OP_UNUSED_EC
+.long .L_OP_BREAKPOINT
 .long .L_OP_THROW_VERIFICATION_ERROR
 .long .L_OP_EXECUTE_INLINE
-.long .L_OP_UNUSED_EF
+.long .L_OP_EXECUTE_INLINE_RANGE
 .long .L_OP_INVOKE_DIRECT_EMPTY
 .long .L_OP_UNUSED_F1
 .long .L_OP_IGET_QUICK
index 1a8a61a..96f70c6 100644 (file)
@@ -1192,82 +1192,6 @@ GOTO_TARGET_DECL(exceptionThrown);
     FINISH(2);
 
 
-/* File: c/OP_BREAKPOINT.c */
-HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG) && defined(WITH_DEBUGGER)
-    {
-        /*
-         * Restart this instruction with the original opcode.  We do
-         * this by simply jumping to the handler.
-         *
-         * It's probably not necessary to update "inst", but we do it
-         * for the sake of anything that needs to do disambiguation in a
-         * common handler with INST_INST.
-         *
-         * The breakpoint itself is handled over in updateDebugger(),
-         * because we need to detect other events (method entry, single
-         * step) and report them in the same event packet, and we're not
-         * yet handling those through breakpoint instructions.  By the
-         * time we get here, the breakpoint has already been handled and
-         * the thread resumed.
-         */
-        u1 originalOpCode = dvmGetOriginalOpCode(pc);
-        LOGV("+++ break 0x%02x (0x%04x -> 0x%04x)\n", originalOpCode, inst,
-            INST_REPLACE_OP(inst, originalOpCode));
-        inst = INST_REPLACE_OP(inst, originalOpCode);
-        FINISH_BKPT(originalOpCode);
-    }
-#else
-    LOGE("Breakpoint hit in non-debug interpreter\n");
-    dvmAbort();
-#endif
-OP_END
-
-/* File: c/OP_EXECUTE_INLINE_RANGE.c */
-HANDLE_OPCODE(OP_EXECUTE_INLINE_RANGE /*{vCCCC..v(CCCC+AA-1)}, inline@BBBB*/)
-    {
-        u4 arg0, arg1, arg2, arg3;
-        arg0 = arg1 = arg2 = arg3 = 0;      /* placate gcc */
-
-        EXPORT_PC();
-
-        vsrc1 = INST_AA(inst);      /* #of args */
-        ref = FETCH(1);             /* inline call "ref" */
-        vdst = FETCH(2);            /* range base */
-        ILOGV("|execute-inline-range args=%d @%d {regs=v%d-v%d}",
-            vsrc1, ref, vdst, vdst+vsrc1-1);
-
-        assert((vdst >> 16) == 0);  // 16-bit type -or- high 16 bits clear
-        assert(vsrc1 <= 4);
-
-        switch (vsrc1) {
-        case 4:
-            arg3 = GET_REGISTER(vdst+3);
-            /* fall through */
-        case 3:
-            arg2 = GET_REGISTER(vdst+2);
-            /* fall through */
-        case 2:
-            arg1 = GET_REGISTER(vdst+1);
-            /* fall through */
-        case 1:
-            arg0 = GET_REGISTER(vdst+0);
-            /* fall through */
-        default:        // case 0
-            ;
-        }
-
-#if INTERP_TYPE == INTERP_DBG
-        if (!dvmPerformInlineOp4Dbg(arg0, arg1, arg2, arg3, &retval, ref))
-            GOTO_exceptionThrown();
-#else
-        if (!dvmPerformInlineOp4Std(arg0, arg1, arg2, arg3, &retval, ref))
-            GOTO_exceptionThrown();
-#endif
-    }
-    FINISH(3);
-OP_END
-
 /* File: c/gotoTargets.c */
 /*
  * C footer.  This has some common code shared by the various targets.
diff --git a/vm/mterp/x86-atom/OP_BREAKPOINT.S b/vm/mterp/x86-atom/OP_BREAKPOINT.S
new file mode 100644 (file)
index 0000000..31d98c1
--- /dev/null
@@ -0,0 +1 @@
+%include "x86/unused.S"
index 4d45fef..5309c26 100644 (file)
     *
     * Format:
     *
-    * Syntax: vAA, {vC, vD, vE, vF}, inline@BBBB
+    * Syntax: A, {vC, vD, vE, vF}, inline@BBBB
     */
 
     FETCH       1, %ecx                 # %ecx<- BBBB
     movl        rGLUE, %eax             # %eax<- MterpGlue pointer
     addl        $$offGlue_retval, %eax  # %eax<- &glue->retval
     EXPORT_PC
-    shr         $$4, rINST              # rINST<- B
+    shr         $$4, rINST              # rINST<- A
     movl        %eax, -8(%esp)          # push parameter glue->retval
     lea         -24(%esp), %esp
     jmp         .L${opcode}_continue
diff --git a/vm/mterp/x86-atom/OP_EXECUTE_INLINE_RANGE.S b/vm/mterp/x86-atom/OP_EXECUTE_INLINE_RANGE.S
new file mode 100644 (file)
index 0000000..cd5a048
--- /dev/null
@@ -0,0 +1,75 @@
+   /* Copyright (C) 2010 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.
+    */
+
+   /*
+    * File: OP_EXECUTE_INLINE_RANGE.S
+    *
+    * Code: Executes a "native inline" instruction. Uses no substitutions.
+    *
+    * For: execute-inline
+    *
+    * Description: Executes a "native inline" instruction. This instruction
+    *              is generated by the optimizer.
+    *
+    * Format:
+    *
+    * Syntax: AA, {vCCCC..v(CCCC+AA-1)}, inline@BBBB
+    */
+
+    FETCH       1, %ecx                 # %ecx<- BBBB
+    movl        rGLUE, %eax             # %eax<- MterpGlue pointer
+    addl        $$offGlue_retval, %eax  # %eax<- &glue->retval
+    EXPORT_PC
+    movl        %eax, -8(%esp)          # push parameter glue->retval
+    lea         -24(%esp), %esp
+    jmp         .L${opcode}_continue
+%break
+
+   /*
+    * Extract args, call function.
+    *  rINST = #of args (0-4)
+    *  %ecx = call index
+    */
+
+.L${opcode}_continue:
+    FETCH       2, %edx                 # %edx<- FEDC
+    cmp         $$1, rINST              # determine number of arguments
+    jl          0f                      # handle zero args
+    je          1f                      # handle one arg
+    cmp         $$3, rINST
+    jl          2f                      # handle two args
+    je          3f                      # handle three args
+4:
+    movl        12(rFP, %edx, 4), rINST     # rINST<- vF
+    movl        rINST, 12(%esp)         # push parameter vF
+3:
+    movl        8(rFP, %edx, 4), rINST     # rINST<- vE
+    movl        rINST, 8(%esp)          # push parameter E
+2:
+    movl        4(rFP, %edx, 4), rINST     # rINST<- vD
+    movl        rINST, 4(%esp)          # push parameter D
+1:
+    movl        (rFP, %edx, 4), %edx    # rINST<- vC
+    movl        %edx, (%esp)            # push parameter C
+0:
+    shl         $$4, %ecx
+    movl        $$gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations
+    call        *(%eax, %ecx)           # call function
+
+    cmp         $$0, %eax               # check boolean result of inline
+    FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
+    lea         24(%esp), %esp          # update stack pointer
+    je          common_exceptionThrown  # handle exception
+    FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
index 9409400..eb9c9ac 100644 (file)
@@ -33,6 +33,6 @@
     shl         $$16, %ecx              # prepare to create +AAAAAAAA
     or          %ecx, %edx              # %edx<- +AAAAAAAA
     shl         $$1, %edx               # %edx is doubled to get the byte offset
-    jc          common_periodicChecks2  # do check on backwards branch
+    jle          common_periodicChecks2  # do check on backwards branch
     FINISH_RB   %edx, %ecx              # jump to next instruction
 
index 98f062b..2497fff 100644 (file)
@@ -21,7 +21,7 @@
     * For: monitor-exit
     *
     * Description: Release a monitor for the indicated object. If this instruction needs
-    *              to throw an execption, it must do so as if teh pc has already
+    *              to throw an execption, it must do so as if the pc has already
     *              advanced pased the instruction.
     *
     * Format: AA|op (11x)
index e33cf39..fe8d8fb 100644 (file)
@@ -369,10 +369,10 @@ dvmAsmInstructionJmpTable = .LdvmAsmInstructionJmpTable
 .long .L_OP_UNUSED_E9
 .long .L_OP_UNUSED_EA
 .long .L_OP_UNUSED_EB
-.long .L_OP_UNUSED_EC
+.long .L_OP_BREAKPOINT
 .long .L_OP_THROW_VERIFICATION_ERROR
 .long .L_OP_EXECUTE_INLINE
-.long .L_OP_UNUSED_EF
+.long .L_OP_EXECUTE_INLINE_RANGE
 .long .L_OP_INVOKE_DIRECT_EMPTY
 .long .L_OP_UNUSED_F1
 .long .L_OP_IGET_QUICK
index 35078af..a3b374f 100644 (file)
@@ -333,14 +333,15 @@ dalvik_mterp:
     jne         common_exceptionThrown  # handle exception
     FGETOP_JMP  3, %edx                 # jump to next instruction; getop, jmp
 
-.LstackOverflow:
+.LstackOverflow:  # %ecx=methodToCall
+    movl        %ecx, -4(%esp)          # push parameter method to call
     movl        rGLUE, %ecx             # %ecx<- pMterpGlue
     movl        offGlue_self(%ecx), %ecx # %ecx<- glue->self
-    movl        %ecx, -4(%esp)          # push parameter self
-    lea         -4(%esp), %esp
-    call        dvmHandleStackOverflow  # call: (Thread* self)
+    movl        %ecx, -8(%esp)          # push parameter self
+    lea         -8(%esp), %esp
+    call        dvmHandleStackOverflow  # call: (Thread* self, Method* method)
                                         # return: void
-    lea         4(%esp), %esp
+    lea         8(%esp), %esp
     jmp         common_exceptionThrown  # handle exception
 #ifdef ASSIST_DEBUGGER
 #endif
@@ -477,7 +478,7 @@ common_exceptionThrown:
     movl        %eax, -4(%esp)          # save %eax for later
     movl        %ecx, -12(%esp)         # push parameter 2 glue->self
     lea         -12(%esp), %esp
-    call        dvmCleanupStackOverflow # call: (Thread* self)
+    call        dvmCleanupStackOverflow # call: (Thread* self, Object* exception)
                                         # return: void
     lea         12(%esp), %esp
     movl        -4(%esp), %eax          # %eax<- restore %eax
@@ -527,7 +528,7 @@ common_exceptionThrown:
     je          1f                      #
     movl        %edx, -12(%esp)         # push parameter 1 glue->self
     lea         -12(%esp), %esp
-    call        dvmCleanupStackOverflow # call: (Thread* self)
+    call        dvmCleanupStackOverflow # call: (Thread* self, Object* exception)
                                         # return: void
     lea         12(%esp), %esp