about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-09-26 16:54:15 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-09-26 17:27:23 -0400
commitc3e4e068416438e91e3e9809ee8553a764d8e26e (patch)
tree6a04956609a6b378b1eb56a28f70003bcb885ee7 /src/etc
parent47f2e80b65bf814953c0ceda3b48e46802883f4b (diff)
remove type_use
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
Diffstat (limited to 'src/etc')
-rwxr-xr-xsrc/etc/monodebug.pl79
-rw-r--r--src/etc/zsh/_rust1
2 files changed, 0 insertions, 80 deletions
diff --git a/src/etc/monodebug.pl b/src/etc/monodebug.pl
deleted file mode 100755
index a2d27591cad..00000000000
--- a/src/etc/monodebug.pl
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/perl
-
-#
-# This is a tool that helps with debugging incorrect monomorphic instance collapse.
-#
-# To use:
-#    $ RUST_LOG=rustc::middle::trans::monomorphize rustc ARGS 2>&1 >log.txt
-#    $ ./monodebug.pl log.txt
-#
-# This will show all generics that got collapsed. You can inspect this list to find the instances
-# that were mistakenly combined into one. Fixes will (most likely) be applied to type_use.rs.
-#
-# Questions about this tool go to pcwalton.
-#
-
-use strict;
-use warnings;
-use Data::Dumper qw(Dumper);
-use Text::Balanced qw(extract_bracketed);
-
-my %funcs;
-while (<>) {
-    chomp;
-    /^rust: ~"monomorphic_fn\((.*)"$/ or next;
-    my $text = $1;
-    $text =~ /fn_id=(\{ crate: \d+, node: \d+ \} \([^)]+\)), real_substs=(.*?), substs=(.*?), hash_id = \@\{ (.*) \}$/ or next;
-    my ($fn_id, $real_substs, $substs, $hash_id) = ($1, $2, $3, $4);
-
-    #print "$hash_id\n";
-    $hash_id =~ /^def: { crate: \d+, node: \d+ }, params: ~\[ (.*) \], impl_did_opt: (?:None|Some\({ crate: \d+, node: \d+ }\))$/ or next;
-    my $params = $1;
-
-    my @real_substs;
-    @real_substs = $real_substs =~ /\\"(.*?)\\"/g;
-
-    my @mono_params;
-    while (1) {
-        $params =~ s/^, //;
-        if ($params =~ s/^mono_precise//) {
-            extract_bracketed($params, '()');
-            push @mono_params, 'precise';
-            next;
-        }
-        if ($params =~ s/^mono_repr//) {
-            my $sub = extract_bracketed($params, '()');
-            push @mono_params, "repr($sub)";
-            next;
-        }
-        if ($params =~ s/^mono_any//) {
-            push @mono_params, "any";
-            next;
-        }
-        last;
-    }
-
-    my @key_params;
-    for (my $i = 0; $i < @mono_params; ++$i) {
-        if ($mono_params[$i] eq 'precise') {
-            push @key_params, 'precise(' . $real_substs[$i] . ')';
-        } else {
-            push @key_params, $mono_params[$i];
-        }
-    }
-
-    my $key = "$fn_id with " . (join ', ', @key_params);
-    $funcs{$key}{$real_substs} = 1;
-}
-
-while (my ($key, $substs) = each %funcs) {
-    my @params = keys %$substs;
-    next if @params == 1;
-
-    print "$key\n";
-    print(('-' x (length $key)), $/);
-    for my $param (@params) {
-        print "$param\n";
-    }
-    print "\n";
-}
diff --git a/src/etc/zsh/_rust b/src/etc/zsh/_rust
index 3d0163d9e25..a4b1bc629d1 100644
--- a/src/etc/zsh/_rust
+++ b/src/etc/zsh/_rust
@@ -71,7 +71,6 @@ _rustc_opts_debug=(
     'count-type-sizes:count the sizes of aggregate types'
     'meta-stats:gather metadata statistics'
     'no-opt:do not optimize, even if -O is passed'
-    'no-monomorphic-collapse:do not collapse template instantiations'
     'print-link-args:Print the arguments passed to the linker'
     'gc:Garbage collect shared data (experimental)'
     'jit:Execute using JIT (experimental)'