diff options
| author | Andy McFadden <fadden@android.com> | 2009-05-07 13:30:23 -0700 |
|---|---|---|
| committer | Andy McFadden <fadden@android.com> | 2009-05-07 13:30:23 -0700 |
| commit | 3a1aedbc9777eab6275a360b93b81b079464238e (patch) | |
| tree | f5f7b5c8e3773bc9a04770243cc6fe57f0472638 /libdex | |
| parent | 3852601c7ec4b6857e8248d9ae141960b8d7e55e (diff) | |
| download | android_dalvik-3a1aedbc9777eab6275a360b93b81b079464238e.tar.gz android_dalvik-3a1aedbc9777eab6275a360b93b81b079464238e.tar.bz2 android_dalvik-3a1aedbc9777eab6275a360b93b81b079464238e.zip | |
Added throw-verification-error instruction.
This is for the deferred verifier error reporting. It replaces OP_UNUSED_ED.
The instructions aren't actually used yet, which is good since the x86
version hasn't been written yet.
The mterp regen also pushed out some recent-ish changes that hadn't
propagated to the armv4t sources.
Diffstat (limited to 'libdex')
| -rw-r--r-- | libdex/InstrUtils.c | 63 | ||||
| -rw-r--r-- | libdex/InstrUtils.h | 2 | ||||
| -rw-r--r-- | libdex/OpCode.h | 4 |
3 files changed, 39 insertions, 30 deletions
diff --git a/libdex/InstrUtils.c b/libdex/InstrUtils.c index b0718f386..f9ce4dec2 100644 --- a/libdex/InstrUtils.c +++ b/libdex/InstrUtils.c @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /* * Dalvik instruction utility functions. */ @@ -49,7 +50,7 @@ InstructionWidth* dexCreateInstrWidthTable(void) int width = 0; switch (opc) { - case OP_NOP: /* switch-statement data is a special case of NOP */ + case OP_NOP: /* note data for e.g. switch-* encoded "inside" a NOP */ case OP_MOVE: case OP_MOVE_WIDE: case OP_MOVE_OBJECT: @@ -289,6 +290,7 @@ InstructionWidth* dexCreateInstrWidthTable(void) case OP_IPUT_QUICK: case OP_IPUT_WIDE_QUICK: case OP_IPUT_OBJECT_QUICK: + case OP_THROW_VERIFICATION_ERROR: width = -2; break; case OP_INVOKE_VIRTUAL_QUICK: @@ -320,7 +322,6 @@ InstructionWidth* dexCreateInstrWidthTable(void) case OP_UNUSED_EA: case OP_UNUSED_EB: case OP_UNUSED_EC: - case OP_UNUSED_ED: case OP_UNUSED_EF: case OP_UNUSED_F1: case OP_UNUSED_FC: @@ -604,6 +605,9 @@ InstructionFlags* dexCreateInstrFlagsTable(void) break; /* optimizer-generated instructions */ + case OP_THROW_VERIFICATION_ERROR: + flags = kInstrCanThrow; + break; case OP_EXECUTE_INLINE: flags = kInstrCanContinue; break; @@ -641,7 +645,6 @@ InstructionFlags* dexCreateInstrFlagsTable(void) case OP_UNUSED_EA: case OP_UNUSED_EB: case OP_UNUSED_EC: - case OP_UNUSED_ED: case OP_UNUSED_EF: case OP_UNUSED_F1: case OP_UNUSED_FC: @@ -950,6 +953,9 @@ InstructionFormat* dexCreateInstrFormatTable(void) /* * Optimized instructions. */ + case OP_THROW_VERIFICATION_ERROR: + fmt = kFmt20bc; + break; case OP_IGET_QUICK: case OP_IGET_WIDE_QUICK: case OP_IGET_OBJECT_QUICK: @@ -993,7 +999,6 @@ InstructionFormat* dexCreateInstrFormatTable(void) case OP_UNUSED_EA: case OP_UNUSED_EB: case OP_UNUSED_EC: - case OP_UNUSED_ED: case OP_UNUSED_EF: case OP_UNUSED_F1: case OP_UNUSED_FC: @@ -1038,38 +1043,39 @@ void dexDecodeInstruction(const InstructionFormat* fmts, const u2* insns, pDec->opCode = (OpCode) INST_INST(inst); switch (dexGetInstrFormat(fmts, pDec->opCode)) { - case kFmt10x: // op + case kFmt10x: // op /* nothing to do; copy the AA bits out for the verifier */ pDec->vA = INST_AA(inst); break; - case kFmt12x: // op vA, vB + case kFmt12x: // op vA, vB pDec->vA = INST_A(inst); pDec->vB = INST_B(inst); break; - case kFmt11n: // op vA, #+B + case kFmt11n: // op vA, #+B pDec->vA = INST_A(inst); pDec->vB = (s4) (INST_B(inst) << 28) >> 28; // sign extend 4-bit value break; - case kFmt11x: // op vAA + case kFmt11x: // op vAA pDec->vA = INST_AA(inst); break; - case kFmt10t: // op +AA + case kFmt10t: // op +AA pDec->vA = (s1) INST_AA(inst); // sign-extend 8-bit value break; - case kFmt20t: // op +AAAA + case kFmt20t: // op +AAAA pDec->vA = (s2) FETCH(1); // sign-extend 16-bit value break; - case kFmt21c: // op vAA, thing@BBBB - case kFmt22x: // op vAA, vBBBB + case kFmt20bc: // op AA, thing@BBBB + case kFmt21c: // op vAA, thing@BBBB + case kFmt22x: // op vAA, vBBBB pDec->vA = INST_AA(inst); pDec->vB = FETCH(1); break; - case kFmt21s: // op vAA, #+BBBB - case kFmt21t: // op vAA, +BBBB + case kFmt21s: // op vAA, #+BBBB + case kFmt21t: // op vAA, +BBBB pDec->vA = INST_AA(inst); pDec->vB = (s2) FETCH(1); // sign-extend 16-bit value break; - case kFmt21h: // op vAA, #+BBBB0000[00000000] + case kFmt21h: // op vAA, #+BBBB0000[00000000] pDec->vA = INST_AA(inst); /* * The value should be treated as right-zero-extended, but we don't @@ -1078,24 +1084,24 @@ void dexDecodeInstruction(const InstructionFormat* fmts, const u2* insns, */ pDec->vB = FETCH(1); break; - case kFmt23x: // op vAA, vBB, vCC + case kFmt23x: // op vAA, vBB, vCC pDec->vA = INST_AA(inst); pDec->vB = FETCH(1) & 0xff; pDec->vC = FETCH(1) >> 8; break; - case kFmt22b: // op vAA, vBB, #+CC + case kFmt22b: // op vAA, vBB, #+CC pDec->vA = INST_AA(inst); pDec->vB = FETCH(1) & 0xff; pDec->vC = (s1) (FETCH(1) >> 8); // sign-extend 8-bit value break; - case kFmt22s: // op vA, vB, #+CCCC - case kFmt22t: // op vA, vB, +CCCC + case kFmt22s: // op vA, vB, #+CCCC + case kFmt22t: // op vA, vB, +CCCC pDec->vA = INST_A(inst); pDec->vB = INST_B(inst); pDec->vC = (s2) FETCH(1); // sign-extend 16-bit value break; - case kFmt22c: // op vA, vB, thing@CCCC - case kFmt22cs: // [opt] op vA, vB, field offset CCCC + case kFmt22c: // op vA, vB, thing@CCCC + case kFmt22cs: // [opt] op vA, vB, field offset CCCC pDec->vA = INST_A(inst); pDec->vB = INST_B(inst); pDec->vC = FETCH(1); @@ -1103,21 +1109,21 @@ void dexDecodeInstruction(const InstructionFormat* fmts, const u2* insns, case kFmt30t: // op +AAAAAAAA pDec->vA = FETCH(1) | ((u4) FETCH(2) << 16); // signed 32-bit value break; - case kFmt31t: // op vAA, +BBBBBBBB - case kFmt31c: // op vAA, thing@BBBBBBBB + case kFmt31t: // op vAA, +BBBBBBBB + case kFmt31c: // op vAA, thing@BBBBBBBB pDec->vA = INST_AA(inst); pDec->vB = FETCH(1) | ((u4) FETCH(2) << 16); // 32-bit value break; - case kFmt32x: // op vAAAA, vBBBB + case kFmt32x: // op vAAAA, vBBBB pDec->vA = FETCH(1); pDec->vB = FETCH(2); break; - case kFmt31i: // op vAA, #+BBBBBBBB + case kFmt31i: // op vAA, #+BBBBBBBB pDec->vA = INST_AA(inst); pDec->vB = FETCH(1) | ((u4) FETCH(2) << 16); break; - case kFmt35c: // op vB, {vD..vG,vA}, thing@CCCC - case kFmt35ms: // [opt] invoke-virtual+super + case kFmt35c: // op vB, {vD..vG,vA}, thing@CCCC + case kFmt35ms: // [opt] invoke-virtual+super { /* * The lettering changes that came about when we went from 4 args @@ -1158,7 +1164,7 @@ void dexDecodeInstruction(const InstructionFormat* fmts, const u2* insns, pDec->vC = pDec->arg[0]; } break; - case kFmt3inline: // [opt] inline invoke + case kFmt3inline: // [opt] inline invoke { u2 regList; int i; @@ -1232,3 +1238,4 @@ int dexGetInstrOrTableWidthAbs(const InstructionWidth* widths, const u2* insns) } return width; } + diff --git a/libdex/InstrUtils.h b/libdex/InstrUtils.h index 9d8e5c37a..7621b8e38 100644 --- a/libdex/InstrUtils.h +++ b/libdex/InstrUtils.h @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /* * Dalvik instruction utility functions. */ @@ -42,6 +43,7 @@ enum InstructionFormat { kFmt11n, // op vA, #+B kFmt11x, // op vAA kFmt10t, // op +AA + kFmt20bc, // op AA, thing@BBBB kFmt20t, // op +AAAA kFmt22x, // op vAA, vBBBB kFmt21t, // op vAA, +BBBB diff --git a/libdex/OpCode.h b/libdex/OpCode.h index d38947290..127223104 100644 --- a/libdex/OpCode.h +++ b/libdex/OpCode.h @@ -331,9 +331,9 @@ typedef enum OpCode { OP_UNUSED_EA = 0xea, OP_UNUSED_EB = 0xeb, OP_UNUSED_EC = 0xec, - OP_UNUSED_ED = 0xed, /* optimizer output -- these are never generated by "dx" */ + OP_THROW_VERIFICATION_ERROR = 0xed, OP_EXECUTE_INLINE = 0xee, OP_UNUSED_EF = 0xef, /* OP_EXECUTE_INLINE_RANGE? */ @@ -628,7 +628,7 @@ typedef enum OpCode { H(OP_UNUSED_EA), \ H(OP_UNUSED_EB), \ H(OP_UNUSED_EC), \ - H(OP_UNUSED_ED), \ + H(OP_THROW_VERIFICATION_ERROR), \ H(OP_EXECUTE_INLINE), \ H(OP_UNUSED_EF), \ /* f0..ff */ \ |
