// -----------------------------------------------------------------------------
// DAnalyzeToolDevice::Create()
// Creates the logical channel.
// -----------------------------------------------------------------------------
//
TInt DAnalyzeToolDevice::Create( DLogicalChannelBase*& aChannel )
{
    LOGSTR1( "ATDD DAnalyzeToolDevice::Create()" );

    // create new channel
    aChannel = new DAnalyzeToolChannel;

    // check that everything is OK
    return ( aChannel != NULL ) ? KErrNone : KErrNoMemory;
}
// -----------------------------------------------------------------------------
// DECLARE_STANDARD_LDD
// Defines the entry point for a standard logical device driver (LDD),
// and declares the ordinal 1 export function for creating
// the LDD factory object
// -----------------------------------------------------------------------------
//
DECLARE_STANDARD_LDD()
{
    LOGSTR1( "ATDD DECLARE_STANDARD_LDD()" );
    return new DAnalyzeToolDevice;
}
// -----------------------------------------------------------------------------
// DAnalyzeToolDevice::GetCaps()
// Gets the driver's capabilities.
// -----------------------------------------------------------------------------
//
void DAnalyzeToolDevice::GetCaps( TDes8& /*aDes*/ ) const
{
    LOGSTR1( "ATDD DAnalyzeToolDevice::GetCaps()" );
}
// -----------------------------------------------------------------------------
// DAnalyzeToolDevice::Install()
// Second stage constructor.
// -----------------------------------------------------------------------------
//
TInt DAnalyzeToolDevice::Install()
{
    LOGSTR1( "ATDD DAnalyzeToolDevice::Install()" );
    // Set device name
    return SetName( &KAnalyzeToolLddName );
}
// -----------------------------------------------------------------------------
// DAnalyzeToolDevice::DAnalyzeToolDevice()
// C++ default constructor.
// -----------------------------------------------------------------------------
//
DAnalyzeToolDevice::DAnalyzeToolDevice()
{
    LOGSTR1( "ATDD DAnalyzeToolDevice::DAnalyzeToolDevice()" );
    // Set version number
    iVersion = KAnalyzeToolLddVersion();
}
Beispiel #6
0
static bool
handle_basic_block(verifier_state *state)
{
    int opcode;                                      /* current opcode */
    int len;                        /* for counting instructions, etc. */
    bool superblockend;        /* true if no fallthrough to next block */
	instruction *iptr;                      /* the current instruction */
    basicblock *tbptr;                   /* temporary for target block */
    bool maythrow;               /* true if this instruction may throw */
	s4 i;
	typecheck_result r;
	branch_target_t *table;
	lookup_target_t *lookup;
	jitdata *jd = state->jd;
	exception_entry *ex;
	varinfo constvalue;                               /* for PUT*CONST */
	constant_FMIref *fieldref;

	LOGSTR1("\n---- BLOCK %04d ------------------------------------------------\n",state->bptr->nr);
	LOGFLUSH;

	superblockend = false;
	state->bptr->flags = BBFINISHED;

	/* prevent compiler warnings */


	/* determine the active exception handlers for this block */
	/* XXX could use a faster algorithm with sorted lists or  */
	/* something?                                             */
	len = 0;
	for (ex = state->jd->exceptiontable; ex ; ex = ex->down) {
		if ((ex->start->nr <= state->bptr->nr) && (ex->end->nr > state->bptr->nr)) {
			LOG1("active handler L%03d", ex->handler->nr);
			state->handlers[len++] = ex;
		}
	}
	state->handlers[len] = NULL;

	/* init variable types at the start of this block */
	typevector_copy_inplace(state->bptr->inlocals, jd->var, state->numlocals);

	DOLOG(show_basicblock(jd, state->bptr, SHOW_STACK));
	DOLOG(typecheck_print_vararray(stdout, jd, state->bptr->invars, 
				state->bptr->indepth));
	DOLOG(typevector_print(stdout, jd->var, state->numlocals));
	LOGNL; LOGFLUSH;

	/* loop over the instructions */
	len = state->bptr->icount;
	state->iptr = state->bptr->iinstr;
	while (--len >= 0)  {
		TYPECHECK_COUNT(stat_ins);

		iptr = state->iptr;

		DOLOG(typevector_print(stdout, jd->var, state->numlocals));
		LOGNL; LOGFLUSH;
		DOLOG(show_icmd(jd, state->iptr, false, SHOW_STACK)); LOGNL; LOGFLUSH;

		opcode = iptr->opc;
		maythrow = false;

		switch (opcode) {

			/* include generated code for ICMDs verification */

#define TYPECHECK_VARIABLESBASED
#define STATE  state
#define METHOD (state->m)
#define IPTR   iptr
#define BPTR   (state->bptr)
#include <typecheck-variablesbased-gen.inc>
#undef  STATE
#undef  METHOD
#undef  IPTR
#undef  BPTR
#undef  TYPECHECK_VARIABLESBASED

			default:
				LOG1("ICMD %d\n", opcode);
				TYPECHECK_VERIFYERROR_bool("Missing ICMD code during typecheck");
		}

		/* reach exception handlers for this instruction */

		if (maythrow) {
			TYPECHECK_COUNT(stat_ins_maythrow);
			TYPECHECK_MARK(state->stat_maythrow);
			LOG("reaching exception handlers");
			i = 0;
			while (state->handlers[i]) {
				TYPECHECK_COUNT(stat_handlers_reached);
				if (state->handlers[i]->catchtype.any)
					VAR(state->exinvars)->typeinfo.typeclass = state->handlers[i]->catchtype;
				else
					VAR(state->exinvars)->typeinfo.typeclass.cls = class_java_lang_Throwable;
				if (!typestate_reach(state,
						state->handlers[i]->handler,
						&(state->exinvars), jd->var, 1))
					return false;
				i++;
			}
		}

		LOG("\t\tnext instruction");
		state->iptr++;
	} /* while instructions */

	LOG("instructions done");
	LOGSTR("RESULT=> ");
	DOLOG(typecheck_print_vararray(stdout, jd, state->bptr->outvars,
				state->bptr->outdepth));
	DOLOG(typevector_print(stdout, jd->var, state->numlocals));
	LOGNL; LOGFLUSH;

	/* propagate stack and variables to the following block */
	if (!superblockend) {
		LOG("reaching following block");
		tbptr = state->bptr->next;
		while (tbptr->flags == BBDELETED) {
			tbptr = tbptr->next;
#ifdef TYPECHECK_DEBUG
			/* this must be checked in parse.c */
			if ((tbptr->nr) >= state->basicblockcount)
				TYPECHECK_VERIFYERROR_bool("Control flow falls off the last block");
#endif
		}
		if (!typestate_reach(state,tbptr,state->bptr->outvars, jd->var,
					state->bptr->outdepth))
			return false;
	}

	/* We may have to restore the types of the instack slots. They
	 * have been saved if an <init> call inside the block has
	 * modified the instack types. (see INVOKESPECIAL) */

	if (state->savedinvars)
		typestate_restore_invars(state);

	return true;
}