@@ -26,34 +26,31 @@ public struct HeapObject {
26
26
var refcount : Int
27
27
}
28
28
29
- @_silgen_name ( " posix_memalign " )
30
- func posix_memalign( _: UnsafeMutablePointer < UnsafeMutableRawPointer ? > , _: UInt , _: UInt ) -> CInt
31
-
32
- func alignedAlloc( size: UInt , alignment: UInt ) -> UnsafeMutableRawPointer ? {
33
- let alignment = max ( alignment, UInt ( MemoryLayout< UnsafeRawPointer> . size) )
29
+ func alignedAlloc( size: Int , alignment: Int ) -> UnsafeMutableRawPointer ? {
30
+ let alignment = max ( alignment, MemoryLayout< UnsafeRawPointer> . size)
34
31
var r : UnsafeMutableRawPointer ? = nil
35
32
_ = posix_memalign ( & r, alignment, size)
36
33
return r
37
34
}
38
35
39
36
@_cdecl ( " swift_slowAlloc " )
40
- public func swift_slowAlloc( _ size: UInt , _ alignMask: UInt ) -> UnsafeMutableRawPointer ? {
41
- let alignment : UInt
42
- if alignMask == UInt . max {
43
- alignment = UInt ( _swift_MinAllocationAlignment)
37
+ public func swift_slowAlloc( _ size: Int , _ alignMask: Int ) -> UnsafeMutableRawPointer ? {
38
+ let alignment : Int
39
+ if alignMask == - 1 {
40
+ alignment = _swift_MinAllocationAlignment
44
41
} else {
45
42
alignment = alignMask + 1
46
43
}
47
44
return alignedAlloc ( size: size, alignment: alignment)
48
45
}
49
46
50
47
@_cdecl ( " swift_slowDealloc " )
51
- public func swift_slowDealloc( _ ptr: UnsafeMutableRawPointer ? , _ size: UInt , _ alignMask: UInt ) {
48
+ public func swift_slowDealloc( _ ptr: UnsafeMutableRawPointer ? , _ size: Int , _ alignMask: Int ) {
52
49
free ( ptr)
53
50
}
54
51
55
52
@_silgen_name ( " swift_allocObject " )
56
- public func swift_allocObject( metadata: UnsafeMutablePointer < ClassMetadata > , requiredSize: UInt , requiredAlignmentMask: UInt ) -> UnsafeMutablePointer < HeapObject > {
53
+ public func swift_allocObject( metadata: UnsafeMutablePointer < ClassMetadata > , requiredSize: Int , requiredAlignmentMask: Int ) -> UnsafeMutablePointer < HeapObject > {
57
54
let p = swift_slowAlloc ( requiredSize, requiredAlignmentMask) !
58
55
let object = p. assumingMemoryBound ( to: HeapObject . self)
59
56
object. pointee. metadata = metadata
@@ -62,7 +59,7 @@ public func swift_allocObject(metadata: UnsafeMutablePointer<ClassMetadata>, req
62
59
}
63
60
64
61
@_silgen_name ( " swift_deallocClassInstance " )
65
- public func swift_deallocClassInstance( object: UnsafeMutablePointer < HeapObject > , allocatedSize: UInt , allocatedAlignMask: UInt ) {
62
+ public func swift_deallocClassInstance( object: UnsafeMutablePointer < HeapObject > , allocatedSize: Int , allocatedAlignMask: Int ) {
66
63
free ( object)
67
64
}
68
65
0 commit comments