long length;
long length ATTRIBUTE_UNUSED;
process_jvm_instruction (PC, byte_ops, length)     int PC;     unsigned char* byte_ops;     long length;{   const char *opname; /* Temporary ??? */  int oldpc = PC; /* PC at instruction start. */  /* If the instruction is at the beginning of a exception handler,     replace the top of the stack with the thrown object reference */  if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET)    {      tree type = pop_type (ptr_type_node);      push_value (build1 (NOP_EXPR, type, soft_exceptioninfo_call_node));    }  switch (byte_ops[PC++])    {#define JAVAOP(OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE) \    case OPCODE: \      opname = #OPNAME; \      OPKIND(OPERAND_TYPE, OPERAND_VALUE); \      break;#define RET(OPERAND_TYPE, OPERAND_VALUE) 				\  {									\    int saw_index = 0;							\    int index     = OPERAND_VALUE;					\    build_java_ret (find_local_variable (index, ptr_type_node, oldpc));	\  }#define JSR(OPERAND_TYPE, OPERAND_VALUE)		\  {							\    tree where = lookup_label (oldpc+OPERAND_VALUE);	\    tree ret   = lookup_label (PC);			\    build_java_jsr (where, ret);			\    load_type_state (ret);				\  }/* Push a constant onto the stack. */#define PUSHC(OPERAND_TYPE, OPERAND_VALUE) \  { int saw_index = 0;  int ival = (OPERAND_VALUE); \    if (saw_index) java_push_constant_from_pool (current_jcf, ival); \    else expand_java_pushc (ival, OPERAND_TYPE##_type_node); }/* internal macro added for use by the WIDE case */#define LOAD_INTERNAL(OPTYPE, OPVALUE) \  push_value (find_local_variable (OPVALUE, type_map[OPVALUE], oldpc));/* Push local variable onto the opcode stack. */#define LOAD(OPERAND_TYPE, OPERAND_VALUE) \  { \    /* have to do this since OPERAND_VALUE may have side-effects */ \    int opvalue = OPERAND_VALUE; \    LOAD_INTERNAL(OPERAND_TYPE##_type_node, opvalue); \  }#define RETURN(OPERAND_TYPE, OPERAND_VALUE) \  expand_java_return (OPERAND_TYPE##_type_node)#define REM_EXPR TRUNC_MOD_EXPR#define BINOP(OPERAND_TYPE, OPERAND_VALUE) \  expand_java_binop (OPERAND_TYPE##_type_node, OPERAND_VALUE##_EXPR)#define FIELD(IS_STATIC, IS_PUT) \  expand_java_field_op (IS_STATIC, IS_PUT, IMMEDIATE_u2)#define TEST(OPERAND_TYPE, CONDITION) \  expand_test (CONDITION##_EXPR, OPERAND_TYPE##_type_node, oldpc+IMMEDIATE_s2)#define COND(OPERAND_TYPE, CONDITION) \  expand_cond (CONDITION##_EXPR, OPERAND_TYPE##_type_node, oldpc+IMMEDIATE_s2)#define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \  BRANCH_##OPERAND_TYPE (OPERAND_VALUE)#define BRANCH_GOTO(OPERAND_VALUE) \  expand_java_goto (oldpc + OPERAND_VALUE)#define BRANCH_CALL(OPERAND_VALUE) \  expand_java_call (oldpc + OPERAND_VALUE, oldpc)#if 0#define BRANCH_RETURN(OPERAND_VALUE) \  { \    tree type = OPERAND_TYPE##_type_node; \    tree value = find_local_variable (OPERAND_VALUE, type, oldpc); \    expand_java_ret (value); \  }#endif#define NOT_IMPL(OPERAND_TYPE, OPERAND_VALUE) \	  fprintf (stderr, "%3d: %s ", oldpc, opname); \	  fprintf (stderr, "(not implemented)\n")#define NOT_IMPL1(OPERAND_VALUE) \	  fprintf (stderr, "%3d: %s ", oldpc, opname); \	  fprintf (stderr, "(not implemented)\n")#define BRANCH_RETURN(OPERAND_VALUE) NOT_IMPL1(OPERAND_VALUE)#define STACK(SUBOP, COUNT) STACK_##SUBOP (COUNT)#define STACK_POP(COUNT) java_stack_pop (COUNT)#define STACK_SWAP(COUNT) java_stack_swap()#define STACK_DUP(COUNT) java_stack_dup (COUNT, 0)#define STACK_DUPx1(COUNT) java_stack_dup (COUNT, 1)#define STACK_DUPx2(COUNT) java_stack_dup (COUNT, 2)#define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \  PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH#define LOOKUP_SWITCH \  { jint default_offset = IMMEDIATE_s4;  jint npairs = IMMEDIATE_s4; \    tree selector = pop_value (INT_type_node); \    tree duplicate, label; \    tree type = TREE_TYPE (selector); \    flush_quick_stack (); \    expand_start_case (0, selector, type, "switch statement");\    push_momentary (); \    while (--npairs >= 0) \      { \	jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \	tree value = build_int_2 (match, match < 0 ? -1 : 0); \	TREE_TYPE (value) = type; \	label =  build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \	pushcase (value, convert, label, &duplicate); \	expand_java_goto (oldpc + offset); \      } \    label =  build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \    pushcase (NULL_TREE, 0, label, &duplicate); \    expand_java_goto (oldpc + default_offset); \    pop_momentary (); \    expand_end_case (selector); \  }#define TABLE_SWITCH \  { jint default_offset = IMMEDIATE_s4; \    jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \    tree selector = pop_value (INT_type_node); \    tree duplicate, label; \    tree type = TREE_TYPE (selector); \    flush_quick_stack (); \    expand_start_case (0, selector, type, "switch statement");\    push_momentary (); \    for (; low <= high; low++) \      { \        jint offset = IMMEDIATE_s4; \        tree value = build_int_2 (low, low < 0 ? -1 : 0); \        TREE_TYPE (value) = type; \        label =  build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \        pushcase (value, convert, label, &duplicate); \        expand_java_goto (oldpc + offset); \      } \    label =  build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \    pushcase (NULL_TREE, 0, label, &duplicate); \    expand_java_goto (oldpc + default_offset); \    pop_momentary (); \    expand_end_case (selector); \  }#define INVOKE(MAYBE_STATIC, IS_INTERFACE) \  { int opcode = byte_ops[PC-1]; \    int method_ref_index = IMMEDIATE_u2; \    int nargs; \    if (IS_INTERFACE) { nargs = IMMEDIATE_u1;  (void) IMMEDIATE_u1; } \    else nargs = -1; \    expand_invoke (opcode, method_ref_index, nargs); \  }/* Handle new, checkcast, instanceof */#define OBJECT(TYPE, OP) \  expand_java_##OP (get_class_constant (current_jcf, IMMEDIATE_u2))#define ARRAY(OPERAND_TYPE, SUBOP) ARRAY_##SUBOP(OPERAND_TYPE)#define ARRAY_LOAD(OPERAND_TYPE) 			\  {							\    expand_java_arrayload( OPERAND_TYPE##_type_node );	\  }#define ARRAY_STORE(OPERAND_TYPE)			\  {							\    expand_java_arraystore( OPERAND_TYPE##_type_node );	\  }#define ARRAY_LENGTH(OPERAND_TYPE) expand_java_array_length();#define ARRAY_NEW(OPERAND_TYPE) ARRAY_NEW_##OPERAND_TYPE()#define ARRAY_NEW_PTR()							\    push_value (build_anewarray (get_class_constant (current_jcf,	\						     IMMEDIATE_u2),	\				 pop_value (int_type_node)));#define ARRAY_NEW_NUM()				\  {						\    int atype = IMMEDIATE_u1;			\    push_value (build_newarray (atype, pop_value (int_type_node)));\  }#define ARRAY_NEW_MULTI()					\  {								\    tree class = get_class_constant (current_jcf, IMMEDIATE_u2 );	\    int  ndims = IMMEDIATE_u1;					\    expand_java_multianewarray( class, ndims );			\  }#define UNOP(OPERAND_TYPE, OPERAND_VALUE) \  push_value (fold (build1 (NEGATE_EXPR, OPERAND_TYPE##_type_node, \			    pop_value (OPERAND_TYPE##_type_node))));#define CONVERT2(FROM_TYPE, TO_TYPE)					 \  {									 \    push_value (build1 (NOP_EXPR, int_type_node,			 \			(convert (TO_TYPE##_type_node,			 \				  pop_value (FROM_TYPE##_type_node))))); \  }#define CONVERT(FROM_TYPE, TO_TYPE)				\  {								\    push_value (convert (TO_TYPE##_type_node,	                \			 pop_value (FROM_TYPE##_type_node)));	\  }/* internal macro added for use by the WIDE case    Added TREE_TYPE (decl) assignment, apbianco  */#define STORE_INTERNAL(OPTYPE, OPVALUE)			\  {							\    tree decl, value;					\    int var = OPVALUE;					\    tree type = OPTYPE;					\    value = pop_value (type);				\    type = TREE_TYPE (value);				\    decl = find_local_variable (var, type, oldpc);	\    set_local_type (var, type );			\    expand_assignment (decl, value, 0, 0);		\  }#define STORE(OPERAND_TYPE, OPERAND_VALUE) \  { \    /* have to do this since OPERAND_VALUE may have side-effects */ \    int opvalue = OPERAND_VALUE; \    STORE_INTERNAL(OPERAND_TYPE##_type_node, opvalue); \  }#define SPECIAL(OPERAND_TYPE, INSTRUCTION) \  SPECIAL_##INSTRUCTION(OPERAND_TYPE)#define SPECIAL_ENTER(IGNORED) MONITOR_OPERATION (soft_monitorenter_node)#define SPECIAL_EXIT(IGNORED)  MONITOR_OPERATION (soft_monitorexit_node)#define MONITOR_OPERATION(call)			\  {						\    tree o = pop_value (ptr_type_node);		\    tree c;					\    flush_quick_stack ();			\    c = build_java_monitor (call, o);		\    TREE_SIDE_EFFECTS (c) = 1;			\    expand_expr_stmt (c);			\  }#define SPECIAL_IINC(IGNORED) \  { \    unsigned int local_var_index = IMMEDIATE_u1; \    int ival = IMMEDIATE_s1; \    expand_iinc(local_var_index, ival, oldpc); \  }#define SPECIAL_WIDE(IGNORED) \  { \    int modified_opcode = IMMEDIATE_u1; \    unsigned int local_var_index = IMMEDIATE_u2; \    switch (modified_opcode) \      { \      case OPCODE_iinc: \	{ \	  int ival = IMMEDIATE_s2; \	  expand_iinc (local_var_index, ival, oldpc); \	  break; \	} \      case OPCODE_iload: \      case OPCODE_lload: \      case OPCODE_fload: \      case OPCODE_dload: \      case OPCODE_aload: \	{ \	  /* duplicate code from LOAD macro */ \	  LOAD_INTERNAL(operand_type[modified_opcode], local_var_index); \	  break; \	} \      case OPCODE_istore: \      case OPCODE_lstore: \      case OPCODE_fstore: \      case OPCODE_dstore: \      case OPCODE_astore: \	{ \	  STORE_INTERNAL(operand_type[modified_opcode], local_var_index); \	  break; \	} \      default: \        error ("unrecogized wide sub-instruction"); \      } \  }#define SPECIAL_THROW(IGNORED) \  build_java_athrow (pop_value (throwable_type_node))#define SPECIAL_BREAK NOT_IMPL1#define IMPL          NOT_IMPL#include "javaop.def"#undef JAVAOP   default:    fprintf (stderr, "%3d: unknown(%3d)\n", oldpc, byte_ops[PC]);  }  return PC;}