1 / 6

Representation of Data Structures in OCAML

Representation of Data Structures in OCAML. Outside Heap. pointer. Register. Heap. int value. 1. Header. Register. Register. pointer. „Block“. Register. Encoding. int value encodes integer nullary constructor conversion for int values shl(x,1) + 1 shr(x,1)

Download Presentation

Representation of Data Structures in OCAML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Representation ofData Structuresin OCAML

  2. Outside Heap ... pointer Register Heap int value 1 Header Register Register pointer „Block“ ... Register

  3. Encoding • int value encodes • integer • nullary constructor • conversion for int values • shl(x,1) + 1 • shr(x,1) • no conversion for pointers neededblocks are word aligned  lowest bit is 0 • loose 1 bit for int representation • no loss in address space

  4. Header 31 10 9 7 0 8 tag size color (GC) tag: • distinguish constructors of a type • 0 <= tag <= 247 for tuples, arrays, constructor terms

  5. Special Tags (>= 248) • 248: objects • 249, 250: functions (see below) • >= 251: non-heap data (GC does not look inside) • 251: unused • 252: strings • 253: floats • 254: float arrays • 255: finalization

  6. (Recursive) Functions 250 size f PC start offset 249 let rec f x = ...and g x = ...and h x y = ...;; g PC start offset 249 h PC otherglobals

More Related