Skip to content

Commit 816286e

Browse files
committed
---
yaml --- r: 7074 b: refs/heads/master c: 7b00bac h: refs/heads/master v: v3
1 parent f4effaf commit 816286e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 822acdd1703af1714cb084a76c10937713339f6d
2+
refs/heads/master: 7b00bac540ad4034906db329712d9b46e2d05719

trunk/src/comp/middle/trans_impl.rs

+30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,36 @@ import back::link;
88
import lib::llvm::llvm;
99
import llvm::{ValueRef, TypeRef, LLVMGetParam};
1010

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+
1141
fn trans_impl(cx: @local_ctxt, name: ast::ident, methods: [@ast::method],
1242
id: ast::node_id, tps: [ast::ty_param]) {
1343
let sub_cx = extend_path(cx, name);

0 commit comments

Comments
 (0)