@@ -551,6 +551,22 @@ set_simple_type_and_var (TransformData *td, StackInfo *sp, int type)
551
551
set_type_and_var (td , sp , type , NULL );
552
552
}
553
553
554
+ static void
555
+ push_mono_type (TransformData * td , MonoType * type , int mt , MonoClass * k )
556
+ {
557
+ if (mt == -1 )
558
+ mt = mono_mint_type (type );
559
+ if (!k )
560
+ k = mono_class_from_mono_type_internal (type );
561
+
562
+ g_assert (mt != MINT_TYPE_VT );
563
+
564
+ if (m_type_is_byref (type ))
565
+ push_type_explicit (td , STACK_TYPE_MP , k , MINT_STACK_SLOT_SIZE );
566
+ else
567
+ push_type_explicit (td , stack_type [mt ], k , MINT_STACK_SLOT_SIZE );
568
+ }
569
+
554
570
static void
555
571
push_type (TransformData * td , int type , MonoClass * k )
556
572
{
@@ -1006,7 +1022,7 @@ load_arg(TransformData *td, int n)
1006
1022
if (hasthis && n == 0 ) {
1007
1023
mt = MINT_TYPE_I ;
1008
1024
klass = NULL ;
1009
- push_type (td , stack_type [ mt ] , klass );
1025
+ push_type (td , STACK_TYPE_MP , klass );
1010
1026
} else {
1011
1027
g_assert (size < G_MAXUINT16 );
1012
1028
push_type_vt (td , klass , size );
@@ -1020,7 +1036,7 @@ load_arg(TransformData *td, int n)
1020
1036
if (mt == MINT_TYPE_O )
1021
1037
klass = mono_class_from_mono_type_internal (type );
1022
1038
}
1023
- push_type (td , stack_type [ mt ] , klass );
1039
+ push_mono_type (td , type , mt , klass );
1024
1040
}
1025
1041
interp_add_ins (td , interp_get_mov_for_type (mt , TRUE));
1026
1042
interp_ins_set_sreg (td -> last_ins , n );
@@ -1069,7 +1085,7 @@ load_local (TransformData *td, int local)
1069
1085
MonoClass * klass = NULL ;
1070
1086
if (mt == MINT_TYPE_O )
1071
1087
klass = mono_class_from_mono_type_internal (type );
1072
- push_type (td , stack_type [ mt ] , klass );
1088
+ push_mono_type (td , type , mt , klass );
1073
1089
}
1074
1090
interp_add_ins (td , interp_get_mov_for_type (mt , TRUE));
1075
1091
interp_ins_set_sreg (td -> last_ins , local );
@@ -3699,7 +3715,7 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
3699
3715
return FALSE;
3700
3716
}
3701
3717
} else {
3702
- push_type (td , stack_type [ mt ] , klass );
3718
+ push_mono_type (td , csignature -> ret , mt , klass );
3703
3719
}
3704
3720
dreg = td -> sp [-1 ].var ;
3705
3721
} else {
@@ -4570,7 +4586,7 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi
4570
4586
interp_add_ins (td , interp_get_ldind_for_mt (mt ));
4571
4587
interp_ins_set_sreg (td -> last_ins , td -> sp [-1 ].var );
4572
4588
td -> sp -- ;
4573
- push_type (td , stack_type [ mt ] , field_class );
4589
+ push_mono_type (td , ftype , mt , field_class );
4574
4590
interp_ins_set_dreg (td -> last_ins , td -> sp [-1 ].var );
4575
4591
}
4576
4592
} else {
@@ -4597,14 +4613,14 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi
4597
4613
if (mt == MINT_TYPE_VT ) {
4598
4614
push_type_vt (td , field_class , size );
4599
4615
} else {
4600
- push_type (td , stack_type [ mt ] , field_class );
4616
+ push_mono_type (td , ftype , mt , field_class );
4601
4617
}
4602
4618
} else if (mt == MINT_TYPE_VT ) {
4603
4619
interp_add_ins (td , MINT_LDSFLD_VT );
4604
4620
push_type_vt (td , field_class , size );
4605
4621
} else {
4606
4622
interp_add_ins (td , MINT_LDSFLD_I1 + mt - MINT_TYPE_I1 );
4607
- push_type (td , stack_type [ mt ] , field_class );
4623
+ push_mono_type (td , ftype , mt , field_class );
4608
4624
}
4609
4625
interp_ins_set_dreg (td -> last_ins , td -> sp [-1 ].var );
4610
4626
} else {
@@ -6711,7 +6727,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
6711
6727
if (mt == MINT_TYPE_VT )
6712
6728
push_type_vt (td , field_klass , field_size );
6713
6729
else
6714
- push_type (td , stack_type [ mt ] , field_klass );
6730
+ push_mono_type (td , ftype , mt , field_klass );
6715
6731
interp_ins_set_dreg (td -> last_ins , td -> sp [-1 ].var );
6716
6732
} else {
6717
6733
if (G_UNLIKELY (m_field_is_from_update (field ))) {
@@ -6741,7 +6757,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
6741
6757
if (mt == MINT_TYPE_VT )
6742
6758
push_type_vt (td , field_klass , field_size );
6743
6759
else
6744
- push_type (td , stack_type [ mt ] , field_klass );
6760
+ push_mono_type (td , ftype , mt , field_klass );
6745
6761
interp_ins_set_dreg (td -> last_ins , td -> sp [-1 ].var );
6746
6762
}
6747
6763
}
@@ -7697,8 +7713,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
7697
7713
int param_offset = get_tos_offset (td );
7698
7714
7699
7715
if (!MONO_TYPE_IS_VOID (info -> sig -> ret )) {
7700
- mt = mono_mint_type (info -> sig -> ret );
7701
- push_simple_type (td , stack_type [mt ]);
7716
+ push_mono_type (td , info -> sig -> ret , -1 , NULL );
7702
7717
dreg = td -> sp [-1 ].var ;
7703
7718
} else {
7704
7719
// dummy dreg
0 commit comments