+/* parserdata_t ***************************************************************/
+
+typedef struct parsedata_t parsedata_t;
+
+struct parsedata_t {
+ instruction *instructions; /* instruction array */
+ s4 instructionslength; /* length of the instruction array */
+ u1 *instructionstart;
+};
+
+
+/* parse_setup *****************************************************************
+
+ Fills the passed parsedata_t structure.
+
+*******************************************************************************/
+
+static void parse_setup(jitdata *jd, parsedata_t *pd)
+{
+ methodinfo *m;
+
+ /* get required compiler data */
+
+ m = jd->m;
+
+ /* Allocate instruction array and block index table (1 additional
+ for end ipc). */
+
+ jd->basicblockindex = DMNEW(s4, m->jcodelength + 1);
+ pd->instructionstart = DMNEW(u1, m->jcodelength + 1);
+
+ MZERO(jd->basicblockindex, s4, m->jcodelength + 1);
+ MZERO(pd->instructionstart, u1, m->jcodelength + 1);
+
+ /* Set the length of the instruction array. We simply add 5 more
+ instruction, as this seems to be a reasonable value. */
+
+ pd->instructionslength = m->jcodelength + 1;
+
+ /* allocate the instruction array */
+
+ pd->instructions = DMNEW(instruction, pd->instructionslength);
+
+ /* Zero the intermediate instructions array so we don't have any
+ invalid pointers in it if we cannot finish stack_analyse(). */
+
+ MZERO(pd->instructions, instruction, pd->instructionslength);
+}
+
+
+/* parse_realloc_instructions **************************************************
+
+ Reallocate the instructions array so there is room for at least N
+ additional instructions.
+
+ RETURN VALUE:
+ the new value for iptr
+
+*******************************************************************************/
+
+static instruction *parse_realloc_instructions(parsedata_t *pd, s4 ipc, s4 n)
+{
+ /* increase the size of the instruction array */
+
+ pd->instructionslength += (n + INSTRUCTIONS_INCREMENT);
+
+ /* reallocate the array */
+
+ pd->instructions = DMREALLOC(pd->instructions, instruction, ipc,
+ pd->instructionslength);
+
+ /* return the iptr */
+
+ return pd->instructions + ipc;
+}
+
+
+/* parse_mark_exception_boundaries *********************************************
+
+ Mark exception handlers and the boundaries of the handled regions as
+ basic block boundaries.
+
+ IN:
+ jd...............current jitdata
+
+ RETURN VALUE:
+ >= 0.............the number of new basic blocks marked
+ -1...............an exception has been thrown