Skip to content

Commit a0d44eb

Browse files
committed
fix review comments
1 parent 8cafc1f commit a0d44eb

11 files changed

Lines changed: 24 additions & 27 deletions

File tree

clangpass/refactor_matcher.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
#include "clang/AST/ExprCXX.h"
44
#include "clang/ASTMatchers/ASTMatchers.h"
55
#include "clang/Frontend/CompilerInstance.h"
6-
#include "clang/Lex/Lexer.h"
76
#include "clang/Rewrite/Core/Rewriter.h"
8-
#include "clang/Rewrite/Frontend/FixItRewriter.h"
97
#include "clangpass.h"
108
#include "llvm/Support/raw_ostream.h"
119

runtime/futex.cpp

Lines changed: 0 additions & 1 deletion
This file was deleted.

runtime/include/blocking_primitives.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
namespace ltest {
77

88
struct mutex {
9-
___atomic void lock() {
9+
as_atomic void lock() {
1010
while (locked) {
1111
this_coro->SetBlocked(state);
1212
CoroYield();
1313
}
1414
locked = 1;
1515
}
1616

17-
___atomic bool try_lock() {
17+
as_atomic bool try_lock() {
1818
if (locked) {
1919
CoroYield();
2020
return false;
@@ -23,7 +23,7 @@ struct mutex {
2323
return true;
2424
}
2525

26-
___atomic void unlock() {
26+
as_atomic void unlock() {
2727
locked = 0;
2828
futex_queues.PopAll(
2929
state.addr); // Two have the ability schedule any coroutine
@@ -35,25 +35,25 @@ struct mutex {
3535
};
3636

3737
struct shared_mutex {
38-
___atomic void lock() {
38+
as_atomic void lock() {
3939
while (locked != 0) {
4040
this_coro->SetBlocked(state);
4141
CoroYield();
4242
}
4343
locked = -1;
4444
}
45-
___atomic void unlock() {
45+
as_atomic void unlock() {
4646
locked = 0;
4747
futex_queues.PopAll(state.addr);
4848
}
49-
___atomic void lock_shared() {
49+
as_atomic void lock_shared() {
5050
while (locked == -1) {
5151
this_coro->SetBlocked(state);
5252
CoroYield();
5353
}
5454
++locked;
5555
}
56-
___atomic void unlock_shared() {
56+
as_atomic void unlock_shared() {
5757
--locked;
5858
futex_queues.PopAll(state.addr);
5959
}

runtime/include/syscall_trap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
extern bool __trap_syscall;
3+
extern bool ltest_trap_syscall;
44

55
namespace ltest {
66

runtime/include/verifying_macro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern std::vector<TaskBuilder> task_builders;
1818
// Tell that the function need to be converted to the coroutine.
1919
#define non_atomic attr(ltest_nonatomic)
2020
// Tell that the function must not contain interleavings.
21-
#define ___atomic attr(ltest_atomic)
21+
#define as_atomic attr(ltest_atomic)
2222

2323
namespace ltest {
2424

runtime/include/yield_guard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
extern bool __yield;
3+
extern bool ltest_yield;
44

55
namespace ltest {
66

runtime/lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ std::string_view CoroBase::GetName() const { return name; }
5959
bool CoroBase::IsReturned() const { return is_returned; }
6060

6161
extern "C" void CoroYield() {
62-
if (!__yield) [[unlikely]] {
62+
if (!ltest_yield) [[unlikely]] {
6363
return;
6464
}
6565
assert(this_coro && sched_ctx);

runtime/syscall_trap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/// Required for incapsulating syscall traps only in special places where it's
44
/// really needed
5-
bool __trap_syscall = 0;
5+
bool ltest_trap_syscall = 0;
66

7-
ltest::SyscallTrapGuard::SyscallTrapGuard() { __trap_syscall = true; }
7+
ltest::SyscallTrapGuard::SyscallTrapGuard() { ltest_trap_syscall = true; }
88

9-
ltest::SyscallTrapGuard::~SyscallTrapGuard() { __trap_syscall = false; }
9+
ltest::SyscallTrapGuard::~SyscallTrapGuard() { ltest_trap_syscall = false; }

runtime/yield_guard.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/// Required for incapsulating CoroYield calls only in coroutines code, allowing
44
/// to call methods annotated with non_atomic in scheduler fiber
5-
bool __yield = 0;
5+
bool ltest_yield = 0;
66

7-
ltest::AllowYieldArea::AllowYieldArea() { __yield = true; }
7+
ltest::AllowYieldArea::AllowYieldArea() { ltest_yield = true; }
88

9-
ltest::AllowYieldArea::~AllowYieldArea() { __yield = false; }
9+
ltest::AllowYieldArea::~AllowYieldArea() { ltest_yield = false; }

syscall_intercept/hook.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
static int hook(long syscall_number, long arg0, long arg1, long arg2, long arg3,
1414
long arg4, long arg5, long *result) {
15-
if (!__trap_syscall) {
15+
if (!ltest_trap_syscall) {
1616
return 1;
1717
}
1818
if (syscall_number == SYS_sched_yield) {
@@ -29,7 +29,6 @@ static int hook(long syscall_number, long arg0, long arg1, long arg2, long arg3,
2929
this_coro->SetBlocked(fstate);
3030
futex_queues.Push(fstate, this_coro.get());
3131
CoroYield();
32-
debug(stderr, "Returned\n");
3332
*result = 0;
3433
} else {
3534
errno = EAGAIN;

0 commit comments

Comments
 (0)