check_code.c revision 2362
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A#include "classfile_constants.h"
0N/Aint verify_verbose = 0;
1884N/Atypedef unsigned int fullinfo_type;
0N/Atypedef struct hash_bucket_type {
0N/A int entries_used;
2109N/Atypedef struct alloc_stack_type {
0N/Astruct context_type {
3229N/A int alloc_stack_top;
0N/A unsigned char *constant_types;
1601N/A int field_index;
0N/A char *CCfree_ptr;
0N/A int CCfree_size;
0N/A int n_globalrefs;
0N/Astruct stack_info_type {
0N/A int stack_size;
0N/Astruct register_info_type {
0N/Astruct instruction_data_type {
0N/Astruct handler_info_type {
2842N/Astruct stack_item_type {
unsigned char** code);
unsigned int from_inumber,
unsigned int inumber,
unsigned int to_inumber,
unsigned int to_inumber,
fullinfo_type b);
#ifdef DEBUG
#ifdef DEBUG
static hash_bucket_type *
if (i >= MAX_HASH_ENTRIES)
class_hash_fun(const char *s)
unsigned raw_hash;
return raw_hash;
if (cb == 0)
return cb;
if (global == 0)
#ifdef DEBUG
return global;
unsigned int hash;
unsigned short *pID;
while (*pID) {
goto done;
#ifdef DEBUG
done:
return *pID;
unsigned short *pID;
while (*pID) {
goto done;
if (force_load) {
return id;
done:
return *pID;
static jclass
static fullinfo_type
static fullinfo_type
static fullinfo_type
#define CC_VerifyError 0
int num_methods;
int* code_lengths;
unsigned char** code;
#ifdef DEBUG
if (super != 0) {
while(super != 0) {
super = 0;
if (gptr == 0) {
while(super != 0) {
*gptr = 0;
#ifdef DEBUG
GlobalContext = 0;
#ifdef DEBUG
return result;
static int warned = 0;
if (!warned) {
int* lengths;
unsigned char** code;
for (i = 0; i < num_methods; ++i) {
if (lengths[i] > 0) {
for (i = 0; i < num_methods; ++i) {
int *code_data;
int instruction_count;
int i, offset;
unsigned int inumber;
#ifdef DEBUG
if (verify_verbose) {
const char *methodname =
const char *signature =
if (length <= 0)
if (instruction_count == 0)
for (i = 0; i < nexceptions; i++) {
int var;
switch (opcode) {
case JVM_OPC_jsr:
case JVM_OPC_goto: {
case JVM_OPC_jsr_w:
case JVM_OPC_goto_w: {
case JVM_OPC_tableswitch:
case JVM_OPC_lookupswitch: {
int *lptr;
int *saved_operand;
int keys;
int k, delta;
if (*bptr != 0) {
case JVM_OPC_ldc: {
case JVM_OPC_ldc_w: {
case JVM_OPC_ldc2_w: {
case JVM_OPC_invokevirtual:
case JVM_OPC_invokespecial:
case JVM_OPC_invokestatic:
case JVM_OPC_invokedynamic:
case JVM_OPC_invokeinterface: {
const char *methodname;
if (is_invokedynamic)
if (is_constructor) {
if (is_internal) {
while(super != 0) {
not_found = 0;
if (not_found) {
#ifdef BROKEN_JAVAC
if (has_loader)
unsigned int args1;
unsigned int args2;
const char *signature =
case JVM_OPC_instanceof:
case JVM_OPC_checkcast:
case JVM_OPC_new:
case JVM_OPC_anewarray:
case JVM_OPC_multianewarray: {
switch(opcode) {
case JVM_OPC_anewarray:
case JVM_OPC_new:
case JVM_OPC_multianewarray:
case JVM_OPC_newarray: {
case JVM_T_INT:
case JVM_T_LONG:
case JVM_T_FLOAT:
case JVM_T_DOUBLE:
case JVM_T_CHAR:
case JVM_T_SHORT:
goto check_local_variable;
goto check_local_variable;
goto check_local_variable;
goto check_local_variable2;
goto check_local_variable2;
goto check_local_variable;
goto check_local_variable;
goto check_local_variable;
goto check_local_variable2;
goto check_local_variable2;
case JVM_OPC_wide:
goto check_local_variable2;
goto check_local_variable;
case JVM_OPC_ret:
int access;
} while (calledClass != 0);
static jboolean
if (fptr == 0)
return JNI_FALSE;
return JNI_TRUE;
return JNI_FALSE;
for (; --i >= 0; handler_info++) {
i, &einfo);
const char *classname;
switch (instruction) {
case JVM_OPC_tableswitch: {
int index;
case JVM_OPC_lookupswitch: {
int npairs;
case JVM_OPC_wide:
case JVM_OPC_ret:
case JVM_OPC_iinc:
static jboolean
unsigned type;
const char *signature;
switch (fieldchar) {
unsigned int inumber;
while (work_to_do) {
#ifdef DEBUG
if (verify_verbose) {
#ifdef DEBUG
if (verify_verbose) {
int type;
switch (opcode) {
case JVM_OPC_fload:
case JVM_OPC_aload:
case JVM_OPC_ret:
case JVM_OPC_lload:
case JVM_OPC_dload:
if (!double_word) {
operand);
switch (opcode) {
case JVM_OPC_return:
char *stack_operands, *p;
switch(opcode) {
const char *signature =
operand);
#ifdef DEBUG
if (verify_verbose) {
case JVM_OPC_invokedynamic:
const char *signature =
operand);
#ifdef DEBUG
if (verify_verbose) {
*ip = 0;
case JVM_OPC_multianewarray: {
p > stack_operands;
int type = *--p;
switch (type) {
if ((indirection == 0) ||
switch (opcode) {
case JVM_OPC_putfield:
case JVM_OPC_getfield:
case JVM_OPC_putstatic: {
if (!isAssignableTo
(context,
case JVM_OPC_athrow:
case JVM_OPC_invokeinit:
case JVM_OPC_invokedynamic:
const char *signature =
operand);
int item;
item = 0;
const char *utfName =
is_clone) {
case JVM_OPC_return:
case JVM_OPC_new: {
switch (opcode) {
goto continue_store;
goto continue_store;
for (i = 0; i < register_count; i++)
for (i = 0; i < new_mask_count; i++)
case JVM_OPC_invokeinit:
case JVM_OPC_new: {
for (i = 0; i < register_count; i++) {
for ( ; i < register_count; i++) {
for (k = 0; k < new_mask_count; k++) {
if (!copied_mask) {
for (i = 0; i < new_mask_count; i++) {
for (j = i; j < new_mask_count; j++) {
char *stack_results;
switch(opcode) {
case JVM_CONSTANT_Integer:
case JVM_CONSTANT_Float:
case JVM_CONSTANT_Double:
case JVM_CONSTANT_Long:
case JVM_CONSTANT_String:
case JVM_CONSTANT_Class:
operand);
#ifdef DEBUG
if (verify_verbose) {
case JVM_OPC_invokeinit:
case JVM_OPC_invokedynamic:
operand);
const char *result_signature;
&full_info);
case JVM_OPC_aconst_null:
case JVM_OPC_new:
case JVM_OPC_checkcast:
case JVM_OPC_newarray:
case JVM_OPC_anewarray:
case JVM_OPC_multianewarray:
case JVM_OPC_aaload:
case JVM_OPC_aload:
for (p = stack_results; *p != 0; p++) {
int type = *p;
switch (type) {
stack_size++; break;
stack_size++; break;
stack_size++; p++;
stack_size++;
int handler_info_length =
int successors_count;
switch (opcode) {
case JVM_OPC_athrow:
successors_count = 0;
case JVM_OPC_ret: {
count++;
case JVM_OPC_tableswitch:
case JVM_OPC_lookupswitch:
#ifdef DEBUG
if (verify_verbose) {
for (i = 0; i < successors_count; i++)
JNI_TRUE);
JNI_TRUE);
for (i = 0; i < successors_count; i++) {
#ifdef DEBUG
#ifdef DEBUG
if (verify_verbose) {
for (i = 0; i < new_register_count; i++) {
for (i = 0; i < new_register_count; i++) {
int *return_mask;
for (i = new_mask_count; --i >= 0; )
new_mask_count = i;
for (i = 0; i < max_registers; i++) {
#ifdef DEBUG
if (change) {
for (i = 0; i < register_count; i++) {
if ((i < new_register_count)
if (copy) {
for (j = i; j < register_count; j++) {
if (i >= new_register_count)
new_registers[j],
while ( register_count > 0
if (mask_count > 0) {
int matches = 0;
for (i = 0; i < mask_count; i++) {
matches++;
!copy_needed && k >= 0;
last_match = j;
for (i = 0; i < matches; i++) {
matches = 0;
for (i = 0; i < mask_count; i++) {
matches++;
last_match = j;
unsigned int to_inumber,
static stack_item_type *
int length;
if (length > 0) {
return new_stack;
return NULL;
static mask_type *
for (i = 0; i < mask_count; i++) {
return result;
static mask_type *
for (i = 0; i < mask_count; i++) {
return result;
int poolPad;
if (new == 0) {
while (this) {
if (new == 0) {
if (new == 0) {
if (zero)
static fullinfo_type
const char *classname;
switch (kind) {
case JVM_CONSTANT_Class:
cp_index);
case JVM_CONSTANT_Methodref:
cp_index);
case JVM_CONSTANT_Fieldref:
cp_index);
return result;
const char *name = 0;
const char *signature = 0;
const char *p = *signature_p;
char result;
int array_depth = 0;
result = 0;
case JVM_SIGNATURE_CHAR:
case JVM_SIGNATURE_SHORT:
case JVM_SIGNATURE_INT:
case JVM_SIGNATURE_FLOAT:
case JVM_SIGNATURE_DOUBLE:
case JVM_SIGNATURE_LONG:
case JVM_SIGNATURE_ARRAY:
array_depth++;
case JVM_SIGNATURE_CLASS: {
*signature_p = p;
return result;
static fullinfo_type
return NULL_FULLINFO;
if ( (indirection == 0)
static fullinfo_type
return value;
return target;
return value;
return target;
target);
if (is_interface)
return target;
return value;
return target;
return value;
if (dimen_value == 0)
dimen_value--;
if (dimen_target == 0)
dimen_target--;
return result_base;
return value;
return target;
if (cb_target == 0)
if (cb_value == 0)
if (for_assignment) {
while (cb_super_value != 0) {
return target;
while((cb_super_value != 0) &&
(cb_super_target != 0)) {
return target;
return value;
while (cb_super_value != 0) {
while (cb_super_target != 0) {
return result_info;
static jclass
switch (kind) {
case VM_STRING_UTF:
case VM_MALLOC_BLK:
alloc_stack_type *p;
if (ptr == 0)
free(p);
int args_size = 0;
case JVM_SIGNATURE_BOOLEAN:
case JVM_SIGNATURE_BYTE:
case JVM_SIGNATURE_CHAR:
case JVM_SIGNATURE_SHORT:
case JVM_SIGNATURE_INT:
case JVM_SIGNATURE_FLOAT:
case JVM_SIGNATURE_CLASS:
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
case JVM_SIGNATURE_ARRAY:
while ((*p == JVM_SIGNATURE_ARRAY)) p++;
if (*p == JVM_SIGNATURE_CLASS) {
while (*p != JVM_SIGNATURE_ENDCLASS)
case JVM_SIGNATURE_DOUBLE:
case JVM_SIGNATURE_LONG:
return args_size;
#ifdef DEBUG
for (i = 0; i < register_count; i++)
for (i = 0; i < mask_count; i++) {
for (i = indirection; i-- > 0; )
case ITEM_Integer:
case ITEM_Float:
case ITEM_Double:
case ITEM_Double_2:
case ITEM_Long:
case ITEM_Long_2:
case ITEM_ReturnAddress:
case ITEM_Object:
if (!verbose) {
if (extra == 0) {
case ITEM_Char:
case ITEM_Short:
case ITEM_Byte:
case ITEM_NewObject:
if (!verbose) {
case ITEM_InitObject:
for (i = indirection; i-- > 0; )