|
|
1.1 root 1: (* Copyright 1989 by AT&T Bell Laboratories *)
2: structure Unboxed : sig structure Basics : BASICS
3: val unboxedAssign : Basics.ty -> Access.primop
4: val unboxedUpdate : Basics.ty -> Access.primop
5: end =
6: struct
7:
8: structure Basics = Basics
9: open Access Prim Basics BasicTypes
10: val intStamp = TypesUtil.tycStamp(!intTycon)
11: fun alwaysunboxed ty =
12: case ty
13: of VARty(ref(INSTANTIATED t)) => alwaysunboxed t
14: | VARty _ => false
15: | CONty(ref(TYCON{kind=DATAtyc dcons,...}), _) =>
16: not(exists (fn (DATACON{rep=CONSTANT _,...})=>false
17: | _ => true)
18: dcons)
19: | CONty(ref tyc,_) => let val ans = TypesUtil.tycStamp tyc = intStamp
20: in if !System.Control.debugging
21: then (print "tr: "; PrintType.printTycon tyc;
22: print "\n";
23: if ans then print "ans: true\n"
24: else print "ans: false\n")
25: else ();
26: ans
27: end
28: | _ => false (* impossible ? *)
29:
30: fun unboxedAssign(CONty(_,[CONty(_,[_,VARty(ref(INSTANTIATED ty))]),_])) =
31: if alwaysunboxed ty then P.unboxedassign else P.:=
32: | unboxedAssign _ = P.:=
33:
34: fun unboxedUpdate(CONty(_,[CONty(_,[_,_,VARty(ref(INSTANTIATED ty))]),_]))=
35: if alwaysunboxed ty then P.unboxedupdate else P.update
36: | unboxedUpdate _ = P.update
37:
38: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.