Representation of Data Structures in OCAML - PowerPoint PPT Presentation

About This Presentation
Title:

Representation of Data Structures in OCAML

Description:

size. tag. color (GC) tag: distinguish constructors of a type ... g x = ... and. h x y = ...;; other. globals. start offset. start offset. size. f. g. h ... – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 7
Provided by: sei76
Category:

less

Transcript and Presenter's Notes

Title: Representation of Data Structures in OCAML


1
Representation ofData Structuresin OCAML
2
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
0
7
8
9
10
31
tag
size
color (GC)
  • tag
  • distinguish constructors of a type
  • 0 lt tag lt 247 for tuples, arrays, constructor
    terms

5
Special Tags (gt 248)
  • 248 objects
  • 249, 250 functions (see below)
  • gt 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
249
start offset
h
PC
otherglobals
Write a Comment
User Comments (0)
About PowerShow.com