📄 kaffe.def
字号:
/* * kaffe.def * Kaffe instruction definitions. * Used by intrp, JIT and JIT3 engines. * * Copyright (c) 1996, 1997, 1999, 2000 * Transvirtual Technologies, Inc. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */#define trace_jcode(x...) DBG(MOREJIT, dprintf ("@%ld:\t", (long) pc); dprintf(x))define_insn(NOP){ /* * No operation. */ trace_jcode ("nop\n");}define_insn_finidefine_insn(ACONST_NULL){ /* * ... -> ..., 0 */ trace_jcode ("aconst 0\n"); push(1); move_ref_const(stack(0), NULL);}define_insn_finidefine_insn(ICONST_M1)define_insn_alias(ICONST_0)define_insn_alias(ICONST_1)define_insn_alias(ICONST_2)define_insn_alias(ICONST_3)define_insn_alias(ICONST_4)define_insn_alias(ICONST_5){ /* * ... -> ..., [-1 .. 5] */ trace_jcode ("iconst %d\n", getopcode() - ICONST_0); push(1); move_int_const(stack(0), getopcode() - ICONST_0);}define_insn_finidefine_insn(LCONST_0)define_insn_alias(LCONST_1){ /* * ... -> ..., 0, [0 .. 1] */ trace_jcode ("lconst %d\n", getopcode() - LCONST_0); push(2); move_long_const(stack_long(0), getopcode() - LCONST_0);}define_insn_finidefine_insn(FCONST_0)define_insn_alias(FCONST_1)define_insn_alias(FCONST_2){ /* * ... -> ..., [0.0 .. 2.0] */ trace_jcode ("fconst %f\n", (double)(jfloat)(getopcode() - FCONST_0)); push(1); move_float_const(stack(0), (jfloat)(getopcode() - FCONST_0));}define_insn_finidefine_insn(DCONST_0)define_insn_alias(DCONST_1){ /* * ... -> ..., [0.0 .. 1.0] */ trace_jcode ("dconst %f\n", (double)(jdouble)(getopcode() - DCONST_0)); push(2); move_double_const(stack_double(0), (jdouble)(getopcode() - DCONST_0));}define_insn_finidefine_insn(BIPUSH){ /* * ... -> ..., val */ check_pc (0); low = (int8)getpc(0); trace_jcode ("bipush %d\n", low); push(1); move_int_const(stack(0), low);}define_insn_finidefine_insn(SIPUSH){ /* * ... -> ..., val */ check_pcidx (0); low = (int16)((getpc(0) << 8) | getpc(1)); trace_jcode ("sipush %d\n", low); push(1); move_int_const(stack(0), low);}define_insn_finidefine_insn(LDC1){ /* * ... -> ..., const */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("ldc1 %d\n", idx); push(1); low = CLASS_CONST_TAG(current_class(), idx); switch (low) { case CONSTANT_String: { errorInfo ei; void *s; s = resolveString(current_class(), idx, &ei); if (s == 0) { compile_time_error(ei); } move_string_const(stack(0), s); } break; case CONSTANT_ResolvedString: move_string_const(stack(0), (void*)CLASS_CONST_DATA(current_class(),idx)); break; case CONSTANT_Class: { errorInfo ei; void *s; s = getClass(idx, current_class(), &ei); if (s == 0) { compile_time_error(ei); } move_string_const(stack(0), s); } break; case CONSTANT_ResolvedClass: move_ref_const(stack(0), (void*)CLASS_CONST_DATA(current_class(), idx)); break; case CONSTANT_Float: move_float_const(stack(0), *(float*)&CLASS_CONST_DATA(current_class(),idx)); break; case CONSTANT_Integer: move_int_const(stack(0), CLASS_CONST_DATA(current_class(),idx)); break; default: KAFFEVM_ABORT(); }}define_insn_finidefine_insn(LDC2){ /* * ... -> ..., const */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode ("ldc2 %d\n", idx); push(1); low = CLASS_CONST_TAG(current_class(), idx); switch (low) { case CONSTANT_String: { errorInfo ei; void *s; s = resolveString(current_class(), idx, &ei); if (s == 0) { compile_time_error(ei); } move_string_const(stack(0), s); } break; case CONSTANT_ResolvedString: move_string_const(stack(0), (void*)CLASS_CONST_DATA(current_class(),idx)); break; case CONSTANT_Class: { errorInfo ei; void *s; s = getClass(idx, current_class(), &ei); if (s == 0) { compile_time_error(ei); } move_string_const(stack(0), s); } break; case CONSTANT_ResolvedClass: move_ref_const(stack(0), (void*)CLASS_CONST_DATA(current_class(), idx)); break; case CONSTANT_Float: move_float_const(stack(0), *(jfloat*)&CLASS_CONST_DATA(current_class(),idx)); break; case CONSTANT_Integer: move_int_const(stack(0), CLASS_CONST_DATA(current_class(),idx)); break; default: KAFFEVM_ABORT(); }}define_insn_finidefine_insn(LDC2W){ /* * ... -> ..., long const */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode ("ldc2w %d\n", idx); push(2); switch (CLASS_CONST_TAG(current_class(), idx)) { case CONSTANT_Long: tmpl.j = CLASS_CONST_LONG (current_class(), idx); move_long_const(stack_long(0), tmpl.j); break; case CONSTANT_Double: tmpl.j = CLASS_CONST_DOUBLE (current_class(), idx); move_double_const(stack_double(0), tmpl.d); break; default: KAFFEVM_ABORT(); }}define_insn_finidefine_insn(ILOAD){ /* * ..., -> ..., local variable */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("iload %d\n", idx); check_local_int(idx); push(1); move_int(stack(0), local(idx));}define_insn_finidefine_insn(LLOAD){ /* * ..., -> ..., long local variable */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("lload %d\n", idx); check_local_long(idx); push(2); move_long(stack_long(0), local_long(idx));}define_insn_finidefine_insn(FLOAD){ /* * ..., -> ..., local variable */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("fload %d\n", idx); check_local_float(idx); push(1); move_float(stack(0), local_float(idx));}define_insn_finidefine_insn(DLOAD){ /* * ..., -> ..., double local variable */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("dload %d\n", idx); check_local_double(idx); push(2); move_double(stack_double(0), local_double(idx));}define_insn_finidefine_insn(ALOAD){ /* * ..., -> ..., local variable */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("aload %d\n", idx); check_local_ref(idx); push(1); move_ref(stack(0), local(idx));}define_insn_finidefine_insn(ILOAD_0)define_insn_alias(ILOAD_1)define_insn_alias(ILOAD_2)define_insn_alias(ILOAD_3){ /* * ..., -> ..., local variable */ trace_jcode ("iload %d\n", getopcode() - ILOAD_0); check_local_int(getopcode() - ILOAD_0); push(1); move_int(stack(0), local(getopcode() - ILOAD_0));}define_insn_finidefine_insn(LLOAD_0)define_insn_alias(LLOAD_1)define_insn_alias(LLOAD_2)define_insn_alias(LLOAD_3){ /* * ..., -> ..., local variable */ trace_jcode ("lload %d\n", getopcode() - LLOAD_0); check_local_long((getopcode() - LLOAD_0)); push(2); move_long(stack_long(0), local_long(getopcode() - LLOAD_0));}define_insn_finidefine_insn(FLOAD_0)define_insn_alias(FLOAD_1)define_insn_alias(FLOAD_2)define_insn_alias(FLOAD_3){ /* * ..., -> ..., local variable */ trace_jcode ("fload %d\n", getopcode() - FLOAD_0); check_local_float(getopcode() - FLOAD_0); push(1); move_float(stack(0), local_float(getopcode() - FLOAD_0));}define_insn_finidefine_insn(DLOAD_0)define_insn_alias(DLOAD_1)define_insn_alias(DLOAD_2)define_insn_alias(DLOAD_3){ /* * ..., -> ..., local variable */ trace_jcode ("dload %d\n", getopcode() - DLOAD_0); check_local_double((getopcode() - DLOAD_0)); push(2); move_double(stack_double(0), local_double(getopcode() - DLOAD_0));}define_insn_finidefine_insn(ALOAD_0)define_insn_alias(ALOAD_1)define_insn_alias(ALOAD_2)define_insn_alias(ALOAD_3){ /* * ..., -> ..., local variable */ trace_jcode ("aload %d\n", getopcode() - ALOAD_0); check_local_ref(getopcode() - ALOAD_0); push(1); move_ref(stack(0), local(getopcode() - ALOAD_0));}define_insn_finidefine_insn(IALOAD){ /* * ..., array ref, index -> ..., value */ trace_jcode ("iaload\n"); check_stack_int(0); check_stack_intarray(1); check_null (IALOAD, rstack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_int(stack(1), rstack(1), rstack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(LALOAD){ /* * ..., array ref, index -> ..., long value */ trace_jcode ("laload\n"); check_stack_int(0); check_stack_longarray(1); check_null (LALOAD, stack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_long(stack_long(0), stack(1), stack(0), object_array_offset);}define_insn_finidefine_insn(FALOAD){ /* * ..., array ref, index -> ..., float value */ trace_jcode ("faload\n"); check_stack_int(0); check_stack_floatarray(1); check_null (FALOAD, stack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_float(stack_float(1), stack(1), stack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(DALOAD){ /* * ..., array ref, index -> ..., double value */ trace_jcode ("daload\n"); check_stack_int(0); check_stack_doublearray(1); check_null (DALOAD, stack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_double(stack_double(0), stack(1), stack(0), object_array_offset);}define_insn_finidefine_insn(AALOAD){ /* * ..., array ref, index -> ..., ref value */ trace_jcode ("aaload\n"); check_stack_int(0); check_stack_refarray(1); check_null(AALOAD, rstack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_ref(stack(1), rstack(1), rstack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(BALOAD){ /* * ..., array ref, index -> ..., byte value */ trace_jcode ("baload\n"); check_stack_int(0); check_stack_bytearray(1); check_null(BALOAD, rstack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_byte(stack(1), rstack(1), rstack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(CALOAD){ /* * ..., array ref, index -> ..., char value */ trace_jcode ("caload\n"); check_stack_int(0); check_stack_chararray(1); check_null(CALOAD, rstack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_char(stack(1), rstack(1), rstack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(SALOAD){ /* * ..., array ref, index -> ..., short value */ trace_jcode ("saload\n"); check_stack_int(0); check_stack_shortarray(1); check_null(SALOAD, rstack(1), 34); /* Check we are within the array bounds */ check_array_index(rstack(1), rstack(0)); load_offset_scaled_short(stack(1), rstack(1), rstack(0), object_array_offset); pop(1);}define_insn_finidefine_insn(ISTORE){ /* * ..., var -> ... */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("istore %d\n", idx); check_stack_int(0); move_int(local(idx), stack(0)); pop(1);}define_insn_finidefine_insn(LSTORE){ /* * ..., long var -> ... */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("lstore %d\n", idx); check_stack_long(0); move_long(local_long(idx), stack_long(0)); pop(2);}define_insn_finidefine_insn(FSTORE){ /* * ..., var -> ... */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("fstore %d\n", idx); check_stack_float(0); move_float(local_float(idx), stack(0)); pop(1);}define_insn_finidefine_insn(DSTORE){ /* * ..., var -> ... */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("dstore %d\n", idx); check_stack_double(0); move_double(local_double(idx), stack_double(0)); pop(2);}define_insn_finidefine_insn(ASTORE){ /* * ..., var -> ... */ check_pc (0); idx = (uint8)getpc(0); trace_jcode ("astore %d\n", idx); check_stack_ref(0); move_ref(local(idx), stack(0)); pop(1);}define_insn_finidefine_insn(ISTORE_0)define_insn_alias(ISTORE_1)define_insn_alias(ISTORE_2)define_insn_alias(ISTORE_3){ /* * ..., val -> ... */ trace_jcode ("istore %d\n", getopcode() - ISTORE_0); check_stack_int(0); move_int(local(getopcode() - ISTORE_0), stack(0)); pop(1);}define_insn_finidefine_insn(LSTORE_0)define_insn_alias(LSTORE_1)define_insn_alias(LSTORE_2)define_insn_alias(LSTORE_3){ /* * ..., long val -> ... */ trace_jcode ("lstore %d\n", getopcode() - LSTORE_0); check_stack_long(0); move_long(local_long(getopcode() - LSTORE_0), stack_long(0)); pop(2);}define_insn_finidefine_insn(FSTORE_0)define_insn_alias(FSTORE_1)define_insn_alias(FSTORE_2)define_insn_alias(FSTORE_3){ /* * ..., val -> ... */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -