Skip to content

Commit f1ffef8

Browse files
committed
---
yaml --- r: 2618 b: refs/heads/master c: 96516e9 h: refs/heads/master v: v3
1 parent a1dfb8f commit f1ffef8

File tree

9 files changed

+24
-11
lines changed

9 files changed

+24
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 6a4a85f452ffe028e3be531f718c3545b1dc06ce
2+
refs/heads/master: 96516e9ca263574fa58c2f0a48348fa0d876be10

trunk/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export CFG_LLVM_ROOT
163163

164164
LLVM_AS := $(CFG_LLVM_BINDIR)/llvm-as
165165

166+
LLC := $(CFG_LLVM_BINDIR)/llc
166167

167168
######################################################################
168169
# Single-target rules

trunk/mk/rt.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ RUNTIME_CS := rt/sync/timer.cpp \
3131
rt/test/rust_test_runtime.cpp \
3232
rt/test/rust_test_util.cpp
3333

34+
RUNTIME_LL := rt/new_exit.ll
35+
3436
RUNTIME_HDR := rt/globals.h \
3537
rt/rust.h \
3638
rt/rust_dwarf.h \
@@ -63,14 +65,17 @@ RUNTIME_HDR := rt/globals.h \
6365

6466
RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
6567
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash
66-
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o)
68+
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) $(RUNTIME_LL:.ll=.o)
6769
RUNTIME_LIBS := $(CFG_GCCISH_POST_LIB_FLAGS)
6870

6971

7072
rt/%.o: rt/%.cpp $(MKFILES)
7173
@$(call E, compile: $@)
7274
$(Q)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $<
7375

76+
rt/%.o: rt/%.ll $(MKFILES)
77+
@$(call E, llc: $@)
78+
$(Q)$(LLC) -filetype=obj -relocation-model=pic -march=x86 -o $@ $<
7479

7580
rt/$(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR) $(RUNTIME_DEF)
7681
@$(call E, link: $@)

trunk/src/rt/new_exit.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare fastcc i32 @rust_native_rust_1(i32, i32)
2+
3+
declare i32 @upcall_exit(i32)
4+
5+
define void @rust_new_exit_task_glue(i32, i32, i32, i32, i32) {
6+
entry:
7+
%5 = inttoptr i32 %0 to void (i32, i32, i32, i32)*
8+
tail call fastcc void %5(i32 %1, i32 %2, i32 %3, i32 %4)
9+
%6 = tail call fastcc i32 @rust_native_rust_1(i32 ptrtoint (i32 (i32)* @upcall_exit to i32), i32 %2)
10+
ret void
11+
}

trunk/src/rt/rust.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc,
9999
}
100100

101101
uintptr_t main_args[4] = {0, 0, 0, (uintptr_t)args->args};
102-
dom->root_task->start(crate->get_exit_task_glue(),
102+
dom->root_task->start((uintptr_t)rust_new_exit_task_glue,
103103
main_fn,
104104
(uintptr_t)&main_args, sizeof(main_args));
105105

trunk/src/rt/rust_crate.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ rust_crate::get_activate_glue() const {
1616
return (activate_glue_ty) ((uintptr_t)this + activate_glue_off);
1717
}
1818

19-
uintptr_t
20-
rust_crate::get_exit_task_glue() const {
21-
return ((uintptr_t)this + exit_task_glue_off);
22-
}
23-
2419
uintptr_t
2520
rust_crate::get_unwind_glue() const {
2621
return ((uintptr_t)this + unwind_glue_off);

trunk/src/rt/rust_dom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ rust_dom::start_main_loop() {
263263

264264
DLOG(this, dom, "started domain loop");
265265
DLOG(this, dom, "activate glue: " PTR ", exit glue: " PTR,
266-
root_crate->get_activate_glue(), root_crate->get_exit_task_glue());
266+
root_crate->get_activate_glue(), rust_new_exit_task_glue);
267267

268268
while (number_of_live_tasks() > 0) {
269269
A(this, kernel->is_deadlocked() == false, "deadlock");

trunk/src/rt/rust_internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ class rust_crate {
251251
uintptr_t get_yield_glue() const;
252252
uintptr_t get_unwind_glue() const;
253253
uintptr_t get_gc_glue() const;
254-
uintptr_t get_exit_task_glue() const;
255254

256255
struct mem_area
257256
{
@@ -358,6 +357,8 @@ rust_crate_cache : public dom_owned<rust_crate_cache>,
358357
void flush();
359358
};
360359

360+
extern "C" void rust_new_exit_task_glue();
361+
361362
#include "rust_dwarf.h"
362363

363364
class

trunk/src/rt/test/rust_test_runtime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ rust_task_test::worker::run() {
5353
rust_handle<rust_dom> *handle =
5454
kernel->create_domain(crate, "test");
5555
rust_dom *domain = handle->referent();
56-
domain->root_task->start(crate->get_exit_task_glue(),
56+
domain->root_task->start((uintptr_t)rust_new_exit_task_glue,
5757
(uintptr_t)&task_entry, (uintptr_t)NULL, 0);
5858
domain->start_main_loop();
5959
kernel->destroy_domain(domain);

0 commit comments

Comments
 (0)