Skip to content

Commit 2a0e0ce

Browse files
committed
---
yaml --- r: 8022 b: refs/heads/snap-stage3 c: 633e450 h: refs/heads/master v: v3
1 parent dd24476 commit 2a0e0ce

File tree

2 files changed

+38
-67
lines changed

2 files changed

+38
-67
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3bcd4fe6fa137287df34bed19eed5851f44aa703
4+
refs/heads/snap-stage3: 633e4502e76811183208b5d1e107c4ccde2ce36c
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/middle/trans/common.rs

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -135,72 +135,54 @@ type fn_ty_param = {desc: ValueRef, dicts: option<[ValueRef]>};
135135

136136
// Function context. Every LLVM function we create will have one of
137137
// these.
138-
type fn_ctxt =
138+
type fn_ctxt = {
139139
// The ValueRef returned from a call to llvm::LLVMAddFunction; the
140140
// address of the first instruction in the sequence of
141141
// instructions for this function that will go in the .text
142142
// section of the executable we're generating.
143+
llfn: ValueRef,
143144

144-
// The three implicit arguments that arrive in the function we're
145-
// creating. For instance, foo(int, int) is really foo(ret*,
146-
// task*, env*, int, int). These are also available via
147-
// llvm::LLVMGetParam(llfn, uint) where uint = 1, 2, 0
148-
// respectively, but we unpack them into these fields for
149-
// convenience.
145+
// The two implicit arguments that arrive in the function we're creating.
146+
// For instance, foo(int, int) is really foo(ret*, env*, int, int).
147+
llenv: ValueRef,
148+
llretptr: ValueRef,
150149

151-
// Points to the current task.
152-
153-
// Points to the current environment (bindings of variables to
154-
// values), if this is a regular function
155-
156-
// Points to where the return value of this function should end
157-
// up.
158-
159-
// The next three elements: "hoisted basic blocks" containing
150+
// These elements: "hoisted basic blocks" containing
160151
// administrative activities that have to happen in only one place in
161152
// the function, due to LLVM's quirks.
162-
163153
// A block for all the function's static allocas, so that LLVM
164154
// will coalesce them into a single alloca call.
165-
155+
mutable llstaticallocas: BasicBlockRef,
166156
// A block containing code that copies incoming arguments to space
167157
// already allocated by code in one of the llallocas blocks.
168158
// (LLVM requires that arguments be copied to local allocas before
169159
// allowing most any operation to be performed on them.)
170-
171-
// The first block containing derived tydescs received from the
172-
// runtime. See description of derived_tydescs, below.
173-
174-
// The last block of the llderivedtydescs group.
175-
160+
mutable llloadenv: BasicBlockRef,
161+
// The first and last block containing derived tydescs received from the
162+
// runtime. See description of derived_tydescs, below.
163+
mutable llderivedtydescs_first: BasicBlockRef,
164+
mutable llderivedtydescs: BasicBlockRef,
176165
// A block for all of the dynamically sized allocas. This must be
177166
// after llderivedtydescs, because these sometimes depend on
178167
// information computed from derived tydescs.
179-
168+
mutable lldynamicallocas: BasicBlockRef,
169+
mutable llreturn: BasicBlockRef,
180170
// The token used to clear the dynamic allocas at the end of this frame.
181-
171+
mutable llobstacktoken: option<ValueRef>,
182172
// The 'self' value currently in use in this function, if there
183173
// is one.
184-
185-
// If this function is actually a iter, a block containing the
186-
// code called whenever the iter calls 'put'.
187-
188-
// The next four items: hash tables mapping from AST def_ids to
189-
// LLVM-stuff-in-the-frame.
174+
mutable llself: option<val_self_pair>,
190175

191176
// Maps arguments to allocas created for them in llallocas.
192-
177+
llargs: hashmap<ast::node_id, local_val>,
193178
// Maps the def_ids for local variables to the allocas created for
194179
// them in llallocas.
180+
lllocals: hashmap<ast::node_id, local_val>,
181+
// Same as above, but for closure upvars
182+
llupvars: hashmap<ast::node_id, ValueRef>,
195183

196-
// The same as above, but for variables accessed via the frame
197-
// pointer we pass into an iter, for access to the static
198-
// environment of the iter-calling frame.
199-
200-
// For convenience, a vector of the incoming tydescs for each of
201-
// this functions type parameters, fetched via llvm::LLVMGetParam.
202-
// For example, for a function foo::<A, B, C>(), lltydescs contains
203-
// the ValueRefs for the tydescs for A, B, and C.
184+
// A vector of incoming type descriptors and their associated iface dicts.
185+
mutable lltyparams: [fn_ty_param],
204186

205187
// Derived tydescs are tydescs created at runtime, for types that
206188
// involve type parameters inside type constructors. For example,
@@ -211,35 +193,24 @@ type fn_ctxt =
211193
// when information about both "[T]" and "T" are available. When
212194
// such a tydesc is created, we cache it in the derived_tydescs
213195
// table for the next time that such a tydesc is needed.
196+
derived_tydescs: hashmap<ty::t, derived_tydesc_info>,
214197

215198
// The node_id of the function, or -1 if it doesn't correspond to
216199
// a user-defined function.
200+
id: ast::node_id,
201+
202+
// If this function is being monomorphized, this contains the type
203+
// substitutions used.
204+
param_substs: option<[ty::t]>,
205+
206+
// The source span and nesting context where this function comes from, for
207+
// error reporting and symbol generation.
208+
span: option<span>,
209+
path: path,
217210

218-
// The source span where this function comes from, for error
219-
// reporting.
220-
221-
// This function's enclosing local context.
222-
{llfn: ValueRef,
223-
llenv: ValueRef,
224-
llretptr: ValueRef,
225-
mutable llstaticallocas: BasicBlockRef,
226-
mutable llloadenv: BasicBlockRef,
227-
mutable llderivedtydescs_first: BasicBlockRef,
228-
mutable llderivedtydescs: BasicBlockRef,
229-
mutable lldynamicallocas: BasicBlockRef,
230-
mutable llreturn: BasicBlockRef,
231-
mutable llobstacktoken: option<ValueRef>,
232-
mutable llself: option<val_self_pair>,
233-
llargs: hashmap<ast::node_id, local_val>,
234-
lllocals: hashmap<ast::node_id, local_val>,
235-
llupvars: hashmap<ast::node_id, ValueRef>,
236-
mutable lltyparams: [fn_ty_param],
237-
derived_tydescs: hashmap<ty::t, derived_tydesc_info>,
238-
id: ast::node_id,
239-
param_substs: option<[ty::t]>,
240-
span: option<span>,
241-
path: path,
242-
ccx: @crate_ctxt};
211+
// This function's enclosing crate context.
212+
ccx: @crate_ctxt
213+
};
243214

244215
fn warn_not_to_commit(ccx: @crate_ctxt, msg: str) {
245216
if !ccx.do_not_commit_warning_issued {

0 commit comments

Comments
 (0)