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

📄 icode.c

📁 kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的java包。
💻 C
📖 第 1 页 / 共 5 页
字号:
voidmove_long_const(SlotInfo* dst, jlong val){#if defined(HAVE_move_long_const)	if (HAVE_move_long_const_rangecheck(val)) {		lslot_slot_lconst(dst, 0, val, HAVE_move_long_const, Tconst);	}	else {		constpool *c;		label* l;		SlotInfo* tmp;		c = newConstant(CPlong, val);		l = newLabel();		l->type = Lconstant;		l->at = 0;		l->to = (uintp)c;		l->from = 0;#if defined(HAVE_load_constpool_long)		slot_slot_const(dst, 0, (jword)l, HAVE_load_constpool_long, Tnull);#else		slot_alloctmp(tmp);		move_label_const(tmp, l);		load_long(dst, tmp);		slot_freetmp(tmp);#endif	}#else	move_int_const(LSLOT(dst), (jint)(val & 0xFFFFFFFF));	move_int_const(HSLOT(dst), (jint)((val >> 32) & 0xFFFFFFFF));#endif}voidmove_float_const(SlotInfo* dst, float val){#if defined(HAVE_move_float_const)	if (HAVE_move_float_const_rangecheck(val)) {		slot_slot_fconst(dst, 0, val, HAVE_move_float_const, Tconst);	}	else#endif	{		constpool *c;		label* l;		c = newConstant(CPfloat, val);		l = newLabel();		l->type = Lconstant;		l->at = 0;		l->to = (uintp)c;		l->from = 0;#if defined(HAVE_load_constpool_float)		slot_slot_const(dst, 0, (jword)l, HAVE_load_constpool_float, Tnull);#else		{			SlotInfo* tmp;			slot_alloctmp(tmp);			move_label_const(tmp, l);			load_float(dst, tmp);			slot_freetmp(tmp);		}#endif	}}voidmove_double_const(SlotInfo* dst, jdouble val){#if defined(HAVE_move_double_const)	if (HAVE_move_double_const_rangecheck(val)) {		lslot_slot_fconst(dst, 0, val, HAVE_move_double_const, Tconst);	}	else#endif	{		constpool *c;		label* l;		c = newConstant(CPdouble, val);		l = newLabel();		l->type = Lconstant;		l->at = 0;		l->to = (uintp)c;		l->from = 0;#if defined(HAVE_load_constpool_double)		lslot_lslot_const(dst, 0, (jword)l, HAVE_load_constpool_double, Tnull);#else		{			SlotInfo* tmp;			slot_alloctmp(tmp);			move_label_const(tmp, l);			load_double(dst, tmp);			slot_freetmp(tmp);		}#endif	}}#if defined(HAVE_move_any)voidmove_any(SlotInfo* dst, SlotInfo* src){	if (dst == src) {	}	else if (isGlobal(dst->slot)) {		slot_slot_slot(dst, 0, src, HAVE_move_any, Tcopy);	}	else {		copyslots(dst, src, Rref);	}}#endif#if defined(HAVE_move_int)voidmove_int(SlotInfo* dst, SlotInfo* src){	if (dst == src) {	}#if defined(HAVE_move_int_const)	else if (slot_type(src) == Tconst) {		move_int_const(dst, slot_value(src).i);	}#endif	else if (isGlobal(dst->slot)) {		slot_slot_slot(dst, 0, src, HAVE_move_int, Tcopy);	}	else {		copyslots(dst, src, Rint);	}}#endifvoidmove_ref(SlotInfo* dst, SlotInfo* src){	if (dst == src) {	}#if defined(HAVE_move_ref_const)	else if (slot_type(src) == Tconst) {		move_ref_const(dst, slot_value(src).l);	}#endif	else if (isGlobal(dst->slot)) {		slot_slot_slot(dst, 0, src, HAVE_move_ref, Tcopy);	}	else {		copyslots(dst, src, Rref);	}}voidmove_anylong(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_move_anylong)	lslot_lslot_lslot(dst, 0, src, HAVE_move_anylong, Tcopy);#else	assert(LSLOT(dst) != HSLOT(src));	move_any(LSLOT(dst), LSLOT(src));	move_any(HSLOT(dst), HSLOT(src));#endif}voidmove_long(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_move_long)	lslot_lslot_lslot(dst, 0, src, HAVE_move_long, Tcopy);#else	assert(LSLOT(dst) != HSLOT(src));	move_int(LSLOT(dst), LSLOT(src));	move_int(HSLOT(dst), HSLOT(src));#endif}voidmove_float(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_move_float)	slot_slot_slot(dst, 0, src, HAVE_move_float, Tcopy);#elif defined(HAVE_NO_FLOATING_POINT)	move_int(dst, src);#else	ABORT();#endif}voidmove_double(SlotInfo* dst, SlotInfo* src){#if defined(HAVE_move_double)	lslot_lslot_lslot(dst, 0, src, HAVE_move_double, Tcopy);#elif defined(HAVE_NO_FLOATING_POINT)	move_long(dst, src);#else	ABORT();#endif}#if defined(HAVE_move_label_const)voidmove_label_const(SlotInfo* dst, label* lab){	slot_slot_const(dst, 0, (jword)lab, HAVE_move_label_const, Tnull);}#endifvoidswap_any(SlotInfo* src, SlotInfo* src2){#if defined(HAVE_swap_any)	slot_slot_slot(src, 0, src2, HAVE_swap_any, Tcomplex);#else	SlotInfo* tmp;	slot_alloctmp(tmp);	move_ref(tmp, src);	move_ref(src, src2);	move_ref(src2, tmp);	slot_freetmp(tmp);#endif}/* ----------------------------------------------------------------------- *//* Arithmetic operators - add, sub, etc.				   *//*									   */#if defined(HAVE_adc_int)voidadc_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_adc_int, Tcomplex);}#endif#if defined(HAVE_add_int)void_add_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_add_int, Tcomm);}voidadd_int_const(SlotInfo* dst, SlotInfo* src, jint val){#if defined(HAVE_add_int_const)	if (HAVE_add_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_add_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_add_int(dst, src, tmp);		slot_freetmp(tmp);	}}voidadd_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_add_int_const)	if (slot_type(src) == Tconst) {#if 0		/* Disabled as it does not clear Carry and breaks                   add_long() on ARM */		if (slot_type(src2) == Tconst) {			move_int_const(dst, slot_value(src).i + slot_value(src2).i);		}		else#endif		{			add_int_const(dst, src2, slot_value(src).i);		}	}	else if (slot_type(src2) == Tconst) {		add_int_const(dst, src, slot_value(src2).i);	}	else#endif	_add_int(dst, src, src2);}#endif#if defined(HAVE_add_ref)void_add_ref(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_add_ref, Tcomm);}voidadd_ref_const(SlotInfo* dst, SlotInfo* src, jint val){#if defined(HAVE_add_ref_const)	if (HAVE_add_ref_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_add_ref_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		_add_ref(dst, src, tmp);		slot_freetmp(tmp);	}}voidadd_ref(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	_add_ref(dst, src, src2);}#endif#if defined(HAVE_set_lt_int)voidset_lt_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_set_lt_int, Tcomplex);}#endif#if defined(HAVE_set_lt_int_const)voidset_lt_int_const(SlotInfo* dst, SlotInfo* src, jint val){	slot_slot_const(dst, src, val, HAVE_set_lt_int_const, Tcomplex);}#endifvoidadd_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_add_long)	lslot_lslot_lslot(dst, src, src2, HAVE_add_long, Tcomplex);#elif defined(HAVE_adc_int)	add_int(LSLOT(dst), LSLOT(src), LSLOT(src2));	adc_int(HSLOT(dst), HSLOT(src), HSLOT(src2));#elif defined(HAVE_set_lt_int)	SlotInfo* res,*carry;	slot_alloctmp(res);	slot_alloctmp(carry);	add_int(res, LSLOT(src), LSLOT(src2));	set_lt_int(carry, res, LSLOT(src2));	add_int(carry, HSLOT(src), carry);	add_int(HSLOT(dst), carry, HSLOT(src2));	move_int(LSLOT(dst),res);	slot_freetmp(res);	slot_freetmp(carry);#else	ABORT();#endif}#if defined(HAVE_add_long_const)voidadd_long_const(SlotInfo* dst, SlotInfo* src, jlong val){	if (HAVE_add_long_const_rangecheck(val)) {		lslot_lslot_lconst(dst, src, val, HAVE_add_long_const, Tcomplex);	}	else	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_long_const(tmp, val);		add_long(dst, src, tmp);		slot_freetmp(tmp);	}}#endifvoidadd_float(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_add_float)	slot_slot_slot(dst, src, src2, HAVE_add_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_fadd);	popargs();	end_func_sync();	return_float(dst);#endif}voidadd_double(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_add_double)	lslot_lslot_lslot(dst, src, src2, HAVE_add_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_faddl);	popargs();	end_func_sync();	return_double(dst);#endif}#if defined(HAVE_sbc_int)voidsbc_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){	slot_slot_slot(dst, src, src2, HAVE_sbc_int, Tcomplex);}#endifvoidsub_int_const(SlotInfo* dst, SlotInfo* src, jint val){#if defined(HAVE_sub_int_const)	if (HAVE_sub_int_const_rangecheck(val)) {		slot_slot_const(dst, src, val, HAVE_sub_int_const, Tcomplex);	}	else#endif	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_int_const(tmp, val);		sub_int(dst, src, tmp);		slot_freetmp(tmp);	}}#if defined(HAVE_sub_int)voidsub_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_sub_int_const)	if (slot_type(src2) == Tconst) {		sub_int_const(dst, src, slot_value(src2).i);	}	else#endif	slot_slot_slot(dst, src, src2, HAVE_sub_int, Tcomplex);}#endifvoidsub_long(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_sub_long)	lslot_lslot_lslot(dst, src, src2, HAVE_sub_long, Tcomplex);#elif defined(HAVE_sbc_int)	sub_int(LSLOT(dst), LSLOT(src), LSLOT(src2));	sbc_int(HSLOT(dst), HSLOT(src), HSLOT(src2));#elif defined(HAVE_set_lt_int)        SlotInfo* carry;        slot_alloctmp(carry);        set_lt_int(carry, LSLOT(src), LSLOT(src2));        sub_int(carry, HSLOT(src), carry);        sub_int(HSLOT(dst), carry, HSLOT(src2));        sub_int(LSLOT(dst), LSLOT(src), LSLOT(src2));	slot_freetmp(carry);#else	ABORT();#endif}#if defined(HAVE_sub_long_const)voidsub_long_const(SlotInfo* dst, SlotInfo* src, jlong val){	if (HAVE_sub_long_const_rangecheck(val)) {		lslot_lslot_lconst(dst, src, val, HAVE_sub_long_const, Tcomplex);	}	else	{		SlotInfo* tmp;		slot_alloctmp(tmp);		move_long_const(tmp, val);		sub_long(dst, src, tmp);		slot_freetmp(tmp);	}}#endifvoidsub_float(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_sub_float)	slot_slot_slot(dst, src, src2, HAVE_sub_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_fsub);	popargs();	end_func_sync();	return_float(dst);#endif}voidsub_double(SlotInfo* dst, SlotInfo* src, SlotInfo* src2){#if defined(HAVE_sub_double)	lslot_lslot_lslot(dst, src, src2, HAVE_sub_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_fsubl);	popargs();	end_func_sync();	return_double(dst);#endif}intmul_int_const_optimize(SlotInfo* dst, SlotInfo* src, jint val){	switch (val) {	case 2:		lshl_int_const(dst, src, 1);		break;	case 4:		lshl_int_const(dst, src, 2);		break;	case 8:		lshl_int_const(dst, src, 3);		break;	case 16:		lshl_int_const(dst, src, 4);		break;	default:		return (0);	}	return (1);}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)#if 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	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_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);

⌨️ 快捷键说明

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