Don't use heap-like slot for return in KotlinMutableSet/Dictionary
Fix #3259
This commit is contained in:
committed by
SvyatoslavScherbina
parent
33ab792465
commit
2cb2f6fe03
@@ -366,7 +366,9 @@ static inline id KSet_getElement(KRef set, id object) {
|
|||||||
-(instancetype)init {
|
-(instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
Kotlin_initRuntimeIfNeeded();
|
Kotlin_initRuntimeIfNeeded();
|
||||||
Kotlin_MutableSet_createWithCapacity(8, self->setHolder.slotToInit());
|
ObjHolder holder;
|
||||||
|
KRef set = Kotlin_MutableSet_createWithCapacity(8, holder.slot());
|
||||||
|
self->setHolder.init(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -375,7 +377,9 @@ static inline id KSet_getElement(KRef set, id object) {
|
|||||||
- (instancetype)initWithCapacity:(NSUInteger)numItems {
|
- (instancetype)initWithCapacity:(NSUInteger)numItems {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
Kotlin_initRuntimeIfNeeded();
|
Kotlin_initRuntimeIfNeeded();
|
||||||
Kotlin_MutableSet_createWithCapacity(objCCapacityToKotlin(numItems), self->setHolder.slotToInit());
|
ObjHolder holder;
|
||||||
|
KRef set = Kotlin_MutableSet_createWithCapacity(objCCapacityToKotlin(numItems), holder.slot());
|
||||||
|
self->setHolder.init(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -511,7 +515,9 @@ static inline id KMap_get(KRef map, id aKey) {
|
|||||||
-(instancetype)init {
|
-(instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
Kotlin_initRuntimeIfNeeded();
|
Kotlin_initRuntimeIfNeeded();
|
||||||
Kotlin_MutableMap_createWithCapacity(8, self->mapHolder.slotToInit());
|
ObjHolder holder;
|
||||||
|
KRef map = Kotlin_MutableMap_createWithCapacity(8, holder.slot());
|
||||||
|
self->mapHolder.init(map);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -525,7 +531,9 @@ static inline id KMap_get(KRef map, id aKey) {
|
|||||||
- (instancetype)initWithCapacity:(NSUInteger)numItems {
|
- (instancetype)initWithCapacity:(NSUInteger)numItems {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
Kotlin_initRuntimeIfNeeded();
|
Kotlin_initRuntimeIfNeeded();
|
||||||
Kotlin_MutableMap_createWithCapacity(objCCapacityToKotlin(numItems), self->mapHolder.slotToInit());
|
ObjHolder holder;
|
||||||
|
KRef map = Kotlin_MutableMap_createWithCapacity(objCCapacityToKotlin(numItems), holder.slot());
|
||||||
|
self->mapHolder.init(map);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user