Skip to content

Commit ef76499

Browse files
committed
---
yaml --- r: 42910 b: refs/heads/try c: 4f65169 h: refs/heads/master v: v3
1 parent e5cf115 commit ef76499

File tree

13 files changed

+3
-540
lines changed

13 files changed

+3
-540
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 542bf20414551638886ef6e79e2b7c1a69df97c2
5+
refs/heads/try: 4f6516969eb3f488f360a67af4d72f17ab312975
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/mk/rt.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ RUNTIME_CXXS_$(1) := \
5757
rt/rust_sched_reaper.cpp \
5858
rt/rust_task.cpp \
5959
rt/rust_stack.cpp \
60-
rt/rust_port.cpp \
6160
rt/rust_upcall.cpp \
6261
rt/rust_uv.cpp \
6362
rt/rust_crate_map.cpp \
6463
rt/rust_log.cpp \
6564
rt/rust_gc_metadata.cpp \
66-
rt/rust_port_selector.cpp \
6765
rt/rust_util.cpp \
6866
rt/circular_buffer.cpp \
6967
rt/isaac/randport.cpp \

branches/try/src/libcore/cleanup.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct Task {
8888
kernel: *Kernel, // 112
8989
name: *c_char, // 116
9090
list_index: i32, // 120
91-
rendezvous_ptr: *uintptr_t, // 124
9291
boxed_region: BoxedRegion // 128
9392
}
9493

@@ -107,7 +106,6 @@ struct Task {
107106
kernel: *Kernel,
108107
name: *c_char,
109108
list_index: i32,
110-
rendezvous_ptr: *uintptr_t,
111109
boxed_region: BoxedRegion
112110
}
113111

branches/try/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "sync/timer.h"
1818
#include "sync/rust_thread.h"
1919
#include "rust_abi.h"
20-
#include "rust_port.h"
2120

2221
#include <time.h>
2322

@@ -694,88 +693,13 @@ rust_sched_threads() {
694693
return task->sched->max_number_of_threads();
695694
}
696695

697-
extern "C" CDECL rust_port*
698-
rust_port_take(rust_port_id id) {
699-
rust_task *task = rust_get_current_task();
700-
return task->kernel->get_port_by_id(id);
701-
}
702-
703-
extern "C" CDECL void
704-
rust_port_drop(rust_port *p) {
705-
assert(p != NULL);
706-
p->deref();
707-
}
708-
709-
extern "C" CDECL rust_task_id
710-
rust_port_task(rust_port *p) {
711-
assert(p != NULL);
712-
return p->task->id;
713-
}
714-
715-
extern "C" CDECL rust_port*
716-
new_port(size_t unit_sz) {
717-
rust_task *task = rust_get_current_task();
718-
LOG(task, comm, "new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)",
719-
(uintptr_t) task, task->name, unit_sz);
720-
// port starts with refcount == 1
721-
return new (task->kernel, "rust_port") rust_port(task, unit_sz);
722-
}
723-
724-
extern "C" CDECL void
725-
rust_port_begin_detach(rust_port *port, uintptr_t *yield) {
726-
rust_task *task = rust_get_current_task();
727-
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
728-
port->begin_detach(yield);
729-
}
730-
731-
extern "C" CDECL void
732-
rust_port_end_detach(rust_port *port) {
733-
port->end_detach();
734-
}
735-
736-
extern "C" CDECL void
737-
del_port(rust_port *port) {
738-
rust_task *task = rust_get_current_task();
739-
LOG(task, comm, "del_port(0x%" PRIxPTR ")", (uintptr_t) port);
740-
delete port;
741-
}
742-
743-
extern "C" CDECL size_t
744-
rust_port_size(rust_port *port) {
745-
return port->size();
746-
}
747-
748-
extern "C" CDECL rust_port_id
749-
get_port_id(rust_port *port) {
750-
return port->id;
751-
}
752-
753-
extern "C" CDECL uintptr_t
754-
rust_port_id_send(rust_port_id target_port_id, void *sptr) {
755-
rust_task *task = rust_get_current_task();
756-
return (uintptr_t)task->kernel->send_to_port(target_port_id, sptr);
757-
}
758-
759696
// This is called by an intrinsic on the Rust stack and must run
760697
// entirely in the red zone. Do not call on the C stack.
761698
extern "C" CDECL MUST_CHECK bool
762699
rust_task_yield(rust_task *task, bool *killed) {
763700
return task->yield();
764701
}
765702

766-
extern "C" CDECL void
767-
port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) {
768-
port->receive(dptr, yield);
769-
}
770-
771-
extern "C" CDECL void
772-
rust_port_select(rust_port **dptr, rust_port **ports,
773-
size_t n_ports, uintptr_t *yield) {
774-
rust_task *task = rust_get_current_task();
775-
rust_port_selector *selector = task->get_port_selector();
776-
selector->select(task, dptr, ports, n_ports, yield);
777-
}
778-
779703
extern "C" CDECL void
780704
rust_set_exit_status(intptr_t code) {
781705
rust_task *task = rust_get_current_task();

branches/try/src/rt/rust_kernel.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212

1313
#include "rust_kernel.h"
14-
#include "rust_port.h"
1514
#include "rust_util.h"
1615
#include "rust_scheduler.h"
1716
#include "rust_sched_launcher.h"
@@ -26,7 +25,6 @@ rust_kernel::rust_kernel(rust_env *env) :
2625
_region(env, true),
2726
_log(NULL),
2827
max_task_id(INIT_TASK_ID-1), // sync_add_and_fetch increments first
29-
max_port_id(1),
3028
rval(0),
3129
max_sched_id(1),
3230
killed(false),
@@ -264,47 +262,6 @@ rust_kernel::generate_task_id() {
264262
return id;
265263
}
266264

267-
rust_port_id
268-
rust_kernel::register_port(rust_port *port) {
269-
uintptr_t new_live_ports;
270-
rust_port_id new_port_id;
271-
{
272-
scoped_lock with(port_lock);
273-
new_port_id = max_port_id++;
274-
port_table.put(new_port_id, port);
275-
new_live_ports = port_table.count();
276-
}
277-
assert(new_port_id != INTPTR_MAX && "Hit the maximum port id");
278-
KLOG_("Registered port %" PRIdPTR, new_port_id);
279-
KLOG_("Total outstanding ports: %d", new_live_ports);
280-
return new_port_id;
281-
}
282-
283-
void
284-
rust_kernel::release_port_id(rust_port_id id) {
285-
KLOG_("Releasing port %" PRIdPTR, id);
286-
uintptr_t new_live_ports;
287-
{
288-
scoped_lock with(port_lock);
289-
port_table.remove(id);
290-
new_live_ports = port_table.count();
291-
}
292-
KLOG_("Total outstanding ports: %d", new_live_ports);
293-
}
294-
295-
rust_port *
296-
rust_kernel::get_port_by_id(rust_port_id id) {
297-
assert(id != 0 && "invalid port id");
298-
scoped_lock with(port_lock);
299-
rust_port *port = NULL;
300-
// get leaves port unchanged if not found.
301-
port_table.get(id, &port);
302-
if(port) {
303-
port->ref();
304-
}
305-
return port;
306-
}
307-
308265
#ifdef __WIN32__
309266
void
310267
rust_kernel::win32_require(LPCTSTR fn, BOOL ok) {
@@ -400,21 +357,6 @@ rust_kernel::begin_shutdown() {
400357
allow_scheduler_exit();
401358
}
402359

403-
bool
404-
rust_kernel::send_to_port(rust_port_id chan, void *sptr) {
405-
KLOG_("rust_port_id*_send port: 0x%" PRIxPTR, (uintptr_t) chan);
406-
407-
rust_port *port = get_port_by_id(chan);
408-
if(port) {
409-
port->send(sptr);
410-
port->deref();
411-
return true;
412-
} else {
413-
KLOG_("didn't get the port");
414-
return false;
415-
}
416-
}
417-
418360
void
419361
rust_kernel::register_exit_function(spawn_fn runner, fn_env_pair *f) {
420362
scoped_lock with(at_exit_lock);

branches/try/src/rt/rust_kernel.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
The kernel is primarily responsible for managing the lifetime of
1616
schedulers, which in turn run rust tasks. It provides a memory
1717
allocator and logging service for use by other runtime components,
18-
it creates unique task and port ids and provides global access
19-
to ports by id.
18+
it creates unique task ids.
2019
2120
The kernel runs until there are no live schedulers.
2221
@@ -56,13 +55,11 @@ class rust_scheduler;
5655
class rust_sched_driver;
5756
class rust_sched_launcher_factory;
5857
struct rust_task_thread;
59-
class rust_port;
6058

61-
// Scheduler, task, and port handles. These uniquely identify within a
59+
// Scheduler, task handles. These uniquely identify within a
6260
// single kernel instance the objects they represent.
6361
typedef intptr_t rust_sched_id;
6462
typedef intptr_t rust_task_id;
65-
typedef intptr_t rust_port_id;
6663

6764
typedef std::map<rust_sched_id, rust_scheduler*> sched_map;
6865

@@ -80,12 +77,6 @@ class rust_kernel {
8077
// The next task id
8178
rust_task_id max_task_id;
8279

83-
// Protects max_port_id and port_table
84-
lock_and_signal port_lock;
85-
// The next port id
86-
rust_task_id max_port_id;
87-
hash_map<rust_port_id, rust_port *> port_table;
88-
8980
lock_and_signal rval_lock;
9081
int rval;
9182

@@ -163,10 +154,6 @@ class rust_kernel {
163154

164155
rust_task_id generate_task_id();
165156

166-
rust_port_id register_port(rust_port *port);
167-
rust_port *get_port_by_id(rust_port_id id);
168-
void release_port_id(rust_port_id tid);
169-
170157
void set_exit_status(int code);
171158

172159
rust_sched_id main_sched_id() { return main_scheduler; }
@@ -177,8 +164,6 @@ class rust_kernel {
177164
void inc_weak_task_count();
178165
void dec_weak_task_count();
179166

180-
bool send_to_port(rust_port_id chan, void *sptr);
181-
182167
void register_exit_function(spawn_fn runner, fn_env_pair *f);
183168
};
184169

0 commit comments

Comments
 (0)