📄 kaffe.def
字号:
35); } /* Push arguments & object */ build_call_frame(method_sig(), stack(idx), idx); idx++; if (is_virtual) { slot_nowriteback(tmp); } pop(idx); begin_func_sync(); /* Call it */ low = method_returntype(); if (is_virtual) { call(tmp); slot_freetmp(tmp); } else { call_indirect_method(method_method()); } /* Pop args */ popargs(); end_func_sync(); METHOD_RETURN_VALUE(); } }}define_insn(INVOKESPECIAL){ /* * ..., obj, ..args.., -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("invokespecial %d\n", idx)); get_special_method_info_noerror(idx); /* If class doesn't exist, call 'NoSuchClassError' */ if (method_class() == 0) { softcall_nosuchclass(method_classname()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } /* If method doesn't exist, call 'NoSuchMethodError' */ else if (method_method() == 0) { softcall_nosuchmethod(method_class(), method_name(), method_sig()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } else if (method_class()->accflags & ACC_INTERFACE) { softcall_incompatibleclasschange(method_classname(), method_name()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } else if ((method_method()->accflags & ACC_CONSTRUCTOR) && (method_method()->class != method_class())) { /* XXX I think this test is wrong. */ softcall_nosuchmethod(method_class(), method_name(), method_sig()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } else if (method_method()->accflags & ACC_STATIC) { softcall_incompatibleclasschange(method_classname(), method_name()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } else if (!checkMethodAccess(current_class(), method_class(), method_method())) { softcall_illegalaccess(method_classname(), method_name()); low = method_returntype(); pop(method_nargs() + 1); METHOD_RETURN_VALUE(); } else { idx = method_nargs(); explicit_check_null(INVOKESPECIAL, stack(idx), 34); check_stack_ref(idx); if( METHOD_TRANSLATED(method_method()) && ( (void (*) (void)) (METHOD_NATIVECODE(method_method())) == soft_null_call) ) { idx += 1; pop(idx); } else { /* Push arguments & object */ build_call_frame(method_sig(), stack(idx), idx); idx++; pop(idx); begin_func_sync(); /* Call it */ low = method_returntype(); call_indirect_method(method_method()); /* Pop args */ popargs(); end_func_sync(); METHOD_RETURN_VALUE(); } }}define_insn(INVOKESTATIC){ /* * ..., ..args.., -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("invokestatic %d\n", idx)); get_method_info_noerror(idx); /* If class doesn't exist, call 'NoSuchClassError' */ if (method_class() == 0) { softcall_nosuchclass(method_classname()); low = method_returntype(); pop(method_nargs()); METHOD_RETURN_VALUE(); } /* If method doesn't exist, call 'NoSuchMethodError' */ else if (method_method() == 0) { softcall_nosuchmethod(method_class(), method_name(), method_sig()); low = method_returntype(); pop(method_nargs()); METHOD_RETURN_VALUE(); } else if (!(method_method()->accflags & ACC_STATIC)) { softcall_incompatibleclasschange(method_classname(), method_name()); low = method_returntype(); pop(method_nargs()); METHOD_RETURN_VALUE(); } else if (!checkMethodAccess(current_class(), method_class(), method_method())) { softcall_illegalaccess(method_classname(), method_name()); low = method_returntype(); pop(method_nargs()); METHOD_RETURN_VALUE(); } else { idx = method_nargs(); if( METHOD_TRANSLATED(method_method()) && ( (void (*) (void)) (METHOD_NATIVECODE(method_method())) == soft_null_call) ) { pop(idx); } else { /* Push arguments */ build_call_frame(method_sig(), 0, idx); pop(idx); begin_func_sync(); /* Call it */ low = method_returntype(); call_indirect_method(method_method()); /* Pop args */ popargs(); end_func_sync(); METHOD_RETURN_VALUE(); } }}define_insn(INVOKEINTERFACE){ /* * ..., obj, ..args.., -> ... */ check_pcidx (0); check_pc (2); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("invokeinterface %d\n", idx)); get_interface_method_info_noerror(idx); /* If class doesn't exist, call 'NoSuchClassError' */ if (method_class() == 0) { softcall_nosuchclass(method_classname()); low = method_returntype(); pop((uint8)getpc(2)); METHOD_RETURN_VALUE(); } /* If method doesn't exist, call 'NoSuchMethodError' */ else if (method_method() == 0) { softcall_nosuchmethod(method_class(), method_name(), method_sig()); low = method_returntype(); pop((uint8)getpc(2)); METHOD_RETURN_VALUE(); } else if (!(method_class()->accflags & ACC_INTERFACE)) { softcall_incompatibleclasschange(method_classname(), method_name()); low = method_returntype(); pop((uint8)getpc(2)); METHOD_RETURN_VALUE(); } else { idx = (uint8)getpc(2) - 1; check_null(INVOKEINTERFACE, stack(idx), 34); check_stack_ref(idx); slot_alloctmp(tmp); softcall_lookupinterfacemethod(tmp, method_method(), stack(idx)); /* Push arguments & object */ build_call_frame(method_sig(), stack(idx), idx); idx++; slot_nowriteback(tmp); pop(idx); begin_func_sync(); /* Call it */ low = method_returntype(); call(tmp); slot_freetmp(tmp); /* Pop args */ popargs(); end_func_sync(); METHOD_RETURN_VALUE(); }}define_insn(NEW){ /* * ... -> ..., object ref */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("new %d\n", idx)); get_class_info_noerror(idx); push(1); if (class_object() == 0) { softcall_nosuchclass(class_name(idx)); } else { softcall_new(stack(0), class_object()); }}define_insn(NEWARRAY){ /* * ... size -> ..., object ref */ check_pc (0); check_stack_int(0); low = (uint8)getpc(0); trace_jcode (("newarray %d\n", low)); softcall_newarray(stack(0), stack(0), low);}define_insn(ANEWARRAY){ /* * ... size -> ..., object ref */ check_pcidx (0); check_stack_int(0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("anewarray %d\n", idx)); get_class_info_noerror(idx); if (class_object() == 0) { softcall_nosuchclass(class_name(idx)); } else { softcall_anewarray(stack(0), stack(0), class_object()); }}define_insn(ARRAYLENGTH){ /* * ..., obj -> ..., length */ trace_jcode (("arraylength\n")); check_null(ARRAYLENGTH, rstack(0), 34); check_stack_array(0); load_offset_int(stack(0), rstack(0), object_array_length);}define_insn(ATHROW){ /* * ..., obj -> undefined */ trace_jcode (("athrow\n")); check_null(ATHROW, rstack(0), 34); check_stack_ref(0); softcall_athrow(rstack(0));}define_insn(CHECKCAST){ /* * ..., obj -> ..., obj */ check_pcidx (0); check_stack_ref(0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("checkcast %d\n", idx)); get_class_info_noerror(idx); if (class_object() == 0) { softcall_nosuchclass(class_name(idx)); } else { softcall_checkcast(stack(0), rstack(0), class_object()); }}define_insn(INSTANCEOF){ /* * ..., obj -> ..., result */ check_pcidx (0); check_stack_ref(0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("instanceof %d\n", idx)); get_class_info_noerror(idx); if (class_object() == 0) { softcall_nosuchclass(class_name(idx)); } else { softcall_instanceof(stack(0), rstack(0), class_object()); }}define_insn(MONITORENTER){ /* * ... obj -> ... */ trace_jcode (("monitorenter\n")); check_null(MONITORENTER, rstack(0), 34); check_stack_ref(0); begin_func_sync(); softcall_monitorenter(rstack(0)); pop(1); end_func_sync();}define_insn(MONITOREXIT){ /* * ... obj -> ... */ trace_jcode (("monitorexit\n")); check_null(MONITOREXIT, rstack(0), 34); check_stack_ref(0); begin_func_sync(); softcall_monitorexit(rstack(0)); pop(1); end_func_sync();}define_insn(WIDE){ /* Move PC to widened instruction */ pc = npc; npc = pc + insnLen[getopcode()] + 1; switch(getopcode()) { default: ABORT(); define_wide_insn(ILOAD) { /* * ..., -> ..., local variable */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide iload %d\n", idx)); check_local_int(idx); push(1); move_int(stack(0), local(idx)); } define_wide_insn(FLOAD) { /* * ..., -> ..., local variable */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide fload %d\n", idx)); check_local_float(idx); push(1); move_float(stack(0), local_float(idx)); } define_wide_insn(ALOAD) { /* * ..., -> ..., local variable */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide aload %d\n", idx)); check_local_ref(idx); push(1); move_ref(stack(0), local(idx)); } define_wide_insn(LLOAD) { /* * ..., -> ..., long local variable */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide lload %d\n", idx)); check_local_long(idx+1); push(2); move_long(stack_long(0), local_long(idx)); } define_wide_insn(DLOAD) { /* * ..., -> ..., double local variable */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide dload %d\n", idx)); check_local_double(idx+1); push(2); move_double(stack_double(0), local_double(idx)); } define_wide_insn(ISTORE) { /* * ..., var -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide istore %d\n", idx)); check_stack_int(0); move_int(local(idx), stack(0)); pop(1); } define_wide_insn(FSTORE) { /* * ..., var -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide fstore %d\n", idx)); check_stack_float(0); move_float(local_float(idx), stack(0)); pop(1); } define_wide_insn(ASTORE) { /* * ..., var -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide astore %d\n", idx)); check_stack_ref(0); move_ref(local(idx), stack(0)); pop(1); } define_wide_insn(LSTORE) { /* * ..., long var -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide lstore %d\n", idx)); check_stack_long(0); move_long(local_long(idx), stack_long(0)); pop(2); } define_wide_insn(DSTORE) { /* * ..., var -> ... */ check_pcidx (0); idx = (uint16)((getpc(0) << 8) | getpc(1)); trace_jcode (("wide dstore %d\n", idx)); check_stack_double(0); move_double(local_double(idx), stack_double(0)); pop(2); } define_wide_insn(IINC) { check_pcidx (0); check_pcidx (2); idx = (uint16)((getpc(0) << 8) | getpc(1)); low = (int16)((getpc(2) << 8) | getpc(3)); trace_jcode (("wide iinc %d %d\n", idx, low)); check_local_int(idx); add_int_const(local(idx), local(idx), low); npc += 1; /* Extra one */ } }}define_insn(MULTIANEWARRAY){ /* * ... size1, size2, ... sizen -> ..., object ref */ check_pcidx (0); check_pc (2); idx = (uint16)((getpc(0) << 8) | getpc(1)); low = (uint8)getpc(2); trace_jcode (("multinewarray %d %d\n", idx, low)); for (high = 0; high < low; high++) { check_stack_int(high); } get_class_info(idx); /* NB: softcall does the necessary stack adjustments */ softcall_multianewarray(stack(low-1), low, stack(0), class_object());}define_insn(IFNULL){ check_pcidx (0); check_stack_ref(0); idx = (int16)((getpc(0) << 8) | getpc(1)); trace_jcode (("ifnull %ld\n", (long) (pc + idx))); slot_nowriteback(stack(0)); begin_sync(); cbranch_ref_const_eq(rstack(0), 0, reference_code_label(pc+idx)); pop(1); end_sync();}define_insn(IFNONNULL){ check_pcidx (0); check_stack_ref(0); idx = (int16)((getpc(0) << 8) | getpc(1)); trace_jcode (("ifnonnull %ld\n", (long) (pc + idx))); slot_nowriteback(stack(0)); begin_sync(); cbranch_ref_const_ne(rstack(0), 0, reference_code_label(pc+idx)); pop(1); end_sync();}define_insn(GOTO_W){ check_pcwidx (0); idx = (int32)((getpc(0) << 24) | (getpc(1) << 16) | (getpc(2) << 8) | getpc(3)); trace_jcode (("goto_w %ld\n", (long) (pc + idx))); begin_sync(); branch_a(reference_code_label(pc+idx)); end_sync();}define_insn(JSR_W){ /* * ... -> ..., ret-addr */ check_pcwidx (0); idx = (int32)((getpc(0) << 24) | (getpc(1) << 16) | (getpc(2) << 8) | getpc(3)); trace_jcode (("jsr_w %ld\n", (long) (pc + idx))); push(1); move_label_const(stack(0), reference_code_label(npc)); begin_sync(); branch_a(reference_code_label(pc+idx)); end_sync();}define_insn(BREAKPOINT){ trace_jcode (("breakpoint\n")); softcall_breakpoint();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -