1 /* src/vm/jit/parse.c - parser for JavaVM to intermediate code translation
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
29 Changes: Carolyn Oates
34 $Id: parse.c 4724 2006-04-04 08:30:53Z edwin $
46 #include "mm/memory.h"
47 #include "native/native.h"
48 #include "toolbox/logging.h"
49 #include "vm/builtin.h"
50 #include "vm/exceptions.h"
51 #include "vm/global.h"
52 #include "vm/linker.h"
53 #include "vm/loader.h"
54 #include "vm/resolve.h"
55 #include "vm/options.h"
56 #include "vm/statistics.h"
57 #include "vm/stringlocal.h"
58 #include "vm/jit/asmpart.h"
59 #include "vm/jit/jit.h"
60 #include "vm/jit/parse.h"
61 #include "vm/jit/patcher.h"
62 #include "vm/jit/loop/loop.h"
64 /*******************************************************************************
66 function 'parse' scans the JavaVM code and generates intermediate code
68 During parsing the block index table is used to store at bit pos 0
69 a flag which marks basic block starts and at position 1 to 31 the
70 intermediate instruction index. After parsing the block index table
71 is scanned, for marked positions a block is generated and the block
72 number is stored in the block index table.
74 *******************************************************************************/
76 static exceptiontable * fillextable(methodinfo *m,
77 exceptiontable *extable,
78 exceptiontable *raw_extable,
79 int exceptiontablelength,
84 if (exceptiontablelength == 0)
87 b_count = *block_count;
89 for (src = exceptiontablelength-1; src >=0; src--) {
90 /* the start of the handled region becomes a basic block start */
91 p = raw_extable[src].startpc;
92 CHECK_BYTECODE_INDEX(p);
96 p = raw_extable[src].endpc; /* see JVM Spec 4.7.3 */
97 CHECK_BYTECODE_INDEX_EXCLUSIVE(p);
99 #if defined(ENABLE_VERIFIER)
100 if (p <= raw_extable[src].startpc) {
101 *exceptionptr = new_verifyerror(m,
102 "Invalid exception handler range");
108 /* end of handled region becomes a basic block boundary */
109 /* (If it is the bytecode end, we'll use the special */
110 /* end block that is created anyway.) */
111 if (p < m->jcodelength)
114 /* the start of the handler becomes a basic block start */
115 p = raw_extable[src].handlerpc;
116 CHECK_BYTECODE_INDEX(p);
117 extable->handlerpc = p;
120 extable->catchtype = raw_extable[src].catchtype;
121 extable->next = NULL;
122 extable->down = &extable[1];
126 *block_count = b_count;
131 #if defined(ENABLE_VERIFIER)
132 throw_invalid_bytecode_index:
134 new_verifyerror(m, "Illegal bytecode index in exception table");
139 /*** macro for checking the length of the bytecode ***/
141 #if defined(ENABLE_VERIFIER)
142 #define CHECK_END_OF_BYTECODE(neededlength) \
144 if ((neededlength) > m->jcodelength) \
145 goto throw_unexpected_end_of_bytecode; \
147 #else /* !ENABLE_VERIFIER */
148 #define CHECK_END_OF_BYTECODE(neededlength)
149 #endif /* ENABLE_VERIFIER */
151 bool parse(jitdata *jd)
155 int p; /* java instruction counter */
156 int nextp; /* start of next java instruction */
157 int opcode; /* java opcode */
158 int i; /* temporary for different uses (ctrs)*/
159 int ipc = 0; /* intermediate instruction counter */
160 int b_count = 0; /* basic block counter */
161 int s_count = 0; /* stack element counter */
162 bool blockend = false; /* true if basic block end has been reached */
163 bool iswide = false; /* true if last instruction was a wide*/
164 instruction *iptr; /* current ptr into instruction array */
165 int gp; /* global java instruction counter */
167 u1 *instructionstart; /* 1 for pcs which are valid instr. starts */
169 constant_classref *cr;
170 constant_classref *compr;
172 builtintable_entry *bte;
178 /* get required compiler data */
183 /* allocate instruction array and block index table */
185 /* 1 additional for end ipc */
186 m->basicblockindex = DMNEW(s4, m->jcodelength + 1);
187 memset(m->basicblockindex, 0, sizeof(s4) * (m->jcodelength + 1));
189 instructionstart = DMNEW(u1, m->jcodelength + 1);
190 memset(instructionstart, 0, sizeof(u1) * (m->jcodelength + 1));
192 /* 1 additional for TRACEBUILTIN and 4 for MONITORENTER/EXIT */
193 /* additional MONITOREXITS are reached by branches which are 3 bytes */
195 iptr = m->instructions = DMNEW(instruction, m->jcodelength + 5);
197 /* Zero the intermediate instructions array so we don't have any
198 * invalid pointers in it if we cannot finish analyse_stack(). */
200 memset(iptr, 0, sizeof(instruction) * (m->jcodelength + 5));
202 /* compute branch targets of exception table */
205 &(cd->exceptiontable[cd->exceptiontablelength-1]),
207 m->exceptiontablelength,
213 s_count = 1 + m->exceptiontablelength; /* initialize stack element counter */
215 #if defined(USE_THREADS)
216 if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
217 m->isleafmethod = false;
221 /* scan all java instructions */
225 if (m->linenumbercount == 0) {
229 linepcchange = m->linenumbers[0].start_pc;
232 for (p = 0, gp = 0; p < m->jcodelength; gp += (nextp - p), p = nextp) {
234 /* mark this position as a valid instruction start */
236 instructionstart[gp] = 1;
237 if (linepcchange==p) {
238 if (m->linenumbercount > lineindex) {
239 currentline = m->linenumbers[lineindex].line_number;
241 if (lineindex < m->linenumbercount)
242 linepcchange = m->linenumbers[lineindex].start_pc;
247 /* fetch next opcode */
249 opcode = code_get_u1(p, m);
251 m->basicblockindex[gp] |= (ipc << 1); /*store intermed cnt*/
253 /* some compilers put a JAVA_NOP after a blockend instruction */
255 if ((opcode != JAVA_NOP) && (blockend == true)) {
256 /* start new block */
262 nextp = p + jcommandsize[opcode]; /* compute next instruction start */
264 CHECK_END_OF_BYTECODE(nextp);
266 s_count += stackreq[opcode]; /* compute stack element count */
271 /* pushing constants onto the stack p */
274 LOADCONST_I(code_get_s1(p+1,m));
278 LOADCONST_I(code_get_s2(p+1,m));
282 i = code_get_u1(p + 1, m);
283 goto pushconstantitem;
287 i = code_get_u2(p + 1, m);
291 if (i >= m->class->cpcount) {
292 *exceptionptr = new_verifyerror(m,
293 "Attempt to access constant outside range");
297 switch (m->class->cptags[i]) {
298 case CONSTANT_Integer:
299 LOADCONST_I(((constant_integer *) (m->class->cpinfos[i]))->value);
302 LOADCONST_L(((constant_long *) (m->class->cpinfos[i]))->value);
305 LOADCONST_F(((constant_float *) (m->class->cpinfos[i]))->value);
307 case CONSTANT_Double:
308 LOADCONST_D(((constant_double *) (m->class->cpinfos[i]))->value);
310 case CONSTANT_String:
311 LOADCONST_A(literalstring_new((utf *) (m->class->cpinfos[i])));
314 cr = (constant_classref *) (m->class->cpinfos[i]);
316 if (!resolve_classref(m, cr, resolveLazy, true,
320 /* if not resolved, c == NULL */
322 LOADCONST_A_CLASS(c, cr);
325 *exceptionptr = new_verifyerror(m,
326 "Invalid constant type to push");
331 case JAVA_ACONST_NULL:
342 LOADCONST_I(opcode - JAVA_ICONST_0);
347 LOADCONST_L(opcode - JAVA_LCONST_0);
353 LOADCONST_F(opcode - JAVA_FCONST_0);
358 LOADCONST_D(opcode - JAVA_DCONST_0);
361 /* loading variables onto the stack */
369 i = code_get_u1(p + 1,m);
372 i = code_get_u2(p + 1,m);
383 OP1LOAD(ICMD_ILOAD, opcode - JAVA_ILOAD_0);
390 OP1LOAD(ICMD_LLOAD, opcode - JAVA_LLOAD_0);
397 OP1LOAD(ICMD_FLOAD, opcode - JAVA_FLOAD_0);
404 OP1LOAD(ICMD_DLOAD, opcode - JAVA_DLOAD_0);
411 OP1LOAD(ICMD_ALOAD, opcode - JAVA_ALOAD_0);
414 /* storing stack values into local variables */
422 i = code_get_u1(p + 1,m);
425 i = code_get_u2(p + 1,m);
436 OP1STORE(ICMD_ISTORE, opcode - JAVA_ISTORE_0);
443 OP1STORE(ICMD_LSTORE, opcode - JAVA_LSTORE_0);
450 OP1STORE(ICMD_FSTORE, opcode - JAVA_FSTORE_0);
457 OP1STORE(ICMD_DSTORE, opcode - JAVA_DSTORE_0);
464 OP1STORE(ICMD_ASTORE, opcode - JAVA_ASTORE_0);
472 i = code_get_u1(p + 1,m);
473 v = code_get_s1(p + 2,m);
477 i = code_get_u2(p + 1,m);
478 v = code_get_s2(p + 3,m);
487 /* wider index for loading, storing and incrementing */
494 /* managing arrays ****************************************************/
497 switch (code_get_s1(p + 1, m)) {
499 bte = builtintable_get_internal(BUILTIN_newarray_boolean);
502 bte = builtintable_get_internal(BUILTIN_newarray_char);
505 bte = builtintable_get_internal(BUILTIN_newarray_float);
508 bte = builtintable_get_internal(BUILTIN_newarray_double);
511 bte = builtintable_get_internal(BUILTIN_newarray_byte);
514 bte = builtintable_get_internal(BUILTIN_newarray_short);
517 bte = builtintable_get_internal(BUILTIN_newarray_int);
520 bte = builtintable_get_internal(BUILTIN_newarray_long);
523 *exceptionptr = new_verifyerror(m,
524 "Invalid array-type to create");
527 BUILTIN(bte, true, NULL, currentline);
531 i = code_get_u2(p + 1, m);
532 compr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
536 if (!(cr = class_get_classref_multiarray_of(1, compr)))
539 if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
542 LOADCONST_A_BUILTIN(c, cr);
543 bte = builtintable_get_internal(BUILTIN_newarray);
544 BUILTIN(bte, true, NULL, currentline);
548 case JAVA_MULTIANEWARRAY:
549 m->isleafmethod = false;
550 i = code_get_u2(p + 1, m);
552 s4 v = code_get_u1(p + 3, m);
554 cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
558 if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
561 /* if unresolved, c == NULL */
562 OP2AT(opcode, v, c, cr, currentline);
584 i = p + code_get_s2(p + 1,m);
585 CHECK_BYTECODE_INDEX(i);
593 i = p + code_get_s4(p + 1,m);
594 CHECK_BYTECODE_INDEX(i);
602 i = code_get_u1(p + 1,m);
605 i = code_get_u2(p + 1,m);
621 /* zero val.a so no patcher is inserted */
622 /* the type checker may set this later */
629 /* zero val.a so no patcher is inserted */
630 /* the type checker may set this later */
636 /* table jumps ********************************************************/
638 case JAVA_LOOKUPSWITCH:
642 #if defined(ENABLE_VERIFIER)
647 nextp = ALIGN((p + 1), 4);
649 CHECK_END_OF_BYTECODE(nextp + 8);
651 tablep = (s4 *) (m->jcode + nextp);
653 OP2A(opcode, 0, tablep, currentline);
657 j = p + code_get_s4(nextp, m);
658 *tablep = j; /* restore for little endian */
661 CHECK_BYTECODE_INDEX(j);
664 /* number of pairs */
666 num = code_get_u4(nextp, m);
671 CHECK_END_OF_BYTECODE(nextp + 8 * num);
673 for (i = 0; i < num; i++) {
676 j = code_get_s4(nextp, m);
677 *tablep = j; /* restore for little endian */
681 #if defined(ENABLE_VERIFIER)
682 /* check if the lookup table is sorted correctly */
684 if (i && (j <= prevvalue)) {
685 *exceptionptr = new_verifyerror(m, "Unsorted lookup switch");
693 j = p + code_get_s4(nextp,m);
694 *tablep = j; /* restore for little endian */
697 CHECK_BYTECODE_INDEX(j);
705 case JAVA_TABLESWITCH:
711 nextp = ALIGN((p + 1), 4);
713 CHECK_END_OF_BYTECODE(nextp + 12);
715 tablep = (s4 *) (m->jcode + nextp);
717 OP2A(opcode, 0, tablep, currentline);
721 j = p + code_get_s4(nextp, m);
722 *tablep = j; /* restore for little endian */
725 CHECK_BYTECODE_INDEX(j);
730 j = code_get_s4(nextp, m);
731 *tablep = j; /* restore for little endian */
737 num = code_get_s4(nextp, m);
738 *tablep = num; /* restore for little endian */
742 num -= j; /* difference of upper - lower */
744 #if defined(ENABLE_VERIFIER)
746 *exceptionptr = new_verifyerror(m,
747 "invalid TABLESWITCH: upper bound < lower bound");
752 CHECK_END_OF_BYTECODE(nextp + 4 * (num + 1));
754 for (i = 0; i <= num; i++) {
755 j = p + code_get_s4(nextp,m);
756 *tablep = j; /* restore for little endian */
759 CHECK_BYTECODE_INDEX(j);
767 /* load and store of object fields ************************************/
771 m->isleafmethod = false;
780 unresolved_field *uf;
783 i = code_get_u2(p + 1, m);
784 fr = class_getconstant(m->class, i,
789 OP2A_NOINC(opcode, fr->parseddesc.fd->type, fr, currentline);
791 if (!(uf = create_unresolved_field(m->class,
796 /* store unresolved_field pointer */
800 /* only with -noverify, otherwise the typechecker does this */
803 if (!resolve_field(uf, resolveLazy, &fi))
817 /* method invocation **************************************************/
819 case JAVA_INVOKESTATIC:
820 i = code_get_u2(p + 1, m);
824 unresolved_method *um;
827 m->isleafmethod = false;
829 mr = class_getconstant(m->class, i,
834 md = mr->parseddesc.md;
837 if (!descriptor_params_from_paramtypes(md, ACC_STATIC))
840 OP2A_NOINC(opcode, 0, mr, currentline);
842 um = create_unresolved_method(m->class,
848 /* store the unresolved_method pointer */
852 /* only with -noverify, otherwise the typechecker does this */
855 if (!resolve_method(um, resolveLazy, &mi))
867 case JAVA_INVOKESPECIAL:
868 case JAVA_INVOKEVIRTUAL:
872 unresolved_method *um;
875 m->isleafmethod = false;
877 i = code_get_u2(p + 1, m);
878 mr = class_getconstant(m->class, i,
883 md = mr->parseddesc.md;
886 if (!descriptor_params_from_paramtypes(md, 0))
889 OP2A_NOINC(opcode, 0, mr, currentline);
891 um = create_unresolved_method(m->class,
897 /* store the unresolved_method* */
901 /* only with -noverify, otherwise the typechecker does this */
904 if (!resolve_method(um, resolveLazy, &mi))
916 case JAVA_INVOKEINTERFACE:
917 i = code_get_u2(p + 1, m);
921 unresolved_method *um;
924 m->isleafmethod = false;
926 mr = class_getconstant(m->class, i,
927 CONSTANT_InterfaceMethodref);
931 md = mr->parseddesc.md;
934 if (!descriptor_params_from_paramtypes(md, 0))
937 OP2A_NOINC(opcode, 0, mr, currentline);
939 um = create_unresolved_method(m->class,
945 /* store the unresolved_method* */
949 /* only with -noverify, otherwise the typechecker does this */
952 if (!resolve_method(um, resolveLazy, &mi))
964 /* miscellaneous object operations ************************************/
967 i = code_get_u2(p + 1, m);
968 cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
972 if (!resolve_classref(m, cr, resolveLazy, true, true,
976 LOADCONST_A_BUILTIN(c, cr);
977 bte = builtintable_get_internal(BUILTIN_new);
978 BUILTIN(bte, true, NULL, currentline);
983 i = code_get_u2(p + 1, m);
984 cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
988 if (!resolve_classref(m, cr, resolveLazy, true,
992 if (cr->name->text[0] == '[') {
993 /* array type cast-check */
994 OP2AT(opcode, 0, c, cr, currentline);
995 m->isleafmethod = false;
999 /* object type cast-check */
1000 OP2AT(opcode, 1, c, cr, currentline);
1004 case JAVA_INSTANCEOF:
1005 i = code_get_u2(p + 1,m);
1006 cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
1010 if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
1013 if (cr->name->text[0] == '[') {
1014 /* array type cast-check */
1015 LOADCONST_A_BUILTIN(c, cr);
1016 bte = builtintable_get_internal(BUILTIN_arrayinstanceof);
1017 BUILTIN(bte, false, NULL, currentline);
1022 /* object type cast-check */
1023 OP2AT(opcode, 1, c, cr, currentline);
1027 case JAVA_MONITORENTER:
1028 #if defined(USE_THREADS)
1031 bte = builtintable_get_internal(BUILTIN_monitorenter);
1032 BUILTIN(bte, false, NULL, currentline);
1042 case JAVA_MONITOREXIT:
1043 #if defined(USE_THREADS)
1045 bte = builtintable_get_internal(BUILTIN_monitorexit);
1046 BUILTIN(bte, false, NULL, currentline);
1055 /* any other basic operation ******************************************/
1058 #if !SUPPORT_DIVISION
1059 bte = builtintable_get_internal(BUILTIN_idiv);
1060 OP2A(opcode, bte->md->paramcount, bte, currentline);
1061 m->isleafmethod = false;
1068 #if !SUPPORT_DIVISION
1069 bte = builtintable_get_internal(BUILTIN_irem);
1070 OP2A(opcode, bte->md->paramcount, bte, currentline);
1071 m->isleafmethod = false;
1078 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1079 bte = builtintable_get_internal(BUILTIN_ldiv);
1080 OP2A(opcode, bte->md->paramcount, bte, currentline);
1081 m->isleafmethod = false;
1088 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1089 bte = builtintable_get_internal(BUILTIN_lrem);
1090 OP2A(opcode, bte->md->paramcount, bte, currentline);
1091 m->isleafmethod = false;
1098 #if defined(__I386__)
1101 bte = builtintable_get_internal(BUILTIN_frem);
1102 BUILTIN(bte, false, NULL, currentline);
1107 #if defined(__I386__)
1110 bte = builtintable_get_internal(BUILTIN_drem);
1111 BUILTIN(bte, false, NULL, currentline);
1116 #if defined(__ALPHA__)
1118 bte = builtintable_get_internal(BUILTIN_f2i);
1119 BUILTIN(bte, false, NULL, currentline);
1129 #if defined(__ALPHA__)
1131 bte = builtintable_get_internal(BUILTIN_f2l);
1132 BUILTIN(bte, false, NULL, currentline);
1142 #if defined(__ALPHA__)
1144 bte = builtintable_get_internal(BUILTIN_d2i);
1145 BUILTIN(bte, false, NULL, currentline);
1155 #if defined(__ALPHA__)
1157 bte = builtintable_get_internal(BUILTIN_d2l);
1158 BUILTIN(bte, false, NULL, currentline);
1167 case JAVA_BREAKPOINT:
1169 new_verifyerror(m, "Quick instructions shouldn't appear yet.");
1172 case 186: /* unused opcode */
1227 new_verifyerror(m,"Illegal opcode %d at instr %d\n",
1238 /* If WIDE was used correctly, iswide should have been reset by now. */
1239 if (iswide && opcode != JAVA_WIDE) {
1240 *exceptionptr = new_verifyerror(m,
1241 "Illegal instruction: WIDE before incompatible opcode");
1247 if (p != m->jcodelength) {
1248 printf("p (%d) != m->jcodelength (%d)\n",p,m->jcodelength);
1249 *exceptionptr = new_verifyerror(m,
1250 "Command-sequence crosses code-boundary");
1255 *exceptionptr = new_verifyerror(m, "Falling off the end of the code");
1259 /* adjust block count if target 0 is not first intermediate instruction */
1261 if (!m->basicblockindex[0] || (m->basicblockindex[0] > 1))
1264 /* copy local to method variables */
1266 m->instructioncount = ipc;
1267 m->basicblockcount = b_count;
1268 m->stackcount = s_count + m->basicblockcount * m->maxstack;
1270 /* allocate stack table */
1272 m->stack = DMNEW(stackelement, m->stackcount);
1277 bptr = m->basicblocks = DMNEW(basicblock, b_count + 1); /* one more for end ipc */
1282 /* additional block if target 0 is not first intermediate instruction */
1284 if (!m->basicblockindex[0] || (m->basicblockindex[0] > 1)) {
1285 BASICBLOCK_INIT(bptr,m);
1287 bptr->iinstr = m->instructions;
1288 /* bptr->icount is set when the next block is allocated */
1292 bptr[-1].next = bptr;
1295 /* allocate blocks */
1297 for (p = 0; p < m->jcodelength; p++) {
1298 if (m->basicblockindex[p] & 1) {
1299 /* Check if this block starts at the beginning of an */
1302 if (!instructionstart[p]) {
1303 *exceptionptr = new_verifyerror(m,
1304 "Branch into middle of instruction");
1308 /* allocate the block */
1310 BASICBLOCK_INIT(bptr,m);
1312 bptr->iinstr = m->instructions + (m->basicblockindex[p] >> 1);
1314 bptr[-1].icount = bptr->iinstr - bptr[-1].iinstr;
1316 /* bptr->icount is set when the next block is allocated */
1318 m->basicblockindex[p] = b_count;
1322 bptr[-1].next = bptr;
1326 /* set instruction count of last real block */
1329 bptr[-1].icount = (m->instructions + m->instructioncount) - bptr[-1].iinstr;
1332 /* allocate additional block at end */
1334 BASICBLOCK_INIT(bptr,m);
1336 bptr->instack = bptr->outstack = NULL;
1337 bptr->indepth = bptr->outdepth = 0;
1338 bptr->iinstr = NULL;
1342 /* set basicblock pointers in exception table */
1344 if (cd->exceptiontablelength > 0) {
1345 cd->exceptiontable[cd->exceptiontablelength - 1].down = NULL;
1348 for (i = 0; i < cd->exceptiontablelength; ++i) {
1349 p = cd->exceptiontable[i].startpc;
1350 cd->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
1352 p = cd->exceptiontable[i].endpc;
1353 cd->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount /*+ 1*/) : (m->basicblocks + m->basicblockindex[p]);
1355 p = cd->exceptiontable[i].handlerpc;
1356 cd->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
1359 /* XXX activate this if you want to try inlining */
1361 for (i = 0; i < m->exceptiontablelength; ++i) {
1362 p = m->exceptiontable[i].startpc;
1363 m->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
1365 p = m->exceptiontable[i].endpc;
1366 m->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount /*+ 1*/) : (m->basicblocks + m->basicblockindex[p]);
1368 p = m->exceptiontable[i].handlerpc;
1369 m->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
1375 /* everything's ok */
1379 #if defined(ENABLE_VERIFIER)
1381 throw_unexpected_end_of_bytecode:
1382 *exceptionptr = new_verifyerror(m, "Unexpected end of bytecode");
1385 throw_invalid_bytecode_index:
1387 new_verifyerror(m, "Illegal target of branch instruction");
1390 throw_illegal_local_variable_number:
1392 new_verifyerror(m, "Illegal local variable number");
1395 #endif /* ENABLE_VERIFIER */
1400 * These are local overrides for various environment variables in Emacs.
1401 * Please do not remove this and leave it at the end of the file, where
1402 * Emacs will automagically detect them.
1403 * ---------------------------------------------------------------------
1406 * indent-tabs-mode: t
1410 * vim:noexpandtab:sw=4:ts=4: