Skip to content

Commit a729bb0

Browse files
committed
---
yaml --- r: 147277 b: refs/heads/try2 c: d952553 h: refs/heads/master i: 147275: 6c332d2 v: v3
1 parent fa647f3 commit a729bb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+330
-877
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 000cda611f8224ac780fa37432f869f425cd2bb7
8+
refs/heads/try2: d9525530482f12f9814f46148ba02d3d1ecebee5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,27 @@ then
559559
step_msg "on OS X 10.9, forcing use of clang"
560560
CFG_ENABLE_CLANG=1
561561
putvar CFG_ENABLE_CLANG
562+
else
563+
# on OS X, with xcode 5 and newer, certain developers may have
564+
# cc, gcc and g++ point to a mixture of clang and gcc
565+
# if so, this will create very strange build errors
566+
# this last stanza is to detect some such problems and save the future rust
567+
# contributor some time solving that issue.
568+
# this detection could be generalized to other OSes aside from OS X
569+
# but the issue seems most likely to happen on OS X
570+
571+
chk_cc () {
572+
$1 --version 2> /dev/null | grep -q $2
573+
}
574+
# check that gcc, cc and g++ all point to the same compiler.
575+
# note that for xcode 5, g++ points to clang, not clang++
576+
if !((chk_cc gcc clang && chk_cc g++ clang) ||
577+
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))) then
578+
err "the gcc and g++ in your path point to different compilers.
579+
Check which versions are in your path with cc --version and g++ --version.
580+
To resolve this problem, either fix your PATH or run configure with --enable-clang"
581+
fi
582+
562583
fi
563584
fi
564585

branches/try2/doc/rust.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,11 +2177,7 @@ Expressions are divided into two main categories: _lvalues_ and _rvalues_.
21772177
Likewise within each expression, sub-expressions may occur in _lvalue context_ or _rvalue context_.
21782178
The evaluation of an expression depends both on its own category and the context it occurs within.
21792179

2180-
An lvalue is an expression that represents a memory location. These
2181-
expressions are [paths](#path-expressions) (which refer to local
2182-
variables, function and method arguments, or static variables),
2183-
dereferences (`*expr`), [indexing expressions](#index-expressions)
2184-
(`expr[expr]`), and [field references](#field-expressions) (`expr.f`).
2180+
[Path](#path-expressions), [field](#field-expressions) and [index](#index-expressions) expressions are lvalues.
21852181
All other expressions are rvalues.
21862182

21872183
The left operand of an [assignment](#assignment-expressions),

branches/try2/src/libextra/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,22 @@ Rust extras are part of the standard Rust distribution.
2020
2121
*/
2222

23-
#[pkgid = "extra#0.9-pre"];
23+
#[pkgid="extra#0.9-pre"];
24+
// NOTE: remove after the next snapshot
25+
#[link(name = "extra",
26+
package_id = "extra",
27+
vers = "0.9-pre",
28+
uuid = "122bed0b-c19b-4b82-b0b7-7ae8aead7297",
29+
url = "https://github.com/mozilla/rust/tree/master/src/libextra")];
30+
31+
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
32+
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
33+
html_root_url = "http://static.rust-lang.org/doc/master")];
34+
2435
#[comment = "Rust extras"];
2536
#[license = "MIT/ASL2"];
2637
#[crate_type = "rlib"];
2738
#[crate_type = "dylib"];
28-
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
29-
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
30-
html_root_url = "http://static.rust-lang.org/doc/master")];
3139

3240
#[feature(macro_rules, globs, managed_boxes)];
3341

branches/try2/src/librustc/front/test.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {
375375
}
376376

377377
fn is_extra(crate: &ast::Crate) -> bool {
378-
match attr::find_pkgid(crate.attrs) {
379-
Some(ref s) if "extra" == s.name => true,
378+
let items = attr::find_linkage_metas(crate.attrs);
379+
match attr::last_meta_item_value_str_by_name(items, "name") {
380+
Some(s) if "extra" == s => true,
380381
_ => false
381382
}
382383
}

branches/try2/src/librustc/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[pkgid = "rustc#0.9-pre"];
11+
#[pkgid="rustc#0.9-pre"];
12+
// NOTE: remove after the next snapshot
13+
#[link(name = "rustc",
14+
package_id = "rustc",
15+
vers = "0.9-pre",
16+
uuid = "0ce89b41-2f92-459e-bbc1-8f5fe32f16cf",
17+
url = "https://github.com/mozilla/rust/tree/master/src/rustc")];
18+
1219
#[comment = "The Rust compiler"];
1320
#[license = "MIT/ASL2"];
1421
#[crate_type = "dylib"];

branches/try2/src/librustc/middle/dead.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ impl MarkSymbolVisitor {
107107
match item.node {
108108
ast::item_fn(..)
109109
| ast::item_ty(..)
110-
| ast::item_enum(..)
111-
| ast::item_struct(..)
112110
| ast::item_static(..) => {
113111
visit::walk_item(self, item, ());
114112
}

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ use util::common::indenter;
220220
use util::ppaux::{Repr, vec_map_to_str};
221221

222222
use std::hashmap::HashMap;
223-
use std::ptr;
224223
use std::vec;
225224
use syntax::ast;
226225
use syntax::ast::Ident;
@@ -2047,10 +2046,7 @@ pub fn store_arg(mut bcx: @mut Block,
20472046
// Debug information (the llvm.dbg.declare intrinsic to be precise) always expects to get an
20482047
// alloca, which only is the case on the general path, so lets disable the optimized path when
20492048
// debug info is enabled.
2050-
let arg_is_alloca = unsafe { llvm::LLVMIsAAllocaInst(llval) != ptr::null() };
2051-
2052-
let fast_path = (arg_is_alloca || !bcx.ccx().sess.opts.extra_debuginfo)
2053-
&& simple_identifier(pat).is_some();
2049+
let fast_path = !bcx.ccx().sess.opts.extra_debuginfo && simple_identifier(pat).is_some();
20542050

20552051
if fast_path {
20562052
// Optimized path for `x: T` case. This just adopts

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pub fn opaque_box_body(bcx: @mut Block,
303303
let _icx = push_ctxt("opaque_box_body");
304304
let ccx = bcx.ccx();
305305
let ty = type_of(ccx, body_t);
306-
let ty = Type::smart_ptr(ccx, &ty);
306+
let ty = Type::box(ccx, &ty);
307307
let boxptr = PointerCast(bcx, boxptr, ty.ptr_to());
308308
GEPi(bcx, boxptr, [0u, abi::box_field_body])
309309
}
@@ -385,24 +385,20 @@ pub fn malloc_raw(bcx: @mut Block, t: ty::t, heap: heap) -> Result {
385385

386386
pub struct MallocResult {
387387
bcx: @mut Block,
388-
smart_ptr: ValueRef,
388+
box: ValueRef,
389389
body: ValueRef
390390
}
391391

392-
// malloc_general_dyn: usefully wraps malloc_raw_dyn; allocates a smart
393-
// pointer, and pulls out the body
392+
// malloc_general_dyn: usefully wraps malloc_raw_dyn; allocates a box,
393+
// and pulls out the body
394394
pub fn malloc_general_dyn(bcx: @mut Block, t: ty::t, heap: heap, size: ValueRef)
395395
-> MallocResult {
396396
assert!(heap != heap_exchange);
397397
let _icx = push_ctxt("malloc_general");
398398
let Result {bcx: bcx, val: llbox} = malloc_raw_dyn(bcx, t, heap, size);
399399
let body = GEPi(bcx, llbox, [0u, abi::box_field_body]);
400400

401-
MallocResult {
402-
bcx: bcx,
403-
smart_ptr: llbox,
404-
body: body,
405-
}
401+
MallocResult { bcx: bcx, box: llbox, body: body }
406402
}
407403

408404
pub fn malloc_general(bcx: @mut Block, t: ty::t, heap: heap) -> MallocResult {
@@ -875,11 +871,8 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
875871
}
876872
}
877873
878-
pub fn invoke(bcx: @mut Block,
879-
llfn: ValueRef,
880-
llargs: ~[ValueRef],
881-
attributes: &[(uint, lib::llvm::Attribute)],
882-
call_info: Option<NodeInfo>)
874+
pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
875+
attributes: &[(uint, lib::llvm::Attribute)])
883876
-> (ValueRef, @mut Block) {
884877
let _icx = push_ctxt("invoke_");
885878
if bcx.unreachable {
@@ -902,18 +895,11 @@ pub fn invoke(bcx: @mut Block,
902895
}
903896
}
904897
let normal_bcx = sub_block(bcx, "normal return");
905-
let landing_pad = get_landing_pad(bcx);
906-
907-
match call_info {
908-
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
909-
None => debuginfo::clear_source_location(bcx.fcx)
910-
};
911-
912898
let llresult = Invoke(bcx,
913899
llfn,
914900
llargs,
915901
normal_bcx.llbb,
916-
landing_pad,
902+
get_landing_pad(bcx),
917903
attributes);
918904
return (llresult, normal_bcx);
919905
} else {
@@ -923,12 +909,6 @@ pub fn invoke(bcx: @mut Block,
923909
debug!("arg: {}", llarg);
924910
}
925911
}
926-
927-
match call_info {
928-
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
929-
None => debuginfo::clear_source_location(bcx.fcx)
930-
};
931-
932912
let llresult = Call(bcx, llfn, llargs, attributes);
933913
return (llresult, bcx);
934914
}
@@ -1567,7 +1547,6 @@ pub fn alloca_maybe_zeroed(cx: @mut Block, ty: Type, name: &str, zero: bool) ->
15671547
return llvm::LLVMGetUndef(ty.ptr_to().to_ref());
15681548
}
15691549
}
1570-
debuginfo::clear_source_location(cx.fcx);
15711550
let p = Alloca(cx, ty, name);
15721551
if zero {
15731552
let b = cx.fcx.ccx.builder();
@@ -1584,7 +1563,6 @@ pub fn arrayalloca(cx: @mut Block, ty: Type, v: ValueRef) -> ValueRef {
15841563
return llvm::LLVMGetUndef(ty.to_ref());
15851564
}
15861565
}
1587-
debuginfo::clear_source_location(cx.fcx);
15881566
return ArrayAlloca(cx, ty, v);
15891567
}
15901568

@@ -1828,7 +1806,6 @@ pub fn finish_fn(fcx: @mut FunctionContext, last_bcx: @mut Block) {
18281806
None => last_bcx
18291807
};
18301808
build_return_block(fcx, ret_cx);
1831-
debuginfo::clear_source_location(fcx);
18321809
fcx.cleanup();
18331810
}
18341811

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
697697
}
698698

699699
// Invoke the actual rust fn and update bcx/llresult.
700-
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs, call_info);
700+
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs);
701701
bcx = b;
702702
llresult = llret;
703703

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 20 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -85,43 +85,6 @@ continuation, storing all state needed to continue traversal at the type members
8585
been registered with the cache. (This implementation approach might be a tad over-engineered and
8686
may change in the future)
8787
88-
89-
## Source Locations and Line Information
90-
In addition to data type descriptions the debugging information must also allow to map machine code
91-
locations back to source code locations in order to be useful. This functionality is also handled in
92-
this module. The following functions allow to control source mappings:
93-
94-
+ set_source_location()
95-
+ clear_source_location()
96-
+ start_emitting_source_locations()
97-
98-
`set_source_location()` allows to set the current source location. All IR instructions created after
99-
a call to this function will be linked to the given source location, until another location is
100-
specified with `set_source_location()` or the source location is cleared with
101-
`clear_source_location()`. In the later case, subsequent IR instruction will not be linked to any
102-
source location. As you can see, this is a stateful API (mimicking the one in LLVM), so be careful
103-
with source locations set by previous calls. It's probably best to not rely on any specific state
104-
being present at a given point in code.
105-
106-
One topic that deserves some extra attention is *function prologues*. At the beginning of a
107-
function's machine code there are typically a few instructions for loading argument values into
108-
allocas and checking if there's enough stack space for the function to execute. This *prologue* is
109-
not visible in the source code and LLVM puts a special PROLOGUE END marker into the line table at
110-
the first non-prologue instruction of the function. In order to find out where the prologue ends,
111-
LLVM looks for the first instruction in the function body that is linked to a source location. So,
112-
when generating prologue instructions we have to make sure that we don't emit source location
113-
information until the 'real' function body begins. For this reason, source location emission is
114-
disabled by default for any new function being translated and is only activated after a call to the
115-
third function from the list above, `start_emitting_source_locations()`. This function should be
116-
called right before regularly starting to translate the top-level block of the given function.
117-
118-
There is one exception to the above rule: `llvm.dbg.declare` instruction must be linked to the
119-
source location of the variable being declared. For function parameters these `llvm.dbg.declare`
120-
instructions typically occur in the middle of the prologue, however, they are ignored by LLVM's
121-
prologue detection. The `create_argument_metadata()` and related functions take care of linking the
122-
`llvm.dbg.declare` instructions to the correct source locations even while source location emission
123-
is still disabled, so there is no need to do anything special with source location handling here.
124-
12588
*/
12689

12790

@@ -688,16 +651,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
688651
(function_name.clone(), file_metadata)
689652
};
690653

691-
// Clang sets this parameter to the opening brace of the function's block, so let's do this too.
692-
let scope_line = span_start(cx, top_level_block.span).line;
693-
694-
// The is_local_to_unit flag indicates whether a function is local to the current compilation
695-
// unit (i.e. if it is *static* in the C-sense). The *reachable* set should provide a good
696-
// approximation of this, as it contains everything that might leak out of the current crate
697-
// (by being externally visible or by being inlined into something externally visible). It might
698-
// better to use the `exported_items` set from `driver::CrateAnalysis` in the future, but (atm)
699-
// this set is not available in the translation pass.
700-
let is_local_to_unit = !cx.reachable.contains(&fn_ast_id);
654+
let scope_line = get_scope_line(cx, top_level_block, loc.line);
701655

702656
let fn_metadata = function_name.with_c_str(|function_name| {
703657
linkage_name.with_c_str(|linkage_name| {
@@ -710,7 +664,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
710664
file_metadata,
711665
loc.line as c_uint,
712666
function_type_metadata,
713-
is_local_to_unit,
667+
false,
714668
true,
715669
scope_line as c_uint,
716670
FlagPrototyped as c_uint,
@@ -733,9 +687,6 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
733687
let arg_pats = fn_decl.inputs.map(|arg_ref| arg_ref.pat);
734688
populate_scope_map(cx, arg_pats, top_level_block, fn_metadata, &mut fn_debug_context.scope_map);
735689

736-
// Clear the debug location so we don't assign them in the function prelude
737-
set_debug_location(cx, UnknownLocation);
738-
739690
return FunctionDebugContext(fn_debug_context);
740691

741692
fn get_function_signature(cx: &mut CrateContext,
@@ -886,6 +837,21 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
886837

887838
return create_DIArray(DIB(cx), template_params);
888839
}
840+
841+
fn get_scope_line(cx: &CrateContext,
842+
top_level_block: &ast::Block,
843+
default: uint)
844+
-> uint {
845+
match *top_level_block {
846+
ast::Block { stmts: ref statements, .. } if statements.len() > 0 => {
847+
span_start(cx, statements[0].span).line
848+
}
849+
ast::Block { expr: Some(@ref expr), .. } => {
850+
span_start(cx, expr.span).line
851+
}
852+
_ => default
853+
}
854+
}
889855
}
890856

891857
//=-------------------------------------------------------------------------------------------------
@@ -1717,7 +1683,7 @@ fn boxed_type_metadata(cx: &mut CrateContext,
17171683
None => ~"BoxedType"
17181684
};
17191685

1720-
let box_llvm_type = Type::smart_ptr(cx, &content_llvm_type);
1686+
let box_llvm_type = Type::box(cx, &content_llvm_type);
17211687
let member_llvm_types = box_llvm_type.field_types();
17221688
assert!(box_layout_is_correct(cx, member_llvm_types, content_llvm_type));
17231689

@@ -2162,8 +2128,7 @@ fn set_debug_location(cx: &mut CrateContext, debug_location: DebugLocation) {
21622128
let metadata_node;
21632129

21642130
match debug_location {
2165-
KnownLocation { scope, line, .. } => {
2166-
let col = 0; // Always set the column to zero like Clang and GCC
2131+
KnownLocation { scope, line, col } => {
21672132
debug!("setting debug location to {} {}", line, col);
21682133
let elements = [C_i32(line as i32), C_i32(col as i32), scope, ptr::null()];
21692134
unsafe {
@@ -2279,14 +2244,7 @@ fn populate_scope_map(cx: &mut CrateContext,
22792244
})
22802245
}
22812246

2282-
// Clang creates a separate scope for function bodies, so let's do this too
2283-
with_new_scope(cx,
2284-
fn_entry_block.span,
2285-
&mut scope_stack,
2286-
scope_map,
2287-
|cx, scope_stack, scope_map| {
2288-
walk_block(cx, fn_entry_block, scope_stack, scope_map);
2289-
});
2247+
walk_block(cx, fn_entry_block, &mut scope_stack, scope_map);
22902248

22912249
// local helper functions for walking the AST.
22922250
fn with_new_scope(cx: &mut CrateContext,

0 commit comments

Comments
 (0)