@@ -1157,6 +1157,7 @@ mono_allocate_stack_slots2 (MonoCompile *cfg, gboolean backward, guint32 *stack_
1157
1157
StackSlotInfo * scalar_stack_slots , * vtype_stack_slots , * slot_info ;
1158
1158
MonoType * t ;
1159
1159
int nvtypes ;
1160
+ int vtype_stack_slots_size = 256 ;
1160
1161
gboolean reuse_slot ;
1161
1162
1162
1163
LSCAN_DEBUG (printf ("Allocate Stack Slots 2 for %s:\n" , mono_method_full_name (cfg -> method , TRUE)));
@@ -1235,14 +1236,22 @@ mono_allocate_stack_slots2 (MonoCompile *cfg, gboolean backward, guint32 *stack_
1235
1236
/* Fall through */
1236
1237
case MONO_TYPE_VALUETYPE :
1237
1238
if (!vtype_stack_slots )
1238
- vtype_stack_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * 256 );
1239
+ vtype_stack_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * vtype_stack_slots_size );
1239
1240
for (i = 0 ; i < nvtypes ; ++ i )
1240
1241
if (t -> data .klass == vtype_stack_slots [i ].vtype )
1241
1242
break ;
1242
1243
if (i < nvtypes )
1243
1244
slot_info = & vtype_stack_slots [i ];
1244
1245
else {
1245
- g_assert (nvtypes < 256 );
1246
+ if (nvtypes == vtype_stack_slots_size ) {
1247
+ int new_slots_size = vtype_stack_slots_size * 2 ;
1248
+ StackSlotInfo * new_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * new_slots_size );
1249
+
1250
+ memcpy (new_slots , vtype_stack_slots , sizeof (StackSlotInfo ) * vtype_stack_slots_size );
1251
+
1252
+ vtype_stack_slots = new_slots ;
1253
+ vtype_stack_slots_size = new_slots_size ;
1254
+ }
1246
1255
vtype_stack_slots [nvtypes ].vtype = t -> data .klass ;
1247
1256
slot_info = & vtype_stack_slots [nvtypes ];
1248
1257
nvtypes ++ ;
@@ -1468,6 +1477,7 @@ mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_s
1468
1477
StackSlotInfo * scalar_stack_slots , * vtype_stack_slots , * slot_info ;
1469
1478
MonoType * t ;
1470
1479
int nvtypes ;
1480
+ int vtype_stack_slots_size = 256 ;
1471
1481
gboolean reuse_slot ;
1472
1482
1473
1483
if ((cfg -> num_varinfo > 0 ) && MONO_VARINFO (cfg , 0 )-> interval )
@@ -1533,14 +1543,22 @@ mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_s
1533
1543
/* Fall through */
1534
1544
case MONO_TYPE_VALUETYPE :
1535
1545
if (!vtype_stack_slots )
1536
- vtype_stack_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * 256 );
1546
+ vtype_stack_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * vtype_stack_slots_size );
1537
1547
for (i = 0 ; i < nvtypes ; ++ i )
1538
1548
if (t -> data .klass == vtype_stack_slots [i ].vtype )
1539
1549
break ;
1540
1550
if (i < nvtypes )
1541
1551
slot_info = & vtype_stack_slots [i ];
1542
1552
else {
1543
- g_assert (nvtypes < 256 );
1553
+ if (nvtypes == vtype_stack_slots_size ) {
1554
+ int new_slots_size = vtype_stack_slots_size * 2 ;
1555
+ StackSlotInfo * new_slots = (StackSlotInfo * )mono_mempool_alloc0 (cfg -> mempool , sizeof (StackSlotInfo ) * new_slots_size );
1556
+
1557
+ memcpy (new_slots , vtype_stack_slots , sizeof (StackSlotInfo ) * vtype_stack_slots_size );
1558
+
1559
+ vtype_stack_slots = new_slots ;
1560
+ vtype_stack_slots_size = new_slots_size ;
1561
+ }
1544
1562
vtype_stack_slots [nvtypes ].vtype = t -> data .klass ;
1545
1563
slot_info = & vtype_stack_slots [nvtypes ];
1546
1564
nvtypes ++ ;
0 commit comments