Skip to content

Commit bbb6836

Browse files
committed
Merge branch 'master' into recursive-elseif
Conflicts: src/comp/middle/typeck.rs
2 parents 2a66294 + fdc22ef commit bbb6836

Some content is hidden

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

44 files changed

+1854
-959
lines changed

src/Makefile

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ DSYMUTIL := true
3434

3535
ifeq ($(CFG_OSTYPE), FreeBSD)
3636
CFG_RUNTIME := librustrt.so
37+
CFG_SUPPORT := librustllvm.so
3738
CFG_STDLIB := libstd.so
3839
CFG_GCC_CFLAGS += -fPIC -march=i686 -I/usr/local/include
3940
CFG_GCC_LINK_FLAGS += -shared -fPIC -lpthread -lrt
@@ -47,6 +48,7 @@ endif
4748

4849
ifeq ($(CFG_OSTYPE), Linux)
4950
CFG_RUNTIME := librustrt.so
51+
CFG_SUPPORT := librustllvm.so
5052
CFG_STDLIB := libstd.so
5153
CFG_GCC_CFLAGS += -fPIC -march=i686
5254
CFG_GCC_LINK_FLAGS += -shared -fPIC -ldl -lpthread -lrt
@@ -60,6 +62,7 @@ endif
6062

6163
ifeq ($(CFG_OSTYPE), Darwin)
6264
CFG_RUNTIME := librustrt.dylib
65+
CFG_SUPPORT := librustllvm.dylib
6366
CFG_STDLIB := libstd.dylib
6467
CFG_UNIXY := 1
6568
CFG_GCC_LINK_FLAGS += -dynamiclib -lpthread
@@ -85,8 +88,8 @@ ifdef CFG_WINDOWSY
8588
CFG_NATIVE := 1
8689
endif
8790
CFG_RUNTIME := rustrt.dll
91+
CFG_SUPPORT := rustllvm.dll
8892
CFG_STDLIB := std.dll
89-
CFG_OBJ_SUFFIX := .o
9093
CFG_EXE_SUFFIX := .exe
9194
CFG_BOOT := ./rustboot.exe
9295
CFG_RUSTC := ./rustc.exe
@@ -101,20 +104,19 @@ ifdef CFG_UNIXY
101104
CFG_INFO := $(info cfg: unix-y environment)
102105
CFG_BOOT := ./rustboot
103106
CFG_RUSTC := ./rustc
104-
CFG_OBJ_SUFFIX := .o
105107
CFG_RUN_TARG = LD_LIBRARY_PATH=. $(CFG_VALGRIND) $(1)
106108
CFG_GCC := 1
107109
ifdef MINGW_CROSS
108110
CFG_INFO := $(info cfg: mingw-cross)
109111
CFG_GCC_CROSS := i586-mingw32msvc-
110112
CFG_BOOT_FLAGS += -t win32-x86-pe
111113
CFG_RUNTIME := rustrt.dll
114+
CFG_SUPPORT := rustllvm.dll
112115
CFG_STDLIB := std.dll
113116
CFG_RUSTC := ./rustc.exe
114117
ifdef CFG_VALGRIND
115118
CFG_VALGRIND += wine
116119
endif
117-
CFG_OBJ_SUFFIX := .o
118120
CFG_EXE_SUFFIX := .exe
119121
CFG_GCC_CFLAGS := -march=i686
120122
CFG_GCC_LINK_FLAGS := -shared
@@ -182,7 +184,7 @@ endif
182184
ifneq ($(CFG_LLVM_CONFIG),)
183185
CFG_LLVM_VERSION := $(shell $(CFG_LLVM_CONFIG) --version)
184186
$(info cfg: found llvm-config at $(CFG_LLVM_CONFIG))
185-
CFG_LLVM_ALLOWED_VERSIONS := 2.8svn 2.8 2.9svn
187+
CFG_LLVM_ALLOWED_VERSIONS := 2.8svn 2.8 2.9svn 3.0svn
186188
ifneq ($(findstring $(CFG_LLVM_VERSION),$(CFG_LLVM_ALLOWED_VERSIONS)),)
187189
$(info cfg: using LLVM version $(CFG_LLVM_VERSION))
188190
else
@@ -196,6 +198,10 @@ ifdef CFG_LLVM_CONFIG
196198
LLC := "$(shell $(CFG_LLVM_CONFIG) --bindir)/llc"
197199
CFG_LLC_CFLAGS := -march=x86
198200
LLVM-DIS := "$(shell $(CFG_LLVM_CONFIG) --bindir)/llvm-dis"
201+
CFG_LLVM_INCDIR := $(shell $(CFG_LLVM_CONFIG) --includedir)
202+
CFG_LLVM_CXXFLAGS := $(shell $(CFG_LLVM_CONFIG) --cxxflags)
203+
CFG_LLVM_LDFLAGS := $(shell $(CFG_LLVM_CONFIG) --ldflags)
204+
CFG_LLVM_LIBS := $(shell $(CFG_LLVM_CONFIG) --libs)
199205
endif
200206

201207
MKFILES := Makefile
@@ -302,15 +308,22 @@ RUNTIME_HDR := rt/globals.h \
302308
rt/test/rust_test_util.h
303309

304310
RUNTIME_INCS := -Irt/isaac -Irt/uthash
305-
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=$(CFG_OBJ_SUFFIX))
306-
RUNTIME_LIBS := $(CFG_RUNTIME_LIBS)
311+
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o)
312+
313+
SUPPORT_CS := llvmext/Object.cpp
314+
315+
SUPPORT_HDR := llvmext/include/llvm-c/Object.h
316+
317+
SUPPORT_INCS := -iquote $(CFG_LLVM_INCDIR) -iquote llvmext/include
318+
SUPPORT_OBJS := $(SUPPORT_CS:.cpp=.o)
319+
SUPPORT_LIBS := $(CFG_LLVM_LDFLAGS) $(CFG_LLVM_LIBS)
307320

308321
STDLIB_CRATE := lib/std.rc
309322
STDLIB_INPUTS := $(wildcard lib/*.rc lib/*.rs lib/*/*.rs)
310323
COMPILER_CRATE := comp/rustc.rc
311-
COMPILER_INPUTS := $(wildcard comp/*.rc comp/*.rs comp/*/*.rs)
324+
COMPILER_INPUTS := $(wildcard comp/rustc.rc comp/*.rs comp/*/*.rs)
312325

313-
GENERATED := boot/fe/lexer.ml boot/util/version.ml
326+
GENERATED := boot/fe/lexer.ml boot/util/version.ml glue.o
314327

315328
all: $(CFG_RUSTC) $(MKFILES) $(GENERATED)
316329

@@ -325,14 +338,24 @@ $(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR)
325338
@$(call CFG_ECHO, compile: $<)
326339
$(CFG_QUIET)$(call CFG_LINK_C, $@) $(RUNTIME_OBJS)
327340

341+
$(CFG_SUPPORT): $(SUPPORT_OBJS) $(MKFILES) $(SUPPORT_HDR)
342+
@$(call CFG_ECHO, compile: $<)
343+
$(CFG_QUIET)$(call CFG_LINK_C, $@ $(CFG_LLVM_LDFLAGS) $(CFG_LLVM_LIBS)) \
344+
$(SUPPORT_OBJS)
345+
328346
$(CFG_STDLIB): $(STDLIB_CRATE) $(CFG_BOOT) $(MKFILES)
329347
@$(call CFG_ECHO, compile: $<)
330348
$(BOOT) -shared -o $@ $(STDLIB_CRATE)
331349

332-
%$(CFG_OBJ_SUFFIX): %.cpp $(MKFILES)
350+
rt/%.o: rt/%.cpp $(MKFILES)
333351
@$(call CFG_ECHO, compile: $<)
334352
$(CFG_QUIET)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $<
335353

354+
llvmext/%.o: llvmext/%.cpp $(MKFILES)
355+
@$(call CFG_ECHO, compile: $<)
356+
$(CFG_QUIET)$(call CFG_COMPILE_C, $@, $(CFG_LLVM_CXXFLAGS) \
357+
$(SUPPORT_INCS)) $<
358+
336359
ifdef CFG_NATIVE
337360
$(CFG_BOOT): $(BOOT_CMXS) $(MKFILES)
338361
@$(call CFG_ECHO, compile: $<)
@@ -363,13 +386,18 @@ endif
363386
# Main compiler targets and rules
364387
######################################################################
365388

366-
$(CFG_RUSTC): $(COMPILER_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
389+
$(CFG_RUSTC): $(COMPILER_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB) \
390+
$(CFG_SUPPORT)
367391
@$(call CFG_ECHO, compile: $<)
368392
$(BOOT) -minimal -o $@ $<
369393
$(CFG_QUIET)chmod 0755 $@
370394

395+
glue.bc: $(CFG_RUSTC) $(CFG_RUNTIME) $(CFG_STDLIB)
396+
@$(call CFG_ECHO, generate: $@)
397+
$(RUSTC) -o $@ -glue
398+
371399
self: $(CFG_RUSTC)
372-
@$(call CFG_ECHO, compile: $<)
400+
@$(call CFG_ECHO, compile: $(COMPILER_CRATE))
373401
$(RUSTC) $(COMPILER_CRATE)
374402

375403

@@ -402,19 +430,23 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
402430
$(NOMINAL_TAG_XFAILS) \
403431
$(CONST_TAG_XFAILS) \
404432
test/run-pass/arith-unsigned.rs \
433+
test/run-pass/box-compare.rs \
405434
test/run-pass/child-outlives-parent.rs \
406435
test/run-pass/clone-with-exterior.rs \
407436
test/run-pass/constrained-type.rs \
408437
test/run-pass/destructor-ordering.rs \
409438
test/run-pass/obj-as.rs \
410439
test/run-pass/vec-slice.rs \
411440
test/run-pass/fn-lval.rs \
441+
test/run-pass/generic-bind-2.rs \
412442
test/run-pass/generic-fn-box.rs \
413443
test/run-pass/generic-tup.rs \
414444
test/run-pass/iter-ret.rs \
445+
test/run-pass/leak-tag-copy.rs \
415446
test/run-pass/lib-io.rs \
416447
test/run-pass/mlist-cycle.rs \
417448
test/run-pass/obj-as.rs \
449+
test/run-pass/seq-compare.rs \
418450
test/run-pass/task-comm.rs \
419451
test/run-pass/task-comm-3.rs \
420452
test/run-pass/vec-slice.rs \
@@ -439,24 +471,11 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
439471
basic-1.rs \
440472
basic-2.rs \
441473
basic.rs \
442-
bind-obj-ctor.rs \
443474
child-outlives-parent.rs \
444475
clone-with-exterior.rs \
445476
comm.rs \
446477
constrained-type.rs \
447478
destructor-ordering.rs \
448-
drop-parametric-closure-with-bound-box.rs \
449-
export-non-interference.rs \
450-
foreach-nested-2.rs \
451-
foreach-nested.rs \
452-
foreach-put-structured.rs \
453-
foreach-simple-outer-slot.rs \
454-
generic-fn-twice.rs \
455-
generic-iter-frame.rs \
456-
generic-recursive-tag.rs \
457-
generic-tag-alt.rs \
458-
generic-tag-values.rs \
459-
iter-range.rs \
460479
iter-ret.rs \
461480
lazychan.rs \
462481
lib-bitv.rs \
@@ -478,7 +497,6 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
478497
mutable-alias-vec.rs \
479498
obj-as.rs \
480499
obj-dtor.rs \
481-
obj-return-polytypes.rs \
482500
pred.rs \
483501
preempt.rs \
484502
rt-circular-buffer.rs \
@@ -511,13 +529,11 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
511529
threads.rs \
512530
type-sizes.rs \
513531
typestate-cfg-nesting.rs \
514-
use-import-export.rs \
515532
user.rs \
516533
utf8.rs \
517534
vec-alloc-append.rs \
518535
vec-append.rs \
519536
vec-slice.rs \
520-
while-prelude-drop.rs \
521537
while-with-break.rs \
522538
yield.rs \
523539
yield2.rs \
@@ -764,9 +780,9 @@ test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
764780
@$(call CFG_ECHO, assemble [llvm]: $<)
765781
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
766782

767-
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME)
783+
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME) glue.o
768784
@$(call CFG_ECHO, link [llvm]: $<)
769-
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ $< -L. -lrustrt
785+
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) glue.o -o $@ $< -L. -lrustrt
770786
@# dsymutil sometimes fails or prints a warning, but the
771787
@# program still runs. Since it simplifies debugging other
772788
@# programs, I\'ll live with the noise.
@@ -803,7 +819,7 @@ C_DEPFILES := $(RUNTIME_CS:%.cpp=%.d)
803819
%.d: %.cpp $(MKFILES)
804820
@$(call CFG_ECHO, dep: $<)
805821
$(CFG_QUIET)$(call CFG_DEPEND_C, $@ \
806-
$(patsubst %.cpp, %$(CFG_OBJ_SUFFIX), $<), \
822+
$(patsubst %.cpp, %.o, $<), \
807823
$(RUNTIME_INCS)) $< $(CFG_PATH_MUNGE) >[email protected] \
808824
809825

@@ -826,9 +842,15 @@ RUSTBOOT_PROBE := $(wildcard $(CFG_BOOT))
826842
ifneq ($(RUSTBOOT_PROBE),)
827843
CFG_INFO := $(info cfg: using built $(CFG_BOOT) for rust deps)
828844
STDLIB_DEPFILE := $(CFG_STDLIB).d
845+
RUSTC_DEPFILE := $(CFG_RUSTC).d
829846
CRATE_DEPFILES := $(ALL_TEST_CRATES:%.rc=%.d) $(STDLIB_DEPFILE)
830847

831-
$(STDLIB_DEPFILE): $(STDLIB_CRATE) $(MKFILES) $(CFG_BOOT)
848+
$(STDLIB_DEPFILE): $(STDLIB_CRATE) $(MKFILES) $(CFG_BOOT) $(STDLIB_INPUTS)
849+
@$(call CFG_ECHO, dep: $<)
850+
$(BOOT) -shared -rdeps $< $(CFG_PATH_MUNGE) >$@.tmp \
851+
852+
853+
$(RUSTC_DEPFILE): $(STDLIB_CRATE) $(MKFILES) $(CFG_BOOT) $(COMPILER_INPUTS)
832854
@$(call CFG_ECHO, dep: $<)
833855
$(BOOT) -shared -rdeps $< $(CFG_PATH_MUNGE) >$@.tmp \
834856
@@ -920,12 +942,12 @@ clean:
920942
$(CFG_QUIET)rm -f $(ML_DEPFILES:%.d=%.d.tmp)
921943
$(CFG_QUIET)rm -f $(C_DEPFILES:%.d=%.d.tmp)
922944
$(CFG_QUIET)rm -f $(CRATE_DEPFILES:%.d=%.d.tmp)
923-
$(CFG_QUIET)rm -f $(GENERATED)
945+
$(CFG_QUIET)rm -f $(GENERATED) glue.bc glue.s
924946
$(CFG_QUIET)rm -f $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
925947
$(CFG_QUIET)rm -Rf $(PKG_NAME)-*.tar.gz dist
926-
$(CFG_QUIET)rm -f $(foreach ext,cmx cmi cmo cma o a d exe,\
948+
$(CFG_QUIET)rm -f $(foreach ext,cmx cmi cmo cma bc o a d exe,\
927949
$(wildcard boot/*/*.$(ext) boot/*/*/*.$(ext)))
928-
$(CFG_QUIET)rm -Rf $(foreach ext,out llvm x86 boot rustc o s exe dSYM,\
950+
$(CFG_QUIET)rm -Rf $(foreach ext,out llvm x86 boot rustc bc o s exe dSYM,\
929951
$(wildcard test/*/*.$(ext)))
930952

931953

src/boot/be/abi.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ let general_code_alignment = 16;;
8080
let tydesc_field_first_param = 0;;
8181
let tydesc_field_size = 1;;
8282
let tydesc_field_align = 2;;
83-
let tydesc_field_copy_glue = 3;;
83+
let tydesc_field_take_glue = 3;;
8484
let tydesc_field_drop_glue = 4;;
8585
let tydesc_field_free_glue = 5;;
8686
let tydesc_field_sever_glue = 6;;

src/boot/driver/main.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11

22
open Common;;
33

4-
let _ =
5-
Gc.set { (Gc.get()) with
6-
Gc.space_overhead = 400; }
7-
;;
8-
94
let (targ:Common.target) =
105
match Sys.os_type with
116

src/boot/me/semant.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type glue =
2020
| GLUE_yield
2121
| GLUE_exit_main_task
2222
| GLUE_exit_task
23-
| GLUE_copy of Ast.ty (* One-level copy. *)
23+
| GLUE_take of Ast.ty (* One-level refcounts++. *)
2424
| GLUE_drop of Ast.ty (* De-initialize local memory. *)
2525
| GLUE_free of Ast.ty (* Drop body + free() box ptr. *)
2626
| GLUE_sever of Ast.ty (* Null all box state slots. *)
@@ -2776,7 +2776,7 @@ let glue_str (cx:ctxt) (g:glue) : string =
27762776
| GLUE_yield -> "glue$yield"
27772777
| GLUE_exit_main_task -> "glue$exit_main_task"
27782778
| GLUE_exit_task -> "glue$exit_task"
2779-
| GLUE_copy ty -> "glue$copy$" ^ (ty_str cx ty)
2779+
| GLUE_take ty -> "glue$take$" ^ (ty_str cx ty)
27802780
| GLUE_drop ty -> "glue$drop$" ^ (ty_str cx ty)
27812781
| GLUE_free ty -> "glue$free$" ^ (ty_str cx ty)
27822782
| GLUE_sever ty -> "glue$sever$" ^ (ty_str cx ty)

0 commit comments

Comments
 (0)