@@ -8,6 +8,36 @@ import back::link;
8
8
import lib:: llvm:: llvm;
9
9
import llvm:: { ValueRef , TypeRef , LLVMGetParam } ;
10
10
11
+ // Translation functionality related to impls and ifaces
12
+ //
13
+ // Terminology:
14
+ // vtable: a table of function pointers pointing to method wrappers
15
+ // of an impl that implements an iface
16
+ // dict: a record containing a vtable pointer along with pointers to
17
+ // all tydescs and other dicts needed to run methods in this vtable
18
+ // (i.e. corresponding to the type parameters of the impl)
19
+ // wrapper: a function that takes a dict as first argument, along
20
+ // with the method-specific tydescs for a method (and all
21
+ // other args the method expects), which fetches the extra
22
+ // tydescs and dicts from the dict, splices them into the
23
+ // arglist, and calls through to the actual method
24
+ //
25
+ // Generic functions take, along with their normal arguments, a number
26
+ // of extra tydesc and dict arguments -- one tydesc for each type
27
+ // parameter, one dict (following the tydesc in the arg order) for
28
+ // each interface bound on a type parameter.
29
+ //
30
+ // Most dicts are completely static, and are allocated and filled at
31
+ // compile time. Dicts that depend on run-time values (tydescs or
32
+ // dicts for type parameter types) are built at run-time, and interned
33
+ // through upcall_intern_dict in the runtime. This means that dict
34
+ // pointers are self-contained things that do not need to be cleaned
35
+ // up.
36
+ //
37
+ // The trans_constants pass in trans.rs outputs the vtables. Typeck
38
+ // annotates notes with information about the methods and dicts that
39
+ // are referenced (ccx.method_map and ccx.dict_map).
40
+
11
41
fn trans_impl ( cx : @local_ctxt , name : ast:: ident , methods : [ @ast:: method ] ,
12
42
id : ast:: node_id , tps : [ ast:: ty_param ] ) {
13
43
let sub_cx = extend_path ( cx, name) ;
0 commit comments