Interface RPMemoryMapCallbackI

  • All Superinterfaces:
    CallbackI, CallbackI.P, Pointer
    All Known Implementing Classes:
    RPMemoryMapCallback
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface RPMemoryMapCallbackI
    extends CallbackI.P
    Instances of this interface may be set to the RPMallocConfig struct.

    Type

    
     void * (*) (
         size_t size,
         size_t *offset
     )
    • Method Detail

      • getSignature

        default java.lang.String getSignature()
        Description copied from interface: CallbackI
        Returns the dyncall signature for this callback function. [INTERNAL API]
        Specified by:
        getSignature in interface CallbackI
        Returns:
        the dyncall signature
      • callback

        default long callback​(long args)
        Description copied from interface: CallbackI.P
        Will be called by native code.
        Specified by:
        callback in interface CallbackI.P
        Parameters:
        args - pointer to a DCArgs iterator
        Returns:
        the value to store to the result DCValue
      • invoke

        long invoke​(long size,
                    long offset)
        Map memory pages for the given number of bytes.

        The returned address MUST be aligned to the rpmalloc span size, which will always be a power of two. Optionally the function can store an alignment offset in the offset variable in case it performs alignment and the returned pointer is offset from the actual start of the memory region due to this alignment. The alignment offset will be passed to the memory unmap function. The alignment offset MUST NOT be larger than 65535 (storable in an uint16_t), if it is you must use natural alignment to shift it into 16 bits.

        If you set a memory_map function, you must also set a memory_unmap function or else the default implementation will be used for both.

        Parameters:
        size - the number of bytes to map
        offset - the alignment offset