PreviousUpNext

14.4.126  Unsafe_Chunk

The standard library Unsafe_Chunk api defines access to various functions coercing raw memory pointers to various types. This provides the equivalent of C pointer type casts for low-level code which needs it. Caveat Hacker! This also allows you to corrupt the heap arbitarily. Here be monsters.

The Unsafe_Chunk api is implemented by the unsafe_chunk package from src/lib/std/src/unsafe/unsafe-chunk.pkg.

The Unsafe_Chunk api source code is in src/lib/std/src/unsafe/unsafe-chunk.api.

The above information is manually maintained and may contain errors.

api {    Chunk ;
    Representation 
      = BYTE_RO_VECTOR
      | BYTE_RW_VECTOR
      | FLOAT64
      | FLOAT64_RW_VECTOR
      | LAZY_SUSPENSION
      | PAIR
      | RECORD
      | REF
      | TYPEAGNOSTIC_RO_VECTOR
      | TYPEAGNOSTIC_RW_VECTOR
      | UNBOXED
      | UNT1
      | WEAK_POINTER;
    to_chunk : X -> Chunk;
    make_tuple : List(Chunk ) -> Chunk;
    boxed : Chunk -> Bool;
    unboxed : Chunk -> Bool;
    rep : Chunk -> Representation;
    length : Chunk -> Int;
    exception REPRESENTATION;
    to_tuple : Chunk -> List(Chunk );
    to_string : Chunk -> String;
    to_ref : Chunk -> Ref(Chunk );
    to_rw_vector : Chunk -> Rw_Vector(Chunk );
    to_float64_rw_vector : Chunk -> rw_vector_of_eight_byte_floats::Rw_Vector;
    to_byte_rw_vector : Chunk -> rw_vector_of_one_byte_unts::Rw_Vector;
    to_vector : Chunk -> ?.Vector(Chunk );
    to_byte_vector : Chunk -> vector_of_one_byte_unts::Vector;
    to_exn : Chunk -> Exception;
    to_float : Chunk -> Float;
    to_int : Chunk -> Int;
    to_int1 : Chunk -> one_word_int::Int;
    to_unt : Chunk -> Unt;
    to_unt8 : Chunk -> one_byte_unt::Unt;
    to_unt1 : Chunk -> one_word_unt::Unt;
    nth : (Chunk , Int) -> Chunk;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext