File: code-obj.sig

package info (click to toggle)
smlnj 110.79-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 82,564 kB
  • sloc: ansic: 32,532; asm: 6,314; sh: 2,296; makefile: 1,821; perl: 1,170; pascal: 295; yacc: 190; cs: 78; python: 77; lisp: 19
file content (58 lines) | stat: -rw-r--r-- 1,576 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(* code-obj.sig
 *
 * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
 *
 * An interface for manipulating code objects.
 *)

signature CODE_OBJ =
  sig

    type code_object

    type csegments = {
	c0 : code_object,
	cn : code_object list, 
	data : Word8Vector.vector
      }

    type executable = Unsafe.Object.object -> Unsafe.Object.object

    exception FormatError
	(* raised by input when there are insufficient bytes *)

    val alloc : int -> code_object
	(* Allocate an unintialized code object of the given number of bytes.
	 *)

    val input : (BinIO.instream * int) -> code_object
	(* Allocate a code object of the given size and initialize it
	 * from the input stream.
	 *)
    val output : (BinIO.outstream * code_object) -> unit
	(* Output a code object to the given output stream *)

    val bytes : code_object -> Word8Array.array
	(* View the code object as an updatable array of bytes. *)

    val set_entrypoint : code_object * int -> unit
        (* Set the offset of the entrypoint of the code object (default: 0). *)

    val exec : code_object -> executable
	(* View the code object as an executable.  This has the side-effect
	 * of flushing the instruction cache.
	 *)

    val size : code_object -> int
	(* return the size of the code object *)

    val entrypoint : code_object -> int
        (* return the offset of the entry point of the code object *)

    val mkLiterals : Word8Vector.vector -> Unsafe.Object.object
	(* use the run-time system interpreter to generate a literals
	 * vector from a literal bytecode program.
	 *)

  end;