Skip to content

debuginfo: Composite type reform and enum support. #7710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
976d7a5
debuginfo: Began refactoring of composite type handling.
michaelwoerister Jun 26, 2013
1b20831
debuginfo: Renamed *reference-to-* test cases to *borrowed-*
michaelwoerister Jun 28, 2013
7a31a3e
debuginfo: Removed some misleading comments from test cases.
michaelwoerister Jun 28, 2013
36ea756
debuginfo: Refactored vec slice code to use the new infrastructure. A…
michaelwoerister Jun 28, 2013
f424e93
debuginfo: Refactoring of composite type info generation done.
michaelwoerister Jun 28, 2013
6230ec1
debuginfo: Replaced vec::mapi with iterator version.
michaelwoerister Jul 1, 2013
99ebb81
debuginfo: Added test cases for packed structs (/w drop)
michaelwoerister Jul 1, 2013
739f3ee
debuginfo: Added support for c-style enums.
michaelwoerister Jul 2, 2013
f389bd8
debuginfo: Support for tuple-style enums (WIP)
michaelwoerister Jul 2, 2013
7cf0aac
debuginfo: Better support for univariant tuple-style enums.
michaelwoerister Jul 4, 2013
3b06df4
debuginfo: Added support for struct-style enums.
michaelwoerister Jul 8, 2013
77a00cc
debuginfo: Fixes related to changed memory layout of unique allocations
michaelwoerister Jul 9, 2013
12d87d3
Cleanup of ty::VariantInfo and related functions.
michaelwoerister Jul 10, 2013
a33d1b8
debuginfo: Major code cleanup in debuginfo.rs
michaelwoerister Jul 10, 2013
70e5c08
debuginfo: Extended test suite with various tests for enums.
michaelwoerister Jul 11, 2013
e0108a4
debuginfo: DI generation for enums uses adt::represent_type() now.
michaelwoerister Jul 11, 2013
7af2e6e
debuginfo: Fixed unique pointers to data containing managed pointers.
michaelwoerister Jul 15, 2013
eed2d0e
debuginfo: Added support for Option<T>-like enums.
michaelwoerister Jul 15, 2013
b2aeb4b
debuginfo: Cleaned up style issues for pull request.
michaelwoerister Jul 16, 2013
e9baeab
debuginfo: Adapted DI generation to new memory layout of unique vecs.
michaelwoerister Jul 16, 2013
a1c5c79
debuginfo: Added some documenting comments to debuginfo.rs
michaelwoerister Jul 17, 2013
72cf2ee
debuginfo: Implemented trait_method branch in create_function_metadat…
michaelwoerister Jul 11, 2013
d8c27c3
debuginfo: Fixed issue 7712.
michaelwoerister Jul 17, 2013
6aa43c7
debuginfo: Fixed some merge fallout.
michaelwoerister Jul 17, 2013
b52eb4a
debuginfo: Fixed some merge fallout
michaelwoerister Jul 19, 2013
a1303cc
debuginfo: Removed some test relying on data structure sizes hard to …
michaelwoerister Jul 20, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,14 @@ pub mod llvm {
#[fast_ffi]
pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;

/** Computes the byte offset of the indexed struct element for a target. */
#[fast_ffi]
pub unsafe fn LLVMOffsetOfElement(TD: TargetDataRef,
StructTy: TypeRef,
Element: c_uint)
-> c_ulonglong;

/**
* Returns the minimum alignment of a type when part of a call frame.
*/
Expand Down Expand Up @@ -2089,6 +2097,37 @@ pub mod llvm {
Val: ValueRef,
VarInfo: DIVariable,
InsertBefore: ValueRef) -> ValueRef;

#[fast_ffi]
pub unsafe fn LLVMDIBuilderCreateEnumerator(
Builder: DIBuilderRef,
Name: *c_char,
Val: c_ulonglong) -> ValueRef;

#[fast_ffi]
pub unsafe fn LLVMDIBuilderCreateEnumerationType(
Builder: DIBuilderRef,
Scope: ValueRef,
Name: *c_char,
File: ValueRef,
LineNumber: c_uint,
SizeInBits: c_ulonglong,
AlignInBits: c_ulonglong,
Elements: ValueRef,
ClassType: ValueRef) -> ValueRef;

#[fast_ffi]
pub unsafe fn LLVMDIBuilderCreateUnionType(
Builder: DIBuilderRef,
Scope: ValueRef,
Name: *c_char,
File: ValueRef,
LineNumber: c_uint,
SizeInBits: c_ulonglong,
AlignInBits: c_ulonglong,
Flags: c_uint ,
Elements: ValueRef,
RunTimeLang: c_uint) -> ValueRef;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/csearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::def_id,
}

pub fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id)
-> ~[ty::VariantInfo] {
-> ~[@ty::VariantInfo] {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
return decoder::get_enum_variants(cstore.intr, cdata, def.node, tcx)
Expand Down
19 changes: 12 additions & 7 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,11 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
}

pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
tcx: ty::ctxt) -> ~[ty::VariantInfo] {
tcx: ty::ctxt) -> ~[@ty::VariantInfo] {
let data = cdata.data;
let items = reader::get_doc(reader::Doc(data), tag_items);
let item = find_item(id, items);
let mut infos: ~[ty::VariantInfo] = ~[];
let mut infos: ~[@ty::VariantInfo] = ~[];
let variant_ids = enum_variant_ids(item, cdata);
let mut disr_val = 0;
for variant_ids.iter().advance |did| {
Expand All @@ -753,11 +753,16 @@ pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
Some(val) => { disr_val = val; }
_ => { /* empty */ }
}
infos.push(@ty::VariantInfo_{args: arg_tys,
ctor_ty: ctor_ty, name: name,
// I'm not even sure if we encode visibility
// for variants -- TEST -- tjc
id: *did, disr_val: disr_val, vis: ast::inherited});
infos.push(@ty::VariantInfo{
args: arg_tys,
arg_names: None,
ctor_ty: ctor_ty,
name: name,
// I'm not even sure if we encode visibility
// for variants -- TEST -- tjc
id: *did,
disr_val: disr_val,
vis: ast::inherited});
disr_val += 1;
}
return infos;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub enum Repr {
}

/// For structs, and struct-like parts of anything fancier.
struct Struct {
pub struct Struct {
size: u64,
align: u64,
packed: bool,
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
let _icx = push_ctxt("iter_structural_ty");

fn iter_variant(cx: block, repr: &adt::Repr, av: ValueRef,
variant: ty::VariantInfo,
variant: @ty::VariantInfo,
tps: &[ty::t], f: val_and_ty_fn) -> block {
let _icx = push_ctxt("iter_variant");
let tcx = cx.tcx();
Expand Down Expand Up @@ -1142,7 +1142,7 @@ pub fn trans_stmt(cx: block, s: &ast::stmt) -> block {
bcx = init_local(bcx, *local);
if cx.sess().opts.extra_debuginfo
&& fcx_has_nonzero_span(bcx.fcx) {
debuginfo::create_local_var(bcx, *local);
debuginfo::create_local_var_metadata(bcx, *local);
}
}
ast::decl_item(i) => trans_item(cx.fcx.ccx, i)
Expand Down Expand Up @@ -1774,7 +1774,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
bcx = _match::store_arg(bcx, args[arg_n].pat, llarg);

if fcx.ccx.sess.opts.extra_debuginfo && fcx_has_nonzero_span(fcx) {
debuginfo::create_arg(bcx, &args[arg_n], args[arg_n].ty.span);
debuginfo::create_argument_metadata(bcx, &args[arg_n], args[arg_n].ty.span);
}
}

Expand Down Expand Up @@ -1948,7 +1948,7 @@ pub fn trans_fn(ccx: @mut CrateContext,
|fcx| {
if ccx.sess.opts.extra_debuginfo
&& fcx_has_nonzero_span(fcx) {
debuginfo::create_function(fcx);
debuginfo::create_function_metadata(fcx);
}
},
|_bcx| { });
Expand Down Expand Up @@ -2110,7 +2110,7 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
}

pub fn trans_enum_def(ccx: @mut CrateContext, enum_definition: &ast::enum_def,
id: ast::node_id, vi: @~[ty::VariantInfo],
id: ast::node_id, vi: @~[@ty::VariantInfo],
i: &mut uint) {
for enum_definition.variants.iter().advance |variant| {
let disr_val = vi[*i].disr_val;
Expand Down
Loading