Skip to content

Commit ea9b10e

Browse files
committed
---
yaml --- r: 14054 b: refs/heads/try c: 21d783c h: refs/heads/master v: v3
1 parent faf934e commit ea9b10e

File tree

6 files changed

+13
-20
lines changed

6 files changed

+13
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: f7a727e8613ac453db4e4aa2c4c00140c8a5ee3f
5+
refs/heads/try: 21d783c33844028d8baa0d4d022fc244fc3ba77b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_builtin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ rand_new() {
139139
task->fail();
140140
return NULL;
141141
}
142-
isaac_init(thread, rctx);
142+
isaac_init(thread->kernel, rctx);
143143
return rctx;
144144
}
145145

branches/try/src/rt/rust_scheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rust_scheduler::rust_scheduler(rust_kernel *kernel,
99
env(srv->env),
1010
num_threads(num_threads)
1111
{
12-
isaac_init(this, &rctx);
12+
isaac_init(kernel, &rctx);
1313
create_task_threads();
1414
}
1515

branches/try/src/rt/rust_task_thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rust_task_thread::rust_task_thread(rust_scheduler *sched,
3737
should_exit(false)
3838
{
3939
LOGPTR(this, "new dom", (uintptr_t)this);
40-
isaac_init(this, &rctx);
40+
isaac_init(kernel, &rctx);
4141
#ifndef __WIN32__
4242
pthread_attr_init(&attr);
4343
pthread_attr_setstacksize(&attr, 1024 * 1024);

branches/try/src/rt/rust_task_thread.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ struct rust_task_thread : public kernel_owned<rust_task_thread>,
117117

118118
virtual void run();
119119

120-
#ifdef __WIN32__
121-
inline void win32_require(LPCTSTR fn, BOOL ok) {
122-
kernel->win32_require(fn, ok);
123-
}
124-
#endif
125-
126120
void init_tls();
127121
void place_task_in_tls(rust_task *task);
128122

branches/try/src/rt/rust_util.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,12 @@ align_to(T size, size_t alignment) {
124124

125125
// Initialization helper for ISAAC RNG
126126

127-
template <typename thread_or_kernel>
128-
static inline void
129-
isaac_init(thread_or_kernel *thread, randctx *rctx)
127+
inline void
128+
isaac_init(rust_kernel *kernel, randctx *rctx)
130129
{
131130
memset(rctx, 0, sizeof(randctx));
132131

133-
char *rust_seed = thread->env->rust_seed;
132+
char *rust_seed = kernel->env->rust_seed;
134133
if (rust_seed != NULL) {
135134
ub4 seed = (ub4) atoi(rust_seed);
136135
for (size_t i = 0; i < RANDSIZ; i ++) {
@@ -140,24 +139,24 @@ isaac_init(thread_or_kernel *thread, randctx *rctx)
140139
} else {
141140
#ifdef __WIN32__
142141
HCRYPTPROV hProv;
143-
thread->win32_require
142+
kernel->win32_require
144143
(_T("CryptAcquireContext"),
145144
CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
146145
CRYPT_VERIFYCONTEXT|CRYPT_SILENT));
147-
thread->win32_require
146+
kernel->win32_require
148147
(_T("CryptGenRandom"),
149148
CryptGenRandom(hProv, sizeof(rctx->randrsl),
150149
(BYTE*)(&rctx->randrsl)));
151-
thread->win32_require
150+
kernel->win32_require
152151
(_T("CryptReleaseContext"),
153152
CryptReleaseContext(hProv, 0));
154153
#else
155154
int fd = open("/dev/urandom", O_RDONLY);
156-
I(thread, fd > 0);
157-
I(thread,
155+
I(kernel, fd > 0);
156+
I(kernel,
158157
read(fd, (void*) &rctx->randrsl, sizeof(rctx->randrsl))
159158
== sizeof(rctx->randrsl));
160-
I(thread, close(fd) == 0);
159+
I(kernel, close(fd) == 0);
161160
#endif
162161
}
163162

0 commit comments

Comments
 (0)