File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
#ifndef cruntime_h
2
2
#define cruntime_h
3
3
4
+ #include <stdlib.h>
5
+
4
6
const void * _Nullable swift_getTypeByMangledNameInContext (
5
7
const char * _Nullable typeNameStart ,
6
8
int typeNameLength ,
@@ -9,7 +11,7 @@ const void * _Nullable swift_getTypeByMangledNameInContext(
9
11
10
12
const void * _Nullable swift_allocObject (
11
13
const void * _Nullable type ,
12
- int requiredSize ,
13
- int requiredAlignmentMask );
14
+ size_t requiredSize ,
15
+ size_t requiredAlignmentMask );
14
16
15
17
#endif
Original file line number Diff line number Diff line change @@ -61,13 +61,13 @@ func buildClass(type: Any.Type) throws -> Any {
61
61
var md = ClassMetadata ( type: type)
62
62
let info = md. toTypeInfo ( )
63
63
let metadata = unsafeBitCast ( type, to: UnsafeRawPointer . self)
64
- let instanceSize = Int32 ( md. pointer. pointee. instanceSize)
64
+ let instanceSize = Int ( md. pointer. pointee. instanceSize)
65
65
66
66
// https://github.com/wickwirew/Runtime/issues/49
67
67
// Docs specify that the alignment should be "always one less than a power of 2 that's at least alignof(void*)"
68
68
// https://github.com/apple/swift/blob/7123d2614b5f222d03b3762cb110d27a9dd98e24/include/swift/Runtime/HeapObject.h#L56-L57
69
69
// We could use md.alignment and deduct 1, or just use the instanceAlignmentMask from the ClassMetadata.
70
- let alignmentMask = Int32 ( md. pointer. pointee. instanceAlignmentMask)
70
+ let alignmentMask = Int ( md. pointer. pointee. instanceAlignmentMask)
71
71
72
72
guard let value = swift_allocObject ( metadata, instanceSize, alignmentMask) else {
73
73
throw RuntimeError . unableToBuildType ( type: type)
You can’t perform that action at this time.
0 commit comments