Skip to content

Commit c1b075d

Browse files
committed
Remove experimental GC code
It's been sitting unused long enough to have bitrotted completely.
1 parent 1ea1842 commit c1b075d

24 files changed

+24
-390
lines changed

mk/rt.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ RUNTIME_CS_$(1) := \
5656
rt/rust_kernel.cpp \
5757
rt/rust_shape.cpp \
5858
rt/rust_obstack.cpp \
59-
rt/rust_gc.cpp \
6059
rt/rust_abi.cpp \
6160
rt/rust_cc.cpp \
6261
rt/rust_debug.cpp \
@@ -73,7 +72,6 @@ RUNTIME_HDR_$(1) := rt/globals.h \
7372
rt/rust_abi.h \
7473
rt/rust_cc.h \
7574
rt/rust_debug.h \
76-
rt/rust_gc.h \
7775
rt/rust_internal.h \
7876
rt/rust_util.h \
7977
rt/rust_env.h \

src/comp/back/upcall.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn declare_upcalls(targ_cfg: @session::config,
5656
d("malloc", [T_ptr(tydesc_type)],
5757
T_ptr(T_i8())),
5858
free:
59-
dv("free", [T_ptr(T_i8()), int_t]),
59+
dv("free", [T_ptr(T_i8())]),
6060
validate_box:
6161
dv("validate_box", [T_ptr(T_i8())]),
6262
shared_malloc:

src/comp/driver/driver.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ fn build_session_options(match: getopts::match,
412412
let addl_lib_search_paths = getopts::opt_strs(match, "L");
413413
let cfg = parse_cfgspecs(getopts::opt_strs(match, "cfg"));
414414
let test = opt_present(match, "test");
415-
let do_gc = opt_present(match, "gc");
416415
let warn_unused_imports = opt_present(match, "warn-unused-imports");
417416
let sopts: @session::options =
418417
@{crate_type: crate_type,
@@ -434,7 +433,6 @@ fn build_session_options(match: getopts::match,
434433
test: test,
435434
parse_only: parse_only,
436435
no_trans: no_trans,
437-
do_gc: do_gc,
438436
no_asm_comments: no_asm_comments,
439437
warn_unused_imports: warn_unused_imports};
440438
ret sopts;

src/comp/driver/session.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type options =
4646
test: bool,
4747
parse_only: bool,
4848
no_trans: bool,
49-
do_gc: bool,
5049
no_asm_comments: bool,
5150
warn_unused_imports: bool};
5251

src/comp/middle/gc.rs

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/comp/middle/trans/base.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import option::{some, none};
2121
import driver::session;
2222
import session::session;
2323
import front::attr;
24-
import middle::{ty, gc, resolve, debuginfo};
2524
import middle::freevars::*;
2625
import back::{link, abi, upcall};
2726
import syntax::{ast, ast_util, codemap};
@@ -350,14 +349,9 @@ fn trans_native_call(cx: @block_ctxt, externs: hashmap<str, ValueRef>,
350349
ret Call(cx, llnative, call_args);
351350
}
352351

353-
fn trans_free_if_not_gc(cx: @block_ctxt, v: ValueRef) -> @block_ctxt {
354-
let ccx = bcx_ccx(cx);
355-
if !ccx.sess.opts.do_gc {
356-
Call(cx, ccx.upcalls.free,
357-
[PointerCast(cx, v, T_ptr(T_i8())),
358-
C_int(bcx_ccx(cx), 0)]);
359-
}
360-
ret cx;
352+
fn trans_free(cx: @block_ctxt, v: ValueRef) -> @block_ctxt {
353+
Call(cx, bcx_ccx(cx).upcalls.free, [PointerCast(cx, v, T_ptr(T_i8()))]);
354+
cx
361355
}
362356

363357
fn trans_shared_free(cx: @block_ctxt, v: ValueRef) -> @block_ctxt {
@@ -1245,7 +1239,7 @@ fn free_box(bcx: @block_ctxt, v: ValueRef, t: ty::t) -> @block_ctxt {
12451239
let v = PointerCast(bcx, v, type_of_1(bcx, t));
12461240
let body = GEPi(bcx, v, [0, abi::box_field_body]);
12471241
let bcx = drop_ty(bcx, body, body_mt.ty);
1248-
trans_free_if_not_gc(bcx, v)
1242+
trans_free(bcx, v)
12491243
}
12501244

12511245
_ { fail "free_box invoked with non-box type"; }
@@ -1280,7 +1274,7 @@ fn make_free_glue(bcx: @block_ctxt, v: ValueRef, t: ty::t) {
12801274
let ti = none;
12811275
call_tydesc_glue_full(bcx, body, tydesc,
12821276
abi::tydesc_field_drop_glue, ti);
1283-
trans_free_if_not_gc(bcx, b)
1277+
trans_free(bcx, b)
12841278
}
12851279
ty::ty_send_type {
12861280
// sendable type descriptors are basically unique pointers,
@@ -4226,10 +4220,6 @@ fn alloc_ty(cx: @block_ctxt, t: ty::t) -> result {
42264220
// past caller conventions and may well make sense again,
42274221
// so we leave it as-is.
42284222

4229-
if bcx_tcx(cx).sess.opts.do_gc {
4230-
bcx = gc::add_gc_root(bcx, val, t);
4231-
}
4232-
42334223
ret rslt(cx, val);
42344224
}
42354225

@@ -5604,7 +5594,6 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
56045594
opaque_vec_type: T_opaque_vec(targ_cfg),
56055595
builder: BuilderRef_res(llvm::LLVMCreateBuilder()),
56065596
shape_cx: shape::mk_ctxt(llmod),
5607-
gc_cx: gc::mk_ctxt(),
56085597
crate_map: crate_map,
56095598
dbg_cx: dbg_cx,
56105599
mutable do_not_commit_warning_issued: false};

src/comp/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ fn make_opaque_cbox_free_glue(
716716
alt ck {
717717
ty::ck_block { fail "Impossible"; }
718718
ty::ck_box {
719-
trans_free_if_not_gc(bcx, cbox)
719+
trans_free(bcx, cbox)
720720
}
721721
ty::ck_uniq {
722722
let bcx = free_ty(bcx, tydesc, mk_tydesc_ty(tcx, ck));

src/comp/middle/trans/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ type crate_ctxt =
120120
opaque_vec_type: TypeRef,
121121
builder: BuilderRef_res,
122122
shape_cx: shape::ctxt,
123-
gc_cx: gc::ctxt,
124123
crate_map: ValueRef,
125124
dbg_cx: option<@debuginfo::debug_ctxt>,
126125
mutable do_not_commit_warning_issued: bool};
@@ -286,7 +285,7 @@ fn add_clean_temp_mem(cx: @block_ctxt, val: ValueRef, ty: ty::t) {
286285
fn add_clean_free(cx: @block_ctxt, ptr: ValueRef, shared: bool) {
287286
let scope_cx = find_scope_cx(cx);
288287
let free_fn = if shared { bind base::trans_shared_free(_, ptr) }
289-
else { bind base::trans_free_if_not_gc(_, ptr) };
288+
else { bind base::trans_free(_, ptr) };
290289
scope_cx.cleanups += [clean_temp(ptr, free_fn)];
291290
scope_cx.lpad_dirty = true;
292291
}

src/comp/rustc.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ mod middle {
3939
mod kind;
4040
mod freevars;
4141
mod shape;
42-
mod gc;
4342
mod debuginfo;
4443
mod capture;
4544
mod pat_util;

src/libcore/sys.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ native mod rustrt {
1717
// visible-in-crate, but not re-exported.
1818
fn last_os_error() -> str;
1919
fn refcount<T>(t: @T) -> ctypes::intptr_t;
20-
fn do_gc();
2120
fn unsupervise();
2221
fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
2322
fn rust_set_exit_status(code: ctypes::intptr_t);
@@ -74,15 +73,6 @@ fn refcount<T>(t: @T) -> uint {
7473
ret rustrt::refcount::<T>(t);
7574
}
7675

77-
/*
78-
Function: do_gc
79-
80-
Force a garbage collection
81-
*/
82-
fn do_gc() -> () {
83-
ret rustrt::do_gc();
84-
}
85-
8676
// FIXME: There's a wrapper for this in the task module and this really
8777
// just belongs there
8878
fn unsupervise() -> () {

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ refcount(intptr_t *v) {
9191
return (*v) - 1;
9292
}
9393

94-
extern "C" CDECL void
95-
do_gc() {
96-
// TODO
97-
}
98-
9994
extern "C" CDECL void
10095
unsupervise() {
10196
rust_task *task = rust_scheduler::get_task();

src/rt/rust_cc.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// time until LLVM's GC infrastructure is more mature.
33

44
#include "rust_debug.h"
5-
#include "rust_gc.h"
65
#include "rust_internal.h"
76
#include "rust_shape.h"
87
#include "rust_task.h"

0 commit comments

Comments
 (0)