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/compiler/CodeGen/main/code-string.sml
ViewVC logotype

Annotation of /sml/trunk/compiler/CodeGen/main/code-string.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2162 - (view) (download)

1 : monnier 245 (* code-string.sml
2 :     *
3 :     * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
4 :     *)
5 :    
6 :     structure CodeString : CODE_STRING =
7 :     struct
8 :    
9 :     type code_string = CodeObj.code_object
10 :    
11 :     val obj = ref (NONE : CodeObj.code_object option)
12 :     val arr = ref (Word8Array.array(0, 0w0))
13 :    
14 :     fun init sz = let
15 : blume 986 val co = CodeObj.alloc sz
16 : monnier 245 in
17 :     obj := SOME co;
18 :     arr := CodeObj.bytes co
19 :     end
20 :    
21 :     fun update (i, b) = Word8Array.update (!arr, i, b)
22 :    
23 : blume 1128 fun getCodeString ep = let
24 : monnier 245 val co = valOf(!obj)
25 :     in
26 : blume 1128 CodeObj.set_entrypoint (co, ep);
27 : monnier 245 arr := Word8Array.array(0, 0w0);
28 :     obj := NONE;
29 :     co
30 :     end
31 :    
32 :     end;
33 :    

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