Native: switch to "Native" thread state for some Obj-C runtime calls
A lot of calls to Objective-C runtime are potentially blocking. This commit adds a number of thread state switches to ensure these Obj-C runtime calls happen in "Native" thread state. Also, remove a bunch of such functions from CallsChecker exclude list.
This commit is contained in:
committed by
Space
parent
2e8c25aeff
commit
ad1b10cdb0
@@ -135,6 +135,9 @@ void DisposeCString(char* cstring) {
|
||||
}
|
||||
|
||||
ObjHeader* CreatePermanentStringFromCString(const char* nullTerminatedUTF8) {
|
||||
// Note: this function can be called in "Native" thread state. But this is fine:
|
||||
// while it indeed manipulates Kotlin objects, it doesn't in fact access _Kotlin heap_,
|
||||
// because the accessed object is off-heap, imitating permanent static objects.
|
||||
const char* end = nullTerminatedUTF8 + strlen(nullTerminatedUTF8);
|
||||
size_t count = utf8::with_replacement::utf16_length(nullTerminatedUTF8, end);
|
||||
size_t headerSize = alignUp(sizeof(ArrayHeader), alignof(char16_t));
|
||||
|
||||
Reference in New Issue
Block a user