OSDN Git Service

am 17e4ea8f: Actually, dexopt needs to read the optimized dex file too.
authorDan Bornstein <danfuzz@android.com>
Mon, 13 Sep 2010 01:17:08 +0000 (18:17 -0700)
committerAndroid Git Automerger <android-git-automerger@android.com>
Mon, 13 Sep 2010 01:17:08 +0000 (18:17 -0700)
Merge commit '17e4ea8f17b6e4e14c483de49b3a3f053af188b4' into gingerbread-plus-aosp

* commit '17e4ea8f17b6e4e14c483de49b3a3f053af188b4':
  Actually, dexopt needs to read the optimized dex file too.

dx/etc/dx
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_MONITOR_EXIT.S

index f773495..e5cedff 100644 (file)
--- a/dx/etc/dx
+++ b/dx/etc/dx
@@ -36,11 +36,15 @@ cd "${oldwd}"
 
 jarfile=dx.jar
 libdir="$progdir"
+
 if [ ! -r "$libdir/$jarfile" ]; then
-    libdir=`dirname "$progdir"`/tools/lib
+    # set dx.jar location for the SDK case
+    libdir=`dirname "$progdir"`/platform-tools/lib
 fi
 
+
 if [ ! -r "$libdir/$jarfile" ]; then
+    # set dx.jar location for the Android tree case
     libdir=`dirname "$progdir"`/framework
 fi
 
index 970253c..ca880fd 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
@@ -282,10 +284,7 @@ op-start x86-atom
 #op OP_XOR_INT c
 #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 OP_IGET_VOLATILE c
 op OP_IPUT_VOLATILE c
 op OP_SGET_VOLATILE c
@@ -298,7 +297,6 @@ op OP_IGET_WIDE_VOLATILE c
 op OP_IPUT_WIDE_VOLATILE c
 op OP_SGET_WIDE_VOLATILE c
 op OP_SPUT_WIDE_VOLATILE c
-
 op-end
 
 # arch-specific entry point to interpreter
index d259f6e..4d9942d 100644 (file)
@@ -1895,7 +1895,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)
@@ -14534,31 +14534,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 */
@@ -14635,14 +14615,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
@@ -14650,7 +14630,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.
@@ -14666,15 +14647,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 */
@@ -17471,6 +17465,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:
index 6d088f7..ec431df 100644 (file)
@@ -1231,82 +1231,6 @@ OP_END
 HANDLE_SPUT_X(OP_SPUT_WIDE_VOLATILE,    "-wide-volatile", LongVolatile, _WIDE)
 OP_END
 
-/* File: c/OP_BREAKPOINT.c */
-HANDLE_OPCODE(OP_BREAKPOINT)
-#if (INTERP_TYPE == INTERP_DBG)
-    {
-        /*
-         * 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/OP_IPUT_OBJECT_VOLATILE.c */
 HANDLE_IPUT_X(OP_IPUT_OBJECT_VOLATILE,  "-object-volatile", ObjectVolatile, _AS_OBJECT)
 OP_END
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 31e1165..37738d5 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)