File:  [Research Unix] / researchv10no / cmd / sml / src / translate / unboxed.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* Copyright 1989 by AT&T Bell Laboratories *)
structure Unboxed : sig structure Basics : BASICS
			val unboxedAssign : Basics.ty -> Access.primop
			val unboxedUpdate : Basics.ty -> Access.primop
		    end =
struct

  structure Basics = Basics
  open Access Prim Basics BasicTypes
  val intStamp = TypesUtil.tycStamp(!intTycon)
  fun alwaysunboxed ty =
    case ty
     of VARty(ref(INSTANTIATED t)) => alwaysunboxed t
      | VARty _  => false
      | CONty(ref(TYCON{kind=DATAtyc dcons,...}), _) =>
	    not(exists (fn (DATACON{rep=CONSTANT _,...})=>false 
			 | _ => true)
		       dcons) 
      | CONty(ref tyc,_) => let val ans = TypesUtil.tycStamp tyc = intStamp
			    in if !System.Control.debugging
			       then  (print "tr: "; PrintType.printTycon tyc;
				      print "\n";
				      if ans then print "ans: true\n"
					     else print "ans: false\n")
			       else ();
			       ans
			    end
      | _ => false (* impossible ? *)

  fun unboxedAssign(CONty(_,[CONty(_,[_,VARty(ref(INSTANTIATED ty))]),_])) =
        if alwaysunboxed ty then P.unboxedassign else P.:=
    | unboxedAssign _ = P.:=

  fun unboxedUpdate(CONty(_,[CONty(_,[_,_,VARty(ref(INSTANTIATED ty))]),_]))=
        if alwaysunboxed ty then P.unboxedupdate else P.update
    | unboxedUpdate _ = P.update
  
end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.