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

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/control/mlrisc-profiling.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/control/mlrisc-profiling.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 114 - (download) (annotate)
Fri Jun 5 19:41:21 1998 UTC (21 years, 4 months ago) by monnier
File size: 1815 byte(s)
This commit was generated by cvs2svn to compensate for changes in r113,
which included commits to RCS files with non-trunk default branches.
signature MLRISC_PROFILING =
sig

   val profiling        : bool ref
   val use_profile_info : bool ref
   val edge_counts      : int Array.array Array.array ref
   val edge_table       : (int * int) list Array.array ref
   val module_table     : (string * int * int) list ref
   val module           : string ref
   val cluster_id       : int ref
   val new_cluster      : int * (int * int) list -> unit
   val get_cluster_id   : (unit -> int) ref

end

structure MLRISC_Profiling : MLRISC_PROFILING =
struct

   structure A = Array

   val profiling        = ref false
   val use_profile_info = ref false    
   val edge_counts      = ref A.array0 : int A.array A.array ref
   val edge_table       = ref A.array0 : (int * int) list A.array ref
   val module_table     = ref []       : (string * int * int) list ref
   val module           = ref ""
   val cluster_id       = ref 0

   fun get_id() = let val id = !cluster_id in cluster_id := 1 + id; id end

   val get_cluster_id = ref get_id

   fun initialize() = Unsafe.setVar(!edge_counts)

   fun grow n =
   let val m = A.length(!edge_counts) * 2
       val m = if m < n then n else m
       val m = if m < 10 then 10 else m
       val new_edge_counts = A.array(m,A.array0)
       val new_edge_table  = A.array(m,[])
   in  A.copy{src= !edge_counts, dst=new_edge_counts,si=0,di=0,len=NONE};
       edge_counts := new_edge_counts;
       A.copy{src= !edge_table,  dst=new_edge_table, si=0,di=0,len=NONE};
       edge_table := new_edge_table;
       initialize()
   end

   fun new_cluster(cluster_id,edges) =
      let val n = length edges
      in  if A.length(!edge_counts) <= cluster_id then grow cluster_id else ();
          A.update(!edge_table,cluster_id,edges);
          A.update(!edge_counts,cluster_id,A.array(n,0))
      end

end

(*
 * $Log$
 *)

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