⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icode.c

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 C
📖 第 1 页 / 共 5 页
字号:
		lshl_int_const(dst, src, 4);		break;	default:		return (0);	}	return (1);}void_mul_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_mul_int)	slot_slot_slot(dst, src, src2, HAVE_mul_int, Tcomplex);#else	begin_func_sync();#  if defined(PUSHARG_FORWARDS)	pusharg_int(src, 0);	pusharg_int(src2, 1);#  else	pusharg_int(src2, 1);	pusharg_int(src, 0);#  endif	call_soft(soft_mul);	popargs();	end_func_sync();	return_int(dst);#endif}voidmul_int_const(SlotInfo* dst, SlotInfo* src, jint val){	if (mul_int_const_optimize(dst, src, val) != 0) {		return;	}#if defined(HAVE_mul_int_const)	if (HAVE_mul_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_mul_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_mul_int(dst, src, tmp);		slot_freetmp(tmp);	}}voidmul_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	if (slot_type(src2) == Tconst) {		if (mul_int_const_optimize(dst, src, slot_value(src2)->i) != 0) {			return;		}	}#if defined(HAVE_mul_int) && defined(HAVE_mul_int_const)	if (slot_type(src) == Tconst) {		mul_int_const(dst, src2, slot_value(src)->i);	}	else if (slot_type(src2) == Tconst) {		mul_int_const(dst, src, slot_value(src2)->i);	}	else#endif	_mul_int(dst, src, src2);}voidmul_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_mul_long)	lslot_lslot_lslot(dst, src, src2, HAVE_mul_long, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_long(src, 0);	pusharg_long(src2, pusharg_long_idx_inc);#else	pusharg_long(src2, pusharg_long_idx_inc);	pusharg_long(src, 0);#endif	call_soft(soft_lmul);	popargs();	end_func_sync();	return_long(dst);#endif}#if defined(HAVE_mul_long_const)voidmul_long_const(SlotInfo* dst, SlotInfo* src, jlong val){	if (HAVE_mul_long_const_rangecheck(val)) {		lslot_lslot_lconst(dst, src, val, HAVE_mul_long_const, Tcomplex);	}	else	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_long_const(tmp, val);		mul_long(dst, src, tmp);		slot_freetmp(tmp);	}}#endifvoidmul_float(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_mul_float)	slot_slot_slot(dst, src, src2, HAVE_mul_float, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_float(src, 0);	pusharg_float(src2, 1);#else	pusharg_float(src2, 1);	pusharg_float(src, 0);#endif	call_soft(soft_fmul);	popargs();	end_func_sync();	return_float(dst);#endif}voidmul_double(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_mul_double)	lslot_lslot_lslot(dst, src, src2, HAVE_mul_double, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_double(src, 0);	pusharg_double(src2, pusharg_long_idx_inc);#else	pusharg_double(src2, pusharg_long_idx_inc);	pusharg_double(src, 0);#endif	call_soft(soft_fmull);	popargs();	end_func_sync();	return_double(dst);#endif}intdiv_int_const_optimize(SlotInfo* dst, SlotInfo* src, jint val){	SlotInfo* tmp;		switch (val) {	case 2:		slot_alloctmp(tmp);		lshr_int_const(tmp, src, (sizeof(int) * 8 - 1));		add_int(tmp, tmp, src);		ashr_int_const(dst, tmp, 1);		slot_freetmp(tmp);		break;	case 4:		slot_alloctmp(tmp);		ashr_int_const(tmp, src, 1);		lshr_int_const(tmp, tmp, (sizeof(int) * 8 - 2));		add_int(tmp, tmp, src);		ashr_int_const(dst, tmp, 2);		slot_freetmp(tmp);		break;	case 8:		slot_alloctmp(tmp);		ashr_int_const(tmp, src, 2);		lshr_int_const(tmp, tmp, (sizeof(int) * 8 - 3));		add_int(tmp, tmp, src);		ashr_int_const(dst, tmp, 3);		slot_freetmp(tmp);		break;	case 16:		slot_alloctmp(tmp);		ashr_int_const(tmp, src, 3);		lshr_int_const(tmp, tmp, (sizeof(int) * 8 - 4));		add_int(tmp, tmp, src);		ashr_int_const(dst, tmp, 4);		slot_freetmp(tmp);		break;	default:		return (0);	}	return (1);}void_div_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_div_int)	slot_slot_slot(dst, src, src2, HAVE_div_int, Tcomplex);#else	begin_func_sync();#  if defined(PUSHARG_FORWARDS)	pusharg_int(src, 0);	pusharg_int(src2, 1);#  else	pusharg_int(src2, 1);	pusharg_int(src, 0);#  endif	call_soft(soft_div);	popargs();	end_func_sync();	return_int(dst);#endif}voiddiv_int_const(SlotInfo* dst, SlotInfo* src, jint val){	if (div_int_const_optimize(dst, src, val) != 0) {		return;	}#if defined(HAVE_div_int_const)	if (HAVE_div_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_div_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_div_int(dst, src, tmp);		slot_freetmp(tmp);	}}voiddiv_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	if (slot_type(src2) == Tconst) {		if (div_int_const_optimize(dst, src, slot_value(src2)->i) != 0) {			return;		}	}	_div_int(dst, src, src2);}voiddiv_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_div_long)	lslot_lslot_lslot(dst, src, src2, HAVE_div_long, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_long(src, 0);	pusharg_long(src2, pusharg_long_idx_inc);#else	pusharg_long(src2, pusharg_long_idx_inc);	pusharg_long(src, 0);#endif	call_soft(soft_ldiv);	popargs();	end_func_sync();	return_long(dst);#endif}voiddiv_float(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	used_ieee_division = true;#if defined(HAVE_div_float)	slot_slot_slot(dst, src, src2, HAVE_div_float, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_float(src, 0);	pusharg_float(src2, 1);#else	pusharg_float(src2, 1);	pusharg_float(src, 0);#endif	call_soft(soft_fdiv);	popargs();	end_func_sync();	return_float(dst);#endif}voiddiv_double(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	used_ieee_division = true;#if defined(HAVE_div_double)	lslot_lslot_lslot(dst, src, src2, HAVE_div_double, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_double(src, 0);	pusharg_double(src2, pusharg_long_idx_inc);#else	pusharg_double(src2, pusharg_long_idx_inc);	pusharg_double(src, 0);#endif	call_soft(soft_fdivl);	popargs();	end_func_sync();	return_double(dst);#endif}voidrem_int_const(SlotInfo* dst, SlotInfo* src, jint val){#if defined(HAVE_rem_int_const)	if (HAVE_rem_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_rem_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		rem_int(dst, src, tmp);		slot_freetmp(tmp);	}}voidrem_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_rem_int)	slot_slot_slot(dst, src, src2, HAVE_rem_int, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_int(src, 0);	pusharg_int(src2, 1);#else	pusharg_int(src2, 1);	pusharg_int(src, 0);#endif	call_soft(soft_rem);	popargs();	end_func_sync();	return_int(dst);#endif}voidrem_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_rem_long)	lslot_lslot_lslot(dst, src, src2, HAVE_rem_long, Tcomplex);#else	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_long(src, 0);	pusharg_long(src2, pusharg_long_idx_inc);#else	pusharg_long(src2, pusharg_long_idx_inc);	pusharg_long(src, 0);#endif	call_soft(soft_lrem);	popargs();	end_func_sync();	return_long(dst);#endif}voidrem_float(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	used_ieee_division = true;	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_float(src, 0);	pusharg_float(src2, 1);#else	pusharg_float(src2, 1);	pusharg_float(src, 0);#endif	call_soft(soft_frem);	popargs();	end_func_sync();	return_float(dst);}voidrem_double(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	used_ieee_division = true;	begin_func_sync();#if defined(PUSHARG_FORWARDS)	pusharg_double(src, 0);	pusharg_double(src2, pusharg_long_idx_inc);#else	pusharg_double(src2, pusharg_long_idx_inc);	pusharg_double(src, 0);#endif	call_soft(soft_freml);	popargs();	end_func_sync();	return_double(dst);}voidneg_int(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_neg_int)	slot_slot_slot(dst, NULL, src, HAVE_neg_int, Tcomplex);#else	SlotInfo* zero;	slot_alloctmp(zero);	move_int_const(zero, NULL);	sub_int(dst, zero, src);	slot_freetmp(zero);#endif}#if defined(HAVE_ngc_int)voidngc_int(SlotInfo* dst, SlotInfo* src){	slot_slot_slot(dst, 0, src, HAVE_ngc_int, Tcomplex);}#endifvoidneg_long(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_neg_long)	lslot_lslot_lslot(dst, 0, src, HAVE_neg_long, Tcomplex);#elif defined(HAVE_ngc_int)	neg_int(LSLOT(dst), LSLOT(src));	ngc_int(HSLOT(dst), HSLOT(src));#elif defined(HAVE_sbc_int)	SlotInfo* zero;	slot_alloctmp(zero);	move_int_const(zero, 0);	sub_int(LSLOT(dst), zero, LSLOT(src));	sbc_int(HSLOT(dst), zero, HSLOT(src));	slot_freetmp(zero);#elif defined(HAVE_adc_int_const)	neg_int(LSLOT(dst), LSLOT(src));	adc_int_const(HSLOT(dst), HSLOT(src), 0);	neg_int(HSLOT(dst), HSLOT(dst));#elif defined(HAVE_set_lt_int_const) && defined(HAVE_nor_int)        SlotInfo* zero;        SlotInfo* carry;        slot_alloctmp(zero);        slot_alloctmp(carry);        move_int_const(zero, 0);        set_lt_int_const(carry,LSLOT(src),1);        sub_int(LSLOT(dst),zero,LSLOT(src));        nor_int(HSLOT(dst),zero,HSLOT(src));        add_int(HSLOT(dst),HSLOT(dst),carry);	slot_freetmp(zero);	slot_freetmp(carry);#else	KAFFEVM_ABORT();#endif}voidneg_float(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_neg_float)	slot_slot_slot(dst, NULL, src, HAVE_neg_float, Tcomplex);#else	SlotInfo* zero;	slot_alloctmp(zero);	move_float_const(zero, 0);	sub_float(dst, zero, src);	slot_freetmp(zero);#endif}voidneg_double(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_neg_double)	lslot_lslot_lslot(dst, NULL, src, HAVE_neg_double, Tcomplex);#else	SlotInfo* zero;	slot_alloc2tmp(zero);	move_double_const(zero, 0);	sub_double(dst, zero, src);	slot_free2tmp(zero);#endif}/* ----------------------------------------------------------------------- *//* Logical operators - and, or, etc.					   *//*									   */#if defined(HAVE_and_int)void_and_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_and_int, Tcomplex);}voidand_int_const(SlotInfo* dst, SlotInfo* src, jint val){	if (val == -1) {		move_int(dst, src);	}	else if (val == 0) {		move_int_const(dst, 0);	}#if defined(HAVE_and_int_const)	else if (HAVE_and_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_and_int_const, Tcomplex);	}#endif	else {		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_and_int(dst, src, tmp);		slot_freetmp(tmp);	}}voidand_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_and_int_const)	if (slot_type(src) == Tconst) {		and_int_const(dst, src2, slot_value(src)->i);	}	else if (slot_type(src2) == Tconst) {		and_int_const(dst, src, slot_value(src2)->i);	}	else#endif	_and_int(dst, src, src2);}#endifvoidand_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_and_long)	lslot_lslot_lslot(dst, src, src2, HAVE_and_long, Tcomplex);#else	and_int(LSLOT(dst), LSLOT(src), LSLOT(src2));	and_int(HSLOT(dst), HSLOT(src), HSLOT(src2));#endif}voidand_long_const(SlotInfo* dst, SlotInfo* src, jlong val){#if defined(HAVE_and_long_const)	if (HAVE_and_long_const_rangecheck(val)) {		lslot_lslot_lconst(dst, src, val, HAVE_and_long_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_long_const(tmp, val);		and_long(dst, src, tmp);		slot_freetmp(tmp);	}}#if defined(HAVE_or_int)void_or_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_or_int, Tcomplex);}voidor_int_const(SlotInfo* dst, SlotInfo* src, jint val){	if (val == -1) {		move_int_const(dst, -1);	}	else if (val == 0) {		move_int(dst, src);	}#if defined(HAVE_or_int_const)	if (HAVE_or_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_or_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_or_int(dst, src, tmp);		slot_freetmp(tmp);	}}voidor_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_or_int_const)	if (slot_type(src) == Tconst) {		or_int_const(dst, src2, slot_value(src)->i);	}	else if (slot_type(src2) == Tconst) {		or_int_const(dst, src, slot_value(src2)->i);	}	else#endif	_or_int(dst, src, src2);}#endif#if defined(HAVE_nor_int)voidnor_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_nor_int, Tcomplex);}#endifvoidor_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_or_long)	lslot_lslot_lslot(dst, src, src2, HAVE_or_long, Tcomplex);#else	or_int(LSLOT(dst), LSLOT(src), LSLOT(src2));	or_int(HSLOT(dst), HSLOT(src), HSLOT(src2));#endif}#if defined(HAVE_xor_int)void_xor_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_xor_int, Tcomplex);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -