46 #ifdef TYPECHECK_VERBOSE_OPT
47 bool opt_typecheckverbose =
false;
50 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
56 assert(index >= 0 && index < jd->varcount);
61 void typecheck_print_vararray(FILE *file,
jitdata *jd,
s4 *vars,
int len)
65 for (i=0; i<len; ++
i) {
68 typecheck_print_var(file, jd, *vars++);
79 #if defined(TYPECHECK_STATISTICS)
80 #warning port to new statistics framework
81 int stat_typechecked = 0;
82 int stat_methods_with_handlers = 0;
83 int stat_methods_maythrow = 0;
84 int stat_iterations[STAT_ITERATIONS+1] = { 0 };
88 int stat_merging_changed = 0;
89 int stat_blocks[STAT_BLOCKS+1] = { 0 };
90 int stat_locals[STAT_LOCALS+1] = { 0 };
92 int stat_ins_maythrow = 0;
93 int stat_ins_stack = 0;
94 int stat_ins_field = 0;
95 int stat_ins_field_unresolved = 0;
96 int stat_ins_field_uninitialized = 0;
97 int stat_ins_invoke = 0;
98 int stat_ins_invoke_unresolved = 0;
99 int stat_ins_primload = 0;
100 int stat_ins_aload = 0;
101 int stat_ins_builtin = 0;
102 int stat_ins_builtin_gen = 0;
103 int stat_ins_branch = 0;
104 int stat_ins_switch = 0;
105 int stat_ins_primitive_return = 0;
106 int stat_ins_areturn = 0;
107 int stat_ins_areturn_unresolved = 0;
108 int stat_ins_athrow = 0;
109 int stat_ins_athrow_unresolved = 0;
110 int stat_ins_unchecked = 0;
111 int stat_handlers_reached = 0;
112 int stat_savedstack = 0;
114 static void print_freq(FILE *file,
int *array,
int limit)
117 for (i=0; i<limit; ++
i)
118 fprintf(file,
" %3d: %8d\n",i,array[i]);
119 fprintf(file,
" >=%3d: %8d\n",limit,array[limit]);
122 void typecheck_print_statistics(FILE *file) {
123 fprintf(file,
"typechecked methods: %8d\n",stat_typechecked);
124 fprintf(file,
" with handler(s): %8d\n",stat_methods_with_handlers);
125 fprintf(file,
" with throw(s) : %8d\n",stat_methods_maythrow);
126 fprintf(file,
"reached blocks : %8d\n",stat_reached);
127 fprintf(file,
"copied states : %8d\n",stat_copied);
128 fprintf(file,
"merged states : %8d\n",stat_merged);
129 fprintf(file,
"merging changed : %8d\n",stat_merging_changed);
130 fprintf(file,
"handlers reached : %8d\n",stat_handlers_reached);
131 fprintf(file,
"saved stack (times): %8d\n",stat_savedstack);
132 fprintf(file,
"instructions : %8d\n",stat_ins);
133 fprintf(file,
" stack : %8d\n",stat_ins_stack);
134 fprintf(file,
" field access : %8d\n",stat_ins_field);
135 fprintf(file,
" (unresolved) : %8d\n",stat_ins_field_unresolved);
136 fprintf(file,
" (uninit.) : %8d\n",stat_ins_field_uninitialized);
137 fprintf(file,
" invocations : %8d\n",stat_ins_invoke);
138 fprintf(file,
" (unresolved) : %8d\n",stat_ins_invoke_unresolved);
139 fprintf(file,
" load primitive : (currently not counted) %8d\n",stat_ins_primload);
140 fprintf(file,
" load address : %8d\n",stat_ins_aload);
141 fprintf(file,
" builtins : %8d\n",stat_ins_builtin);
142 fprintf(file,
" generic : %8d\n",stat_ins_builtin_gen);
143 fprintf(file,
" branches : %8d\n",stat_ins_branch);
144 fprintf(file,
" switches : %8d\n",stat_ins_switch);
145 fprintf(file,
" prim. return : %8d\n",stat_ins_primitive_return);
146 fprintf(file,
" areturn : %8d\n",stat_ins_areturn);
147 fprintf(file,
" (unresolved) : %8d\n",stat_ins_areturn_unresolved);
148 fprintf(file,
" athrow : %8d\n",stat_ins_athrow);
149 fprintf(file,
" (unresolved) : %8d\n",stat_ins_athrow_unresolved);
150 fprintf(file,
" unchecked : %8d\n",stat_ins_unchecked);
151 fprintf(file,
" maythrow : %8d\n",stat_ins_maythrow);
152 fprintf(file,
"iterations used:\n");
153 print_freq(file,stat_iterations,STAT_ITERATIONS);
154 fprintf(file,
"basic blocks per method / 10:\n");
156 fprintf(file,
"locals:\n");
181 #ifdef TYPECHECK_DEBUG
192 if (block->
state >= minstate) {
217 #ifdef TYPECHECK_DEBUG
226 OLD_LOG2(
"block L%03d has invalid state after typecheck: %d",
278 for (i=0; i < n; ++
i, ++srcvars, ++dstvars) {
318 bool changed =
false;
320 for (i=0; i < n; ++
i, ++srcvars, ++dstvars) {
377 bool changed =
false;
423 bool changed =
false;
426 OLD_LOG1(
"reaching block L%03d",destblock->
nr);
435 OLD_LOG1(
"block L%03d reached first time",destblock->
nr);
446 OLD_LOG1(
"block L%03d reached before", destblock->
nr);
459 if (destblock->
nr <= state->
bptr->
nr) {
514 v = locals + varindex;
525 OLD_LOG(
"'this' argument set.\n");
void exceptions_throw_verifyerror(methodinfo *m, const char *message,...)
typecheck_result typecheck_merge_types(verifier_state *state, s4 *srcvars, s4 *dstvars, s4 n)
#define OLD_LOG2(str, a, b)
State
State of block during stack analysis.
bool typeinfo_init_varinfos_from_methoddesc(varinfo *vars, methoddesc *desc, int buflen, int startindex, s4 *map, typedescriptor_t *returntype)
#define TYPECHECK_COUNT(cnt)
void init_class(classinfo *c)
Initialize object type.
void init_newobject(instruction *instr)
void typecheck_init_state(verifier_state *state, basicblock::State minstate)
bool typecheck_init_locals(verifier_state *state, bool newthis)
#define OLD_LOGSTR1(str, a)
typecheck_result typestate_merge(verifier_state *state, s4 *srcvars, varinfo *srclocals, s4 *dstvars, varinfo *dstlocals, s4 n)
#define TYPECHECK_ASSERT(cond)
typecheck_result typevector_merge(methodinfo *m, varinfo *dst, varinfo *y, int size)
typecheck_result merge(methodinfo *m, const typeinfo_t *t)
functions for merging types
static void print_freq(FILE *file, int *array, int limit)
void typecheck_reset_state(verifier_state *state)
void typeinfo_print_type(FILE *file, int type, const typeinfo_t *info)
#define TYPECHECK_VERIFYERROR_bool(msg)
void typevector_copy_inplace(varinfo *src, varinfo *dst, int size)
bool is_primitive() const
void params_from_paramtypes(s4 mflags)
bool typecheck_copy_types(verifier_state *state, s4 *srcvars, s4 *dstvars, s4 n)
#define TYPECHECK_COUNTIF(cond, cnt)
typedescriptor_t returntype
bool typestate_reach(verifier_state *state, basicblock *destblock, s4 *srcvars, varinfo *srclocals, s4 n)
static void clone(const typeinfo_t &src, typeinfo_t &dst)