Skip to content

Commit a6ef0de

Browse files
committed
[libc][NFC] Rename RPC opcodes to better reflect their usage
Summary: RPC_ is a generic prefix here, use LIBC_ to indicate that these are opcodes used to implement the C library
1 parent 4226e0a commit a6ef0de

File tree

26 files changed

+110
-110
lines changed

26 files changed

+110
-110
lines changed

libc/shared/rpc_opcodes.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@
1515
#define LLVM_LIBC_OPCODE(n) (LLVM_LIBC_RPC_BASE << 24 | n)
1616

1717
typedef enum {
18-
RPC_NOOP = LLVM_LIBC_OPCODE(0),
19-
RPC_EXIT = LLVM_LIBC_OPCODE(1),
20-
RPC_WRITE_TO_STDOUT = LLVM_LIBC_OPCODE(2),
21-
RPC_WRITE_TO_STDERR = LLVM_LIBC_OPCODE(3),
22-
RPC_WRITE_TO_STREAM = LLVM_LIBC_OPCODE(4),
23-
RPC_WRITE_TO_STDOUT_NEWLINE = LLVM_LIBC_OPCODE(5),
24-
RPC_READ_FROM_STREAM = LLVM_LIBC_OPCODE(6),
25-
RPC_READ_FGETS = LLVM_LIBC_OPCODE(7),
26-
RPC_OPEN_FILE = LLVM_LIBC_OPCODE(8),
27-
RPC_CLOSE_FILE = LLVM_LIBC_OPCODE(9),
28-
RPC_MALLOC = LLVM_LIBC_OPCODE(10),
29-
RPC_FREE = LLVM_LIBC_OPCODE(11),
30-
RPC_HOST_CALL = LLVM_LIBC_OPCODE(12),
31-
RPC_ABORT = LLVM_LIBC_OPCODE(13),
32-
RPC_FEOF = LLVM_LIBC_OPCODE(14),
33-
RPC_FERROR = LLVM_LIBC_OPCODE(15),
34-
RPC_CLEARERR = LLVM_LIBC_OPCODE(16),
35-
RPC_FSEEK = LLVM_LIBC_OPCODE(17),
36-
RPC_FTELL = LLVM_LIBC_OPCODE(18),
37-
RPC_FFLUSH = LLVM_LIBC_OPCODE(19),
38-
RPC_UNGETC = LLVM_LIBC_OPCODE(20),
39-
RPC_PRINTF_TO_STDOUT = LLVM_LIBC_OPCODE(21),
40-
RPC_PRINTF_TO_STDERR = LLVM_LIBC_OPCODE(22),
41-
RPC_PRINTF_TO_STREAM = LLVM_LIBC_OPCODE(23),
42-
RPC_PRINTF_TO_STDOUT_PACKED = LLVM_LIBC_OPCODE(24),
43-
RPC_PRINTF_TO_STDERR_PACKED = LLVM_LIBC_OPCODE(25),
44-
RPC_PRINTF_TO_STREAM_PACKED = LLVM_LIBC_OPCODE(26),
45-
RPC_REMOVE = LLVM_LIBC_OPCODE(27),
46-
RPC_RENAME = LLVM_LIBC_OPCODE(28),
47-
RPC_SYSTEM = LLVM_LIBC_OPCODE(29),
48-
RPC_LAST = 0xFFFFFFFF,
18+
LIBC_NOOP = LLVM_LIBC_OPCODE(0),
19+
LIBC_EXIT = LLVM_LIBC_OPCODE(1),
20+
LIBC_WRITE_TO_STDOUT = LLVM_LIBC_OPCODE(2),
21+
LIBC_WRITE_TO_STDERR = LLVM_LIBC_OPCODE(3),
22+
LIBC_WRITE_TO_STREAM = LLVM_LIBC_OPCODE(4),
23+
LIBC_WRITE_TO_STDOUT_NEWLINE = LLVM_LIBC_OPCODE(5),
24+
LIBC_READ_FROM_STREAM = LLVM_LIBC_OPCODE(6),
25+
LIBC_READ_FGETS = LLVM_LIBC_OPCODE(7),
26+
LIBC_OPEN_FILE = LLVM_LIBC_OPCODE(8),
27+
LIBC_CLOSE_FILE = LLVM_LIBC_OPCODE(9),
28+
LIBC_MALLOC = LLVM_LIBC_OPCODE(10),
29+
LIBC_FREE = LLVM_LIBC_OPCODE(11),
30+
LIBC_HOST_CALL = LLVM_LIBC_OPCODE(12),
31+
LIBC_ABORT = LLVM_LIBC_OPCODE(13),
32+
LIBC_FEOF = LLVM_LIBC_OPCODE(14),
33+
LIBC_FERROR = LLVM_LIBC_OPCODE(15),
34+
LIBC_CLEARERR = LLVM_LIBC_OPCODE(16),
35+
LIBC_FSEEK = LLVM_LIBC_OPCODE(17),
36+
LIBC_FTELL = LLVM_LIBC_OPCODE(18),
37+
LIBC_FFLUSH = LLVM_LIBC_OPCODE(19),
38+
LIBC_UNGETC = LLVM_LIBC_OPCODE(20),
39+
LIBC_PRINTF_TO_STDOUT = LLVM_LIBC_OPCODE(21),
40+
LIBC_PRINTF_TO_STDERR = LLVM_LIBC_OPCODE(22),
41+
LIBC_PRINTF_TO_STREAM = LLVM_LIBC_OPCODE(23),
42+
LIBC_PRINTF_TO_STDOUT_PACKED = LLVM_LIBC_OPCODE(24),
43+
LIBC_PRINTF_TO_STDERR_PACKED = LLVM_LIBC_OPCODE(25),
44+
LIBC_PRINTF_TO_STREAM_PACKED = LLVM_LIBC_OPCODE(26),
45+
LIBC_REMOVE = LLVM_LIBC_OPCODE(27),
46+
LIBC_RENAME = LLVM_LIBC_OPCODE(28),
47+
LIBC_SYSTEM = LLVM_LIBC_OPCODE(29),
48+
LIBC_LAST = 0xFFFFFFFF,
4949
} rpc_opcode_t;
5050

5151
#undef LLVM_LIBC_OPCODE

libc/src/__support/GPU/allocator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace {
1717

1818
void *rpc_allocate(uint64_t size) {
1919
void *ptr = nullptr;
20-
rpc::Client::Port port = rpc::client.open<RPC_MALLOC>();
20+
rpc::Client::Port port = rpc::client.open<LIBC_MALLOC>();
2121
port.send_and_recv(
2222
[=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = size; },
2323
[&](rpc::Buffer *buffer, uint32_t) {
@@ -28,7 +28,7 @@ void *rpc_allocate(uint64_t size) {
2828
}
2929

3030
void rpc_free(void *ptr) {
31-
rpc::Client::Port port = rpc::client.open<RPC_FREE>();
31+
rpc::Client::Port port = rpc::client.open<LIBC_FREE>();
3232
port.send([=](rpc::Buffer *buffer, uint32_t) {
3333
buffer->data[0] = reinterpret_cast<uintptr_t>(ptr);
3434
});

libc/src/__support/OSUtil/gpu/exit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace internal {
1818

1919
[[noreturn]] void exit(int status) {
2020
// We want to first make sure the server is listening before we exit.
21-
rpc::Client::Port port = rpc::client.open<RPC_EXIT>();
21+
rpc::Client::Port port = rpc::client.open<LIBC_EXIT>();
2222
port.send_and_recv([](rpc::Buffer *, uint32_t) {},
2323
[](rpc::Buffer *, uint32_t) {});
2424
port.send([&](rpc::Buffer *buffer, uint32_t) {

libc/src/__support/OSUtil/gpu/io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace LIBC_NAMESPACE_DECL {
1616

1717
void write_to_stderr(cpp::string_view msg) {
18-
rpc::Client::Port port = rpc::client.open<RPC_WRITE_TO_STDERR>();
18+
rpc::Client::Port port = rpc::client.open<LIBC_WRITE_TO_STDERR>();
1919
port.send_n(msg.data(), msg.size());
2020
port.recv([](rpc::Buffer *, uint32_t) { /* void */ });
2121
port.close();

libc/src/gpu/rpc_host_call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace LIBC_NAMESPACE_DECL {
1919
// arguments. We expect that the pointer here is a valid pointer on the server.
2020
LLVM_LIBC_FUNCTION(unsigned long long, rpc_host_call,
2121
(void *fn, void *data, size_t size)) {
22-
rpc::Client::Port port = rpc::client.open<RPC_HOST_CALL>();
22+
rpc::Client::Port port = rpc::client.open<LIBC_HOST_CALL>();
2323
port.send_n(data, size);
2424
port.send([=](rpc::Buffer *buffer, uint32_t) {
2525
buffer->data[0] = reinterpret_cast<uintptr_t>(fn);

libc/src/stdio/gpu/clearerr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace LIBC_NAMESPACE_DECL {
1616

1717
LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) {
18-
rpc::Client::Port port = rpc::client.open<RPC_CLEARERR>();
18+
rpc::Client::Port port = rpc::client.open<LIBC_CLEARERR>();
1919
port.send_and_recv(
2020
[=](rpc::Buffer *buffer, uint32_t) {
2121
buffer->data[0] = file::from_stream(stream);

libc/src/stdio/gpu/fclose.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace LIBC_NAMESPACE_DECL {
1818
LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) {
1919
uint64_t ret = 0;
2020
uintptr_t file = reinterpret_cast<uintptr_t>(stream);
21-
rpc::Client::Port port = rpc::client.open<RPC_CLOSE_FILE>();
21+
rpc::Client::Port port = rpc::client.open<LIBC_CLOSE_FILE>();
2222
port.send_and_recv(
2323
[=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = file; },
2424
[&](rpc::Buffer *buffer, uint32_t) { ret = buffer->data[0]; });

libc/src/stdio/gpu/feof.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
1616

1717
LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) {
1818
int ret;
19-
rpc::Client::Port port = rpc::client.open<RPC_FEOF>();
19+
rpc::Client::Port port = rpc::client.open<LIBC_FEOF>();
2020
port.send_and_recv(
2121
[=](rpc::Buffer *buffer, uint32_t) {
2222
buffer->data[0] = file::from_stream(stream);

libc/src/stdio/gpu/ferror.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
1616

1717
LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
1818
int ret;
19-
rpc::Client::Port port = rpc::client.open<RPC_FERROR>();
19+
rpc::Client::Port port = rpc::client.open<LIBC_FERROR>();
2020
port.send_and_recv(
2121
[=](rpc::Buffer *buffer, uint32_t) {
2222
buffer->data[0] = file::from_stream(stream);

libc/src/stdio/gpu/fflush.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
1616

1717
LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) {
1818
int ret;
19-
rpc::Client::Port port = rpc::client.open<RPC_FFLUSH>();
19+
rpc::Client::Port port = rpc::client.open<LIBC_FFLUSH>();
2020
port.send_and_recv(
2121
[=](rpc::Buffer *buffer, uint32_t) {
2222
buffer->data[0] = file::from_stream(stream);

0 commit comments

Comments
 (0)