blob: a59d27fe85a8147ff572e947de796cc8bc5836ae [file] [log] [blame]
Ben Chengba4fc8b2009-06-01 13:00:29 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "Dalvik.h"
18#include "libdex/OpCode.h"
19#include "dexdump/OpCodeNames.h"
20
21#include "../../CompilerInternals.h"
22#include "Armv5teLIR.h"
23#include <unistd.h> /* for cacheflush */
24
25/*
26 * opcode: Armv5teOpCode enum
27 * skeleton: pre-designated bit-pattern for this opcode
28 * ds: dest start bit position
29 * de: dest end bit position
30 * s1s: src1 start bit position
31 * s1e: src1 end bit position
32 * s2s: src2 start bit position
33 * s2e: src2 end bit position
34 * operands: number of operands (for sanity check purposes)
35 * name: mnemonic name
36 * fmt: for pretty-prining
37 */
38#define ENCODING_MAP(opcode, skeleton, ds, de, s1s, s1e, s2s, s2e, operands, \
39 name, fmt) \
40 {skeleton, {{ds, de}, {s1s, s1e}, {s2s, s2e}}, opcode, operands, name, \
41 fmt}
42
43/* Instruction dump string format keys: !pf, where "!" is the start
44 * of the key, "p" is which numeric operand to use and "f" is the
45 * print format.
46 *
47 * [p]ositions:
48 * 0 -> operands[0] (dest)
49 * 1 -> operands[1] (src1)
50 * 2 -> operands[2] (src2)
51 *
52 * [f]ormats:
53 * h -> 4-digit hex
54 * d -> decimal
55 * D -> decimal+8 (used to convert 3-bit regnum field to high reg)
56 * E -> decimal*4
57 * F -> decimal*2
58 * c -> branch condition (beq, bne, etc.)
59 * t -> pc-relative target
60 * u -> 1st half of bl[x] target
61 * v -> 2nd half ob bl[x] target
62 * R -> register list
63 *
64 * [!] escape. To insert "!", use "!!"
65 */
66/* NOTE: must be kept in sync with enum Armv5teOpcode from Armv5teLIR.h */
67Armv5teEncodingMap EncodingMap[ARMV5TE_LAST] = {
68 ENCODING_MAP(ARMV5TE_16BIT_DATA, 0x0000, 15, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070069 IS_UNARY_OP,
70 "data", "0x!0h(!0d)"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070071 ENCODING_MAP(ARMV5TE_ADC, 0x4140, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070072 IS_BINARY_OP | CLOBBER_DEST,
73 "adc", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070074 ENCODING_MAP(ARMV5TE_ADD_RRI3, 0x1c00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -070075 IS_TERTIARY_OP | CLOBBER_DEST,
76 "add", "r!0d, r!1d, #!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070077 ENCODING_MAP(ARMV5TE_ADD_RI8, 0x3000, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070078 IS_BINARY_OP | CLOBBER_DEST,
79 "add", "r!0d, r!0d, #!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070080 ENCODING_MAP(ARMV5TE_ADD_RRR, 0x1800, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -070081 IS_TERTIARY_OP | CLOBBER_DEST,
82 "add", "r!0d, r!1d, r!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070083 ENCODING_MAP(ARMV5TE_ADD_RR_LH, 0x4440, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070084 IS_BINARY_OP | CLOBBER_DEST,
85 "add",
86 "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070087 ENCODING_MAP(ARMV5TE_ADD_RR_HL, 0x4480, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070088 IS_BINARY_OP | CLOBBER_DEST,
89 "add", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070090 ENCODING_MAP(ARMV5TE_ADD_RR_HH, 0x44c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070091 IS_BINARY_OP | CLOBBER_DEST,
92 "add", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070093 ENCODING_MAP(ARMV5TE_ADD_PC_REL, 0xa000, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070094 IS_BINARY_OP | CLOBBER_DEST,
95 "add", "r!0d, pc, #!1E"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070096 ENCODING_MAP(ARMV5TE_ADD_SP_REL, 0xa800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -070097 IS_BINARY_OP | CLOBBER_DEST,
98 "add", "r!0d, sp, #!1E"),
Ben Chengba4fc8b2009-06-01 13:00:29 -070099 ENCODING_MAP(ARMV5TE_ADD_SPI7, 0xb000, 6, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700100 IS_UNARY_OP | CLOBBER_DEST,
101 "add", "sp, #!0d*4"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700102 ENCODING_MAP(ARMV5TE_AND_RR, 0x4000, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700103 IS_BINARY_OP | CLOBBER_DEST,
104 "and", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700105 ENCODING_MAP(ARMV5TE_ASR, 0x1000, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700106 IS_TERTIARY_OP | CLOBBER_DEST,
107 "asr", "r!0d, r!1d, #!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700108 ENCODING_MAP(ARMV5TE_ASRV, 0x4100, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700109 IS_BINARY_OP | CLOBBER_DEST,
110 "asr", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700111 ENCODING_MAP(ARMV5TE_B_COND, 0xd000, 7, 0, 11, 8, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700112 IS_BINARY_OP | IS_BRANCH,
113 "!1c", "!0t"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700114 ENCODING_MAP(ARMV5TE_B_UNCOND, 0xe000, 10, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700115 NO_OPERAND | IS_BRANCH,
116 "b", "!0t"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700117 ENCODING_MAP(ARMV5TE_BIC, 0x4380, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700118 IS_BINARY_OP | CLOBBER_DEST,
119 "bic", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700120 ENCODING_MAP(ARMV5TE_BKPT, 0xbe00, 7, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700121 IS_UNARY_OP | IS_BRANCH,
122 "bkpt", "!0d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700123 ENCODING_MAP(ARMV5TE_BLX_1, 0xf000, 10, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700124 IS_BINARY_OP | IS_BRANCH,
125 "blx_1", "!0u"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700126 ENCODING_MAP(ARMV5TE_BLX_2, 0xe800, 10, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700127 IS_BINARY_OP | IS_BRANCH,
128 "blx_2", "!0v"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700129 ENCODING_MAP(ARMV5TE_BL_1, 0xf000, 10, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700130 IS_UNARY_OP | IS_BRANCH,
131 "bl_1", "!0u"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700132 ENCODING_MAP(ARMV5TE_BL_2, 0xf800, 10, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700133 IS_UNARY_OP | IS_BRANCH,
134 "bl_2", "!0v"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700135 ENCODING_MAP(ARMV5TE_BLX_R, 0x4780, 6, 3, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700136 IS_UNARY_OP | IS_BRANCH,
137 "blx", "r!0d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700138 ENCODING_MAP(ARMV5TE_BX, 0x4700, 6, 3, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700139 IS_UNARY_OP | IS_BRANCH,
140 "bx", "r!0d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700141 ENCODING_MAP(ARMV5TE_CMN, 0x42c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700142 IS_BINARY_OP,
143 "cmn", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700144 ENCODING_MAP(ARMV5TE_CMP_RI8, 0x2800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700145 IS_BINARY_OP,
146 "cmp", "r!0d, #!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700147 ENCODING_MAP(ARMV5TE_CMP_RR, 0x4280, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700148 IS_BINARY_OP,
149 "cmp", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700150 ENCODING_MAP(ARMV5TE_CMP_LH, 0x4540, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700151 IS_BINARY_OP,
152 "cmp", "r!0d, r!1D"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700153 ENCODING_MAP(ARMV5TE_CMP_HL, 0x4580, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700154 IS_BINARY_OP,
155 "cmp", "r!0D, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700156 ENCODING_MAP(ARMV5TE_CMP_HH, 0x45c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700157 IS_BINARY_OP,
158 "cmp", "r!0D, r!1D"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700159 ENCODING_MAP(ARMV5TE_EOR, 0x4040, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700160 IS_BINARY_OP | CLOBBER_DEST,
161 "eor", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700162 ENCODING_MAP(ARMV5TE_LDMIA, 0xc800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700163 IS_BINARY_OP | CLOBBER_DEST | CLOBBER_SRC1,
164 "ldmia", "r!0d!!, <!1R>"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700165 ENCODING_MAP(ARMV5TE_LDR_RRI5, 0x6800, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700166 IS_TERTIARY_OP | CLOBBER_DEST,
167 "ldr", "r!0d, [r!1d, #!2E]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700168 ENCODING_MAP(ARMV5TE_LDR_RRR, 0x5800, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700169 IS_TERTIARY_OP | CLOBBER_DEST,
170 "ldr", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700171 ENCODING_MAP(ARMV5TE_LDR_PC_REL, 0x4800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700172 IS_BINARY_OP | CLOBBER_DEST,
173 "ldr", "r!0d, [pc, #!1E]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700174 ENCODING_MAP(ARMV5TE_LDR_SP_REL, 0x9800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700175 IS_BINARY_OP | CLOBBER_DEST,
176 "ldr", "r!0d, [sp, #!1E]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700177 ENCODING_MAP(ARMV5TE_LDRB_RRI5, 0x7800, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700178 IS_TERTIARY_OP | CLOBBER_DEST,
179 "ldrb", "r!0d, [r!1d, #2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700180 ENCODING_MAP(ARMV5TE_LDRB_RRR, 0x5c00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700181 IS_TERTIARY_OP | CLOBBER_DEST,
182 "ldrb", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700183 ENCODING_MAP(ARMV5TE_LDRH_RRI5, 0x8800, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700184 IS_TERTIARY_OP | CLOBBER_DEST,
185 "ldrh", "r!0d, [r!1d, #!2F]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700186 ENCODING_MAP(ARMV5TE_LDRH_RRR, 0x5a00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700187 IS_TERTIARY_OP | CLOBBER_DEST,
188 "ldrh", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700189 ENCODING_MAP(ARMV5TE_LDRSB_RRR, 0x5600, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700190 IS_TERTIARY_OP | CLOBBER_DEST,
191 "ldrsb", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700192 ENCODING_MAP(ARMV5TE_LDRSH_RRR, 0x5e00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700193 IS_TERTIARY_OP | CLOBBER_DEST,
194 "ldrsh", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700195 ENCODING_MAP(ARMV5TE_LSL, 0x0000, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700196 IS_TERTIARY_OP | CLOBBER_DEST,
197 "lsl", "r!0d, r!1d, #!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700198 ENCODING_MAP(ARMV5TE_LSLV, 0x4080, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700199 IS_BINARY_OP | CLOBBER_DEST,
200 "lsl", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700201 ENCODING_MAP(ARMV5TE_LSR, 0x0800, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700202 IS_TERTIARY_OP | CLOBBER_DEST,
203 "lsr", "r!0d, r!1d, #!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700204 ENCODING_MAP(ARMV5TE_LSRV, 0x40c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700205 IS_BINARY_OP | CLOBBER_DEST,
206 "lsr", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700207 ENCODING_MAP(ARMV5TE_MOV_IMM, 0x2000, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700208 IS_BINARY_OP | CLOBBER_DEST,
209 "mov", "r!0d, #!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700210 ENCODING_MAP(ARMV5TE_MOV_RR, 0x1c00, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700211 IS_BINARY_OP | CLOBBER_DEST,
212 "mov", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700213 ENCODING_MAP(ARMV5TE_MOV_RR_LH, 0x4640, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700214 IS_BINARY_OP | CLOBBER_DEST,
215 "mov", "r!0D, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700216 ENCODING_MAP(ARMV5TE_MOV_RR_HL, 0x4680, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700217 IS_BINARY_OP | CLOBBER_DEST,
218 "mov", "r!0d, r!1D"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700219 ENCODING_MAP(ARMV5TE_MOV_RR_HH, 0x46c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700220 IS_BINARY_OP | CLOBBER_DEST,
221 "mov", "r!0D, r!1D"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700222 ENCODING_MAP(ARMV5TE_MUL, 0x4340, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700223 IS_BINARY_OP | CLOBBER_DEST,
224 "mul", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700225 ENCODING_MAP(ARMV5TE_MVN, 0x43c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700226 IS_BINARY_OP | CLOBBER_DEST,
227 "mvn", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700228 ENCODING_MAP(ARMV5TE_NEG, 0x4240, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700229 IS_BINARY_OP | CLOBBER_DEST,
230 "neg", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700231 ENCODING_MAP(ARMV5TE_ORR, 0x4300, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700232 IS_BINARY_OP | CLOBBER_DEST,
233 "orr", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700234 ENCODING_MAP(ARMV5TE_POP, 0xbc00, 8, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700235 IS_UNARY_OP,
236 "pop", "<!0R>"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700237 ENCODING_MAP(ARMV5TE_PUSH, 0xb400, 8, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700238 IS_UNARY_OP,
239 "push", "<!0R>"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700240 ENCODING_MAP(ARMV5TE_ROR, 0x41c0, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700241 IS_BINARY_OP | CLOBBER_DEST,
242 "ror", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700243 ENCODING_MAP(ARMV5TE_SBC, 0x4180, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700244 IS_BINARY_OP | CLOBBER_DEST,
245 "sbc", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700246 ENCODING_MAP(ARMV5TE_STMIA, 0xc000, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700247 IS_BINARY_OP | CLOBBER_SRC1,
248 "stmia", "r!0d!!, <!1R>"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700249 ENCODING_MAP(ARMV5TE_STR_RRI5, 0x6000, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700250 IS_TERTIARY_OP,
251 "str", "r!0d, [r!1d, #!2E]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700252 ENCODING_MAP(ARMV5TE_STR_RRR, 0x5000, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700253 IS_TERTIARY_OP,
254 "str", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700255 ENCODING_MAP(ARMV5TE_STR_SP_REL, 0x9000, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700256 IS_BINARY_OP,
257 "str", "r!0d, [sp, #!1E]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700258 ENCODING_MAP(ARMV5TE_STRB_RRI5, 0x7000, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700259 IS_TERTIARY_OP,
260 "strb", "r!0d, [r!1d, #!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700261 ENCODING_MAP(ARMV5TE_STRB_RRR, 0x5400, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700262 IS_TERTIARY_OP,
263 "strb", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700264 ENCODING_MAP(ARMV5TE_STRH_RRI5, 0x8000, 2, 0, 5, 3, 10, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700265 IS_TERTIARY_OP,
266 "strh", "r!0d, [r!1d, #!2F]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700267 ENCODING_MAP(ARMV5TE_STRH_RRR, 0x5200, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700268 IS_TERTIARY_OP,
269 "strh", "r!0d, [r!1d, r!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700270 ENCODING_MAP(ARMV5TE_SUB_RRI3, 0x1e00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700271 IS_TERTIARY_OP | CLOBBER_DEST,
272 "sub", "r!0d, r!1d, #!2d]"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700273 ENCODING_MAP(ARMV5TE_SUB_RI8, 0x3800, 10, 8, 7, 0, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700274 IS_BINARY_OP | CLOBBER_DEST,
275 "sub", "r!0d, #!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700276 ENCODING_MAP(ARMV5TE_SUB_RRR, 0x1a00, 2, 0, 5, 3, 8, 6,
Ben Chenge9695e52009-06-16 16:11:47 -0700277 IS_TERTIARY_OP | CLOBBER_DEST,
278 "sub", "r!0d, r!1d, r!2d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700279 ENCODING_MAP(ARMV5TE_SUB_SPI7, 0xb080, 6, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700280 IS_UNARY_OP | CLOBBER_DEST,
281 "sub", "sp, #!0d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700282 ENCODING_MAP(ARMV5TE_SWI, 0xdf00, 7, 0, -1, -1, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700283 IS_UNARY_OP | IS_BRANCH,
284 "swi", "!0d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700285 ENCODING_MAP(ARMV5TE_TST, 0x4200, 2, 0, 5, 3, -1, -1,
Ben Chenge9695e52009-06-16 16:11:47 -0700286 IS_UNARY_OP,
287 "tst", "r!0d, r!1d"),
Ben Chengba4fc8b2009-06-01 13:00:29 -0700288};
289
290#define PADDING_MOV_R0_R0 0x1C00
291
292/* Write the numbers in the literal pool to the codegen stream */
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700293static void installDataContent(CompilationUnit *cUnit)
Ben Chengba4fc8b2009-06-01 13:00:29 -0700294{
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700295 int *dataPtr = (int *) (cUnit->baseAddr + cUnit->dataOffset);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700296 Armv5teLIR *dataLIR = (Armv5teLIR *) cUnit->wordList;
297 while (dataLIR) {
298 *dataPtr++ = dataLIR->operands[0];
299 dataLIR = NEXT_LIR(dataLIR);
300 }
301}
302
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700303/* Returns the size of a Jit trace description */
304static int jitTraceDescriptionSize(const JitTraceDescription *desc)
305{
306 int runCount;
307 for (runCount = 0; ; runCount++) {
308 if (desc->trace[runCount].frag.runEnd)
309 break;
310 }
311 return sizeof(JitCodeDesc) + ((runCount+1) * sizeof(JitTraceRun));
312}
313
Ben Chengba4fc8b2009-06-01 13:00:29 -0700314/* Return TRUE if error happens */
315static bool assembleInstructions(CompilationUnit *cUnit, intptr_t startAddr)
316{
317 short *bufferAddr = (short *) cUnit->codeBuffer;
318 Armv5teLIR *lir;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700319
320 for (lir = (Armv5teLIR *) cUnit->firstLIRInsn; lir; lir = NEXT_LIR(lir)) {
321 if (lir->opCode < 0) {
322 if ((lir->opCode == ARMV5TE_PSEUDO_ALIGN4) &&
Ben Cheng1efc9c52009-06-08 18:25:27 -0700323 /* 1 means padding is needed */
324 (lir->operands[0] == 1)) {
Ben Chengba4fc8b2009-06-01 13:00:29 -0700325 *bufferAddr++ = PADDING_MOV_R0_R0;
326 }
327 continue;
328 }
329
Ben Chenge9695e52009-06-16 16:11:47 -0700330 if (lir->isNop) {
331 continue;
332 }
333
Ben Chengba4fc8b2009-06-01 13:00:29 -0700334 if (lir->opCode == ARMV5TE_LDR_PC_REL ||
335 lir->opCode == ARMV5TE_ADD_PC_REL) {
336 Armv5teLIR *lirTarget = (Armv5teLIR *) lir->generic.target;
337 intptr_t pc = (lir->generic.offset + 4) & ~3;
338 intptr_t target = lirTarget->generic.offset;
339 int delta = target - pc;
340 if (delta & 0x3) {
341 LOGE("PC-rel distance is not multiples of 4: %d\n", delta);
342 dvmAbort();
343 }
Ben Cheng1efc9c52009-06-08 18:25:27 -0700344 if (delta > 1023) {
345 return true;
346 }
Ben Chengba4fc8b2009-06-01 13:00:29 -0700347 lir->operands[1] = delta >> 2;
348 } else if (lir->opCode == ARMV5TE_B_COND) {
349 Armv5teLIR *targetLIR = (Armv5teLIR *) lir->generic.target;
350 intptr_t pc = lir->generic.offset + 4;
351 intptr_t target = targetLIR->generic.offset;
352 int delta = target - pc;
353 if (delta > 254 || delta < -256) {
Ben Cheng1efc9c52009-06-08 18:25:27 -0700354 return true;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700355 }
356 lir->operands[0] = delta >> 1;
357 } else if (lir->opCode == ARMV5TE_B_UNCOND) {
358 Armv5teLIR *targetLIR = (Armv5teLIR *) lir->generic.target;
359 intptr_t pc = lir->generic.offset + 4;
360 intptr_t target = targetLIR->generic.offset;
361 int delta = target - pc;
362 if (delta > 2046 || delta < -2048) {
363 LOGE("Unconditional branch distance out of range: %d\n", delta);
364 dvmAbort();
365 }
366 lir->operands[0] = delta >> 1;
367 } else if (lir->opCode == ARMV5TE_BLX_1) {
368 assert(NEXT_LIR(lir)->opCode == ARMV5TE_BLX_2);
369 /* curPC is Thumb */
370 intptr_t curPC = (startAddr + lir->generic.offset + 4) & ~3;
371 intptr_t target = lir->operands[1];
372
373 /* Match bit[1] in target with base */
374 if (curPC & 0x2) {
375 target |= 0x2;
376 }
377 int delta = target - curPC;
378 assert((delta >= -(1<<22)) && (delta <= ((1<<22)-2)));
379
380 lir->operands[0] = (delta >> 12) & 0x7ff;
381 NEXT_LIR(lir)->operands[0] = (delta>> 1) & 0x7ff;
382 }
383
Ben Chengba4fc8b2009-06-01 13:00:29 -0700384 Armv5teEncodingMap *encoder = &EncodingMap[lir->opCode];
385 short bits = encoder->skeleton;
386 int i;
387 for (i = 0; i < 3; i++) {
388 short value;
389 if (encoder->fieldLoc[i].end != -1) {
390 value = (lir->operands[i] << encoder->fieldLoc[i].start) &
391 ((1 << (encoder->fieldLoc[i].end + 1)) - 1);
392 bits |= value;
393
394 }
395 }
396 *bufferAddr++ = bits;
397 }
Ben Cheng1efc9c52009-06-08 18:25:27 -0700398 return false;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700399}
400
401/*
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700402 * Translation layout in the code cache. Note that the codeAddress pointer
403 * in JitTable will point directly to the code body (field codeAddress). The
404 * chain cell offset codeAddress - 2, and (if present) executionCount is at
405 * codeAddress - 6.
406 *
407 * +----------------------------+
408 * | Execution count | -> [Optional] 4 bytes
409 * +----------------------------+
410 * +--| Offset to chain cell counts| -> 2 bytes
411 * | +----------------------------+
412 * | | Code body | -> Start address for translation
413 * | | | variable in 2-byte chunks
414 * | . . (JitTable's codeAddress points here)
415 * | . .
416 * | | |
417 * | +----------------------------+
418 * | | Chaining Cells | -> 8 bytes each, must be 4 byte aligned
419 * | . .
420 * | . .
421 * | | |
422 * | +----------------------------+
423 * +->| Chaining cell counts | -> 4 bytes, chain cell counts by type
424 * +----------------------------+
425 * | Trace description | -> variable sized
426 * . .
427 * | |
428 * +----------------------------+
429 * | Literal pool | -> 4-byte aligned, variable size
430 * . .
431 * . .
432 * | |
433 * +----------------------------+
434 *
Ben Chengba4fc8b2009-06-01 13:00:29 -0700435 * Go over each instruction in the list and calculate the offset from the top
436 * before sending them off to the assembler. If out-of-range branch distance is
437 * seen rearrange the instructions a bit to correct it.
438 */
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700439#define CHAIN_CELL_OFFSET_SIZE 2
Ben Chengba4fc8b2009-06-01 13:00:29 -0700440void dvmCompilerAssembleLIR(CompilationUnit *cUnit)
441{
442 LIR *lir;
443 Armv5teLIR *armLIR;
Ben Cheng1efc9c52009-06-08 18:25:27 -0700444 int offset = 0;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700445 int i;
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700446 ChainCellCounts chainCellCounts;
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700447 int descSize = jitTraceDescriptionSize(cUnit->traceDesc);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700448
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700449 /* Beginning offset needs to allow space for chain cell offset */
Ben Cheng1efc9c52009-06-08 18:25:27 -0700450 for (armLIR = (Armv5teLIR *) cUnit->firstLIRInsn;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700451 armLIR;
452 armLIR = NEXT_LIR(armLIR)) {
453 armLIR->generic.offset = offset;
Ben Chenge9695e52009-06-16 16:11:47 -0700454 if (armLIR->opCode >= 0 && !armLIR->isNop) {
Ben Chengba4fc8b2009-06-01 13:00:29 -0700455 offset += 2;
456 } else if (armLIR->opCode == ARMV5TE_PSEUDO_ALIGN4) {
457 if (offset & 0x2) {
458 offset += 2;
459 armLIR->operands[0] = 1;
460 } else {
461 armLIR->operands[0] = 0;
462 }
463 }
464 /* Pseudo opcodes don't consume space */
465 }
466
467 /* Const values have to be word aligned */
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700468 offset = (offset + 3) & ~3;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700469
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700470 /* Add space for chain cell counts & trace description */
Ben Cheng1efc9c52009-06-08 18:25:27 -0700471 u4 chainCellOffset = offset;
472 Armv5teLIR *chainCellOffsetLIR = (Armv5teLIR *) (cUnit->firstLIRInsn);
473 assert(chainCellOffset < 0x10000);
474 assert(chainCellOffsetLIR->opCode == ARMV5TE_16BIT_DATA &&
475 chainCellOffsetLIR->operands[0] == CHAIN_CELL_OFFSET_TAG);
476
477 /* Replace the CHAIN_CELL_OFFSET_TAG with the real value */
478 chainCellOffsetLIR->operands[0] = chainCellOffset;
479
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700480 offset += sizeof(chainCellCounts) + descSize;
481
482 assert((offset & 0x3) == 0); /* Should still be word aligned */
483
484 /* Set up offsets for literals */
Ben Chengba4fc8b2009-06-01 13:00:29 -0700485 cUnit->dataOffset = offset;
486
487 for (lir = cUnit->wordList; lir; lir = lir->next) {
488 lir->offset = offset;
489 offset += 4;
490 }
491
492 cUnit->totalSize = offset;
493
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700494 if (gDvmJit.codeCacheByteUsed + cUnit->totalSize > CODE_CACHE_SIZE) {
Ben Chengba4fc8b2009-06-01 13:00:29 -0700495 gDvmJit.codeCacheFull = true;
496 cUnit->baseAddr = NULL;
497 return;
498 }
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700499
500 /* Allocate enough space for the code block */
501 cUnit->codeBuffer = dvmCompilerNew(chainCellOffset, true);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700502 if (cUnit->codeBuffer == NULL) {
503 LOGE("Code buffer allocation failure\n");
504 cUnit->baseAddr = NULL;
505 return;
506 }
507
Ben Cheng1efc9c52009-06-08 18:25:27 -0700508 bool assemblerFailure = assembleInstructions(
Ben Chengba4fc8b2009-06-01 13:00:29 -0700509 cUnit, (intptr_t) gDvmJit.codeCache + gDvmJit.codeCacheByteUsed);
510
Ben Cheng1efc9c52009-06-08 18:25:27 -0700511 /*
512 * Currently the only reason that can cause the assembler to fail is due to
513 * trace length - cut it in half and retry.
514 */
515 if (assemblerFailure) {
516 cUnit->halveInstCount = true;
517 return;
518 }
Ben Chengba4fc8b2009-06-01 13:00:29 -0700519
Ben Chengba4fc8b2009-06-01 13:00:29 -0700520 cUnit->baseAddr = (char *) gDvmJit.codeCache + gDvmJit.codeCacheByteUsed;
Ben Cheng1efc9c52009-06-08 18:25:27 -0700521 cUnit->headerSize = CHAIN_CELL_OFFSET_SIZE;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700522 gDvmJit.codeCacheByteUsed += offset;
523
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700524 /* Install the code block */
Ben Cheng1efc9c52009-06-08 18:25:27 -0700525 memcpy((char*)cUnit->baseAddr, cUnit->codeBuffer, chainCellOffset);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700526 gDvmJit.numCompilations++;
527
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700528 /* Install the chaining cell counts */
529 for (i=0; i< CHAINING_CELL_LAST; i++) {
530 chainCellCounts.u.count[i] = cUnit->numChainingCells[i];
531 }
532 memcpy((char*)cUnit->baseAddr + chainCellOffset, &chainCellCounts,
533 sizeof(chainCellCounts));
534
535 /* Install the trace description */
536 memcpy((char*)cUnit->baseAddr + chainCellOffset + sizeof(chainCellCounts),
537 cUnit->traceDesc, descSize);
538
539 /* Write the literals directly into the code cache */
540 installDataContent(cUnit);
541
Ben Chengba4fc8b2009-06-01 13:00:29 -0700542 /* Flush dcache and invalidate the icache to maintain coherence */
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700543 cacheflush((long)cUnit->baseAddr,
544 (long)(cUnit->baseAddr + offset), 0);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700545}
546
547/*
548 * Perform translation chain operation.
549 * For ARM, we'll use a pair of thumb instructions to generate
550 * an unconditional chaining branch of up to 4MB in distance.
551 * Use a BL, though we don't really need the link. The format is
552 * 111HHooooooooooo
553 * Where HH is 10 for the 1st inst, and 11 for the second and
554 * the "o" field is each instruction's 11-bit contribution to the
555 * 22-bit branch offset.
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700556 * If the target is nearby, use a single-instruction bl.
557 * If one or more threads is suspended, don't chain.
Ben Chengba4fc8b2009-06-01 13:00:29 -0700558 */
559void* dvmJitChain(void* tgtAddr, u4* branchAddr)
560{
561 int baseAddr = (u4) branchAddr + 4;
562 int branchOffset = (int) tgtAddr - baseAddr;
563 u4 thumb1;
564 u4 thumb2;
565 u4 newInst;
566
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700567 if (gDvm.sumThreadSuspendCount == 0) {
568 assert((branchOffset >= -(1<<22)) && (branchOffset <= ((1<<22)-2)));
Ben Chengba4fc8b2009-06-01 13:00:29 -0700569
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700570 gDvmJit.translationChains++;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700571
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700572 COMPILER_TRACE_CHAINING(
573 LOGD("Jit Runtime: chaining 0x%x to 0x%x\n",
574 (int) branchAddr, (int) tgtAddr & -2));
575 if ((branchOffset < -2048) | (branchOffset > 2046)) {
576 thumb1 = (0xf000 | ((branchOffset>>12) & 0x7ff));
577 thumb2 = (0xf800 | ((branchOffset>> 1) & 0x7ff));
578 } else {
579 thumb1 = (0xe000 | ((branchOffset>> 1) & 0x7ff));
580 thumb2 = 0x4300; /* nop -> or r0, r0 */
581 }
582
583 newInst = thumb2<<16 | thumb1;
584 *branchAddr = newInst;
585 cacheflush((long)branchAddr, (long)branchAddr + 4, 0);
Ben Chengba4fc8b2009-06-01 13:00:29 -0700586 }
587
Ben Chengba4fc8b2009-06-01 13:00:29 -0700588 return tgtAddr;
589}
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700590
591/*
592 * Unchain a trace given the starting address of the translation
593 * in the code cache. Refer to the diagram in dvmCompilerAssembleLIR.
594 * Returns the address following the last cell unchained. Note that
595 * the incoming codeAddr is a thumb code address, and therefore has
596 * the low bit set.
597 */
598u4* dvmJitUnchain(void* codeAddr)
599{
600 u2* pChainCellOffset = (u2*)((char*)codeAddr - 3);
601 u2 chainCellOffset = *pChainCellOffset;
602 ChainCellCounts *pChainCellCounts =
603 (ChainCellCounts*)((char*)codeAddr + chainCellOffset -3);
604 int cellCount;
605 u4* pChainCells;
606 u4* pStart;
607 u4 thumb1;
608 u4 thumb2;
609 u4 newInst;
610 int i,j;
611
612 /* Get total count of chain cells */
613 for (i = 0, cellCount = 0; i < CHAINING_CELL_LAST; i++) {
614 cellCount += pChainCellCounts->u.count[i];
615 }
616
617 /* Locate the beginning of the chain cell region */
618 pStart = pChainCells = (u4*)((char*)pChainCellCounts - (cellCount * 8));
619
620 /* The cells are sorted in order - walk through them and reset */
621 for (i = 0; i < CHAINING_CELL_LAST; i++) {
622 for (j = 0; j < pChainCellCounts->u.count[i]; j++) {
623 int targetOffset;
624 switch(i) {
Ben Cheng1efc9c52009-06-08 18:25:27 -0700625 case CHAINING_CELL_NORMAL:
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700626 targetOffset = offsetof(InterpState,
627 jitToInterpEntries.dvmJitToInterpNormal);
628 break;
Ben Cheng1efc9c52009-06-08 18:25:27 -0700629 case CHAINING_CELL_HOT:
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700630 case CHAINING_CELL_INVOKE:
631 targetOffset = offsetof(InterpState,
632 jitToInterpEntries.dvmJitToTraceSelect);
633 break;
634 default:
635 dvmAbort();
636 }
637 /*
638 * Arm code sequence for a chaining cell is:
639 * ldr r0, rGLUE, #<word offset>
640 * blx r0
641 */
642 COMPILER_TRACE_CHAINING(
643 LOGD("Jit Runtime: unchaining 0x%x", (int)pChainCells));
644 targetOffset = targetOffset >> 2; /* convert to word offset */
645 thumb1 = 0x6800 | (targetOffset << 6) | (rGLUE << 3) | (r0 << 0);
646 thumb2 = 0x4780 | (r0 << 3);
647 newInst = thumb2<<16 | thumb1;
648 *pChainCells = newInst;
649 pChainCells += 2; /* Advance by 2 words */
650 }
651 }
652 return pChainCells;
653}
654
655/* Unchain all translation in the cache. */
656void dvmJitUnchainAll()
657{
658 u4* lowAddress = NULL;
659 u4* highAddress = NULL;
660 unsigned int i;
661 if (gDvmJit.pJitEntryTable != NULL) {
662 COMPILER_TRACE_CHAINING(LOGD("Jit Runtime: unchaining all"));
663 dvmLockMutex(&gDvmJit.tableLock);
Bill Buzbee27176222009-06-09 09:20:16 -0700664 for (i = 0; i < gDvmJit.jitTableSize; i++) {
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700665 if (gDvmJit.pJitEntryTable[i].dPC &&
666 gDvmJit.pJitEntryTable[i].codeAddress) {
667 u4* lastAddress;
668 lastAddress =
669 dvmJitUnchain(gDvmJit.pJitEntryTable[i].codeAddress);
670 if (lowAddress == NULL ||
671 (u4*)gDvmJit.pJitEntryTable[i].codeAddress < lowAddress)
672 lowAddress = lastAddress;
673 if (lastAddress > highAddress)
674 highAddress = lastAddress;
675 }
676 }
677 cacheflush((long)lowAddress, (long)highAddress, 0);
678 dvmUnlockMutex(&gDvmJit.tableLock);
679 }
680}