Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/compiler/CodeGen/main/object-desc.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/CodeGen/main/object-desc.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (view) (download)
Original Path: sml/branches/SMLNJ/src/compiler/CodeGen/main/object-desc.sml

1 : monnier 93 (* object-desc.sml
2 : monnier 41 *
3 :     * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
4 :     *
5 :     * The encoding of object description headers.
6 :     *
7 :     * WARNING: this file must agree with the run-time system values and those
8 :     * used in boot/core.sml and boot/Unsafe/object.sml.
9 :     *)
10 :    
11 :     structure ObjectDesc :> OBJECT_DESC =
12 :     struct
13 :    
14 :     type tag = word
15 :    
16 :     structure W = Word
17 :     structure LW = LargeWord
18 :    
19 :     (* taken from runtime/tags.h *)
20 :     val tagWidth = 6 (* 4 minor tag bits plus 2 major tag bits *)
21 :     (* one greater than the maximum length field value (sign should be 0) *)
22 :     val maxLength = W.toInt(W.<<(0w1, W.-(0w31, W.fromInt tagWidth)))
23 :     val powTagWidth = W.toInt(W.<<(0w1, W.fromInt tagWidth))
24 :    
25 :     (* tag values *)
26 :     local
27 :     fun tagXLen(lTag, n) = W.orb(lTag, W.<<(n, 0w2))
28 :     in
29 :     fun tagWLen n = tagXLen(0wx22, n)
30 :     fun tagWOLen n = tagXLen(0wx02, n)
31 :     end
32 :     val tag_record = tagWLen 0w0
33 :     val tag_array = tagWLen 0w1
34 :     val tag_string = tagWLen 0w2
35 :     val tag_word8array = tagWLen 0w4
36 :     val tag_realdarray = tagWLen 0w5
37 :     val tag_cont = tagWLen 0w6
38 :     val tag_block = tagWLen 0w7
39 :     val tag_pair = tagWOLen 0w0
40 :     val tag_reald = tagWOLen 0w1
41 :     val tag_variant = tagWOLen 0w3 (* currently not used *)
42 :     val tag_special = tagWOLen 0w4
43 :     val tag_backptr = tagWOLen 0w5
44 :    
45 :     (* build a descriptor from a tag and length *)
46 :     fun makeDesc (len, t) =
47 :     LW.orb(LW.<<(LW.fromInt len, W.fromInt tagWidth), W.toLargeWord t)
48 :    
49 :     (* fixed descriptors *)
50 :     val desc_pair = makeDesc(2, tag_pair)
51 :     val desc_reald = makeDesc(2, tag_reald)
52 :    
53 :     (* special descriptors *)
54 :     val desc_special = makeDesc(0, tag_special)
55 :     val special_unevaled_susp = 0
56 :     val special_evaled_susp = 1
57 :     val special_weak = 2
58 :     val special_nulled_weak = 3
59 :    
60 :     end;
61 :    
62 :     (*
63 : monnier 113 * $Log$
64 : monnier 41 *)
65 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0