Skip to content

swift_autoDiffAllocateSubContext(____)

0x41c edited this page Feb 28, 2022 · 1 revision

swift_autoDiffAllocateSubContext(_:_:)

For this section, UnsafeRawPointer is in place of AutoDiffLinearMapContext; of course, this is here until we exchange the code with the type implementation. I'm thinking that it would be cool to just rewrite the AutoDiffLinearMapContext to tail allocate the initial slab. This would cover their TODO and it would be in swift. Two big bonuses.

@_silgen_name("swift_autoDiffAllocateSubcontext")
public func swift_autoDiffAllocateSubContext(
    _ instance: UnsafeRawPointer,
    _ size: Int
) -> UnsafeRawPointer

Allocates the memory needed to create a new subcontext then returns the memory back to the caller. The allocation is handled by the instances allocator.

Parameters

  • instance: The instance of the AutoDiffLinearMapContext
  • size: The size of the context to allocate memory for.

Returns

A pointer to the base of the new memory.

Types
Protocols
Global Typealiases
Global Functions
Clone this wiki locally