Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SortIncludes: true
SortUsingDeclarations: Never
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^["<](spdlog|toml\+\+|coraing|cpptrace|flatbuffers)/'
- Regex: '^["<](spdlog|toml\+\+|coraing|cpptrace|flatbuffers|kota)/'
Priority: 30
SortPriority: 31

Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ target_link_libraries(clice-core PUBLIC
spdlog::spdlog
roaring::roaring
flatbuffers
eventide::ipc::lsp
eventide::serde::toml
kota::ipc::lsp
kota::codec::toml
simdjson::simdjson
)

add_executable(clice "${PROJECT_SOURCE_DIR}/src/clice.cc")
target_link_libraries(clice PRIVATE clice::core eventide::deco)
target_link_libraries(clice PRIVATE clice::core kota::deco)
install(TARGETS clice RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

add_custom_target(copy_clang_resource ALL
Expand Down Expand Up @@ -189,7 +189,7 @@ if(CLICE_ENABLE_TEST)
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/tests/unit"
)
target_link_libraries(unit_tests PRIVATE clice::core eventide::zest eventide::deco)
target_link_libraries(unit_tests PRIVATE clice::core kota::zest kota::deco)
endif()

if(CLICE_ENABLE_BENCHMARK)
Expand All @@ -199,7 +199,7 @@ if(CLICE_ENABLE_BENCHMARK)
target_include_directories(scan_benchmark PRIVATE
"${PROJECT_SOURCE_DIR}/src"
)
target_link_libraries(scan_benchmark PRIVATE clice::core eventide::deco)
target_link_libraries(scan_benchmark PRIVATE clice::core kota::deco)
endif()

if(CLICE_RELEASE)
Expand Down
14 changes: 6 additions & 8 deletions benchmarks/scan_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@
#include <thread>

#include "command/command.h"
#include "eventide/deco/deco.h"
#include "eventide/serde/json/serializer.h"
#include "support/filesystem.h"
#include "support/logging.h"
#include "support/path_pool.h"
#include "syntax/dependency_graph.h"

#include "kota/codec/json/serializer.h"
#include "kota/deco/deco.h"
#include "llvm/Support/FileSystem.h"

namespace et = eventide;

using namespace clice;

struct BenchmarkOptions {
Expand Down Expand Up @@ -97,7 +95,7 @@ void export_graph_json(const PathPool& path_pool,
export_data.files.push_back(std::move(node));
}

auto json = et::serde::json::to_json(export_data);
auto json = kota::codec::json::to_json(export_data);
if(!json) {
std::println(stderr, "Failed to serialize dependency graph");
return;
Expand Down Expand Up @@ -221,8 +219,8 @@ void print_report(const ScanReport& report) {
}

int main(int argc, const char** argv) {
auto args = deco::util::argvify(argc, argv);
auto result = deco::cli::parse<BenchmarkOptions>(args);
auto args = kota::deco::util::argvify(argc, argv);
auto result = kota::deco::cli::parse<BenchmarkOptions>(args);

if(!result.has_value()) {
std::println(stderr, "Error: {}", result.error().message);
Expand All @@ -233,7 +231,7 @@ int main(int argc, const char** argv) {

if(opts.help.value_or(false) || !opts.cdb_path.has_value()) {
std::ostringstream oss;
deco::cli::write_usage_for<BenchmarkOptions>(oss, "scan_benchmark [OPTIONS] <cdb>");
kota::deco::cli::write_usage_for<BenchmarkOptions>(oss, "scan_benchmark [OPTIONS] <cdb>");
std::print("{}", oss.str());
return opts.help.value_or(false) ? 0 : 1;
}
Expand Down
20 changes: 10 additions & 10 deletions cmake/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" FORCE)

FetchContent_Declare(
eventide
GIT_REPOSITORY https://github.com/clice-io/eventide
kotatsu
GIT_REPOSITORY https://github.com/clice-io/kotatsu
GIT_TAG main
GIT_SHALLOW TRUE
)

set(ETD_ENABLE_ZEST ON)
set(ETD_ENABLE_TEST OFF)
set(ETD_SERDE_ENABLE_SIMDJSON ON)
set(ETD_SERDE_ENABLE_YYJSON ON)
set(ETD_SERDE_ENABLE_TOML ON)
set(ETD_ENABLE_EXCEPTIONS OFF)
set(ETD_ENABLE_RTTI OFF)
set(KOTA_ENABLE_ZEST ON)
set(KOTA_ENABLE_TEST OFF)
set(KOTA_CODEC_ENABLE_SIMDJSON ON)
set(KOTA_CODEC_ENABLE_YYJSON ON)
set(KOTA_CODEC_ENABLE_TOML ON)
set(KOTA_ENABLE_EXCEPTIONS OFF)
set(KOTA_ENABLE_RTTI OFF)

FetchContent_MakeAvailable(eventide spdlog croaring flatbuffers)
FetchContent_MakeAvailable(kotatsu spdlog croaring flatbuffers)
8 changes: 4 additions & 4 deletions docs/en/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The worker pool (`src/server/worker_pool.cpp`) manages spawning and communicatin

### Communication

Workers communicate with the master via **stdio pipes** using a **bincode** serialization format (via `eventide::ipc::BincodePeer`). This is more compact and faster than JSON for internal IPC, while the master handles JSON for the external LSP protocol.
Workers communicate with the master via **stdio pipes** using a **bincode** serialization format (via `kota::ipc::BincodePeer`). This is more compact and faster than JSON for internal IPC, while the master handles JSON for the external LSP protocol.

### Stateful Worker Routing

Expand All @@ -111,7 +111,7 @@ The stateful worker (`src/server/stateful_worker.cpp`) caches compiled ASTs in m
- **Feature queries**: Look up the cached AST and invoke the corresponding `feature::*` function (hover, semantic tokens, etc.), serializing the result to JSON
- **Document updates**: Received as notifications — the worker updates the stored text and marks the document as `dirty`, causing feature queries to return `null` until recompilation
- **Eviction**: LRU-based; evicts the oldest document when capacity is exceeded, notifying the master
- **Concurrency**: Each document has a per-document `et::mutex` (strand) to serialize compilation and feature queries. Heavy work (compilation, feature extraction) runs on a thread pool via `et::queue`.
- **Concurrency**: Each document has a per-document `kota::mutex` (strand) to serialize compilation and feature queries. Heavy work (compilation, feature extraction) runs on a thread pool via `kota::queue`.

## Stateless Worker

Expand All @@ -123,7 +123,7 @@ The stateless worker (`src/server/stateless_worker.cpp`) handles one-shot reques
- **Build PCM**: Compiles a C++20 module interface to a temporary file
- **Index**: Compiles a file for indexing (TUIndex generation — currently a stub)

All requests are dispatched to a thread pool via `et::queue`.
All requests are dispatched to a thread pool via `kota::queue`.

## Compile Graph

Expand All @@ -132,7 +132,7 @@ The compile graph (`src/server/compile_graph.cpp`) tracks compilation unit depen
- **Registration**: Each file registers its included dependencies
- **Cascade invalidation**: When a file changes, all transitive dependents are marked dirty and their ongoing compilations are cancelled
- **Dependency compilation**: Before compiling a file, `compile_deps` ensures all dependencies (PCH, PCMs) are built first
- **Cancellation**: Uses `et::cancellation_source` to abort in-flight compilations when files are invalidated
- **Cancellation**: Uses `kota::cancellation_source` to abort in-flight compilations when files are invalidated

## Configuration

Expand Down
50 changes: 25 additions & 25 deletions src/clice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
#include <print>
#include <string>

#include "eventide/async/async.h"
#include "eventide/deco/deco.h"
#include "eventide/ipc/peer.h"
#include "eventide/ipc/recording_transport.h"
#include "eventide/ipc/transport.h"
#include "server/master_server.h"
#include "server/stateful_worker.h"
#include "server/stateless_worker.h"
#include "support/logging.h"

#include "kota/async/async.h"
#include "kota/deco/deco.h"
#include "kota/ipc/codec/json.h"
#include "kota/ipc/peer.h"
#include "kota/ipc/recording_transport.h"
#include "kota/ipc/transport.h"

namespace clice {

using deco::decl::KVStyle;
using kota::deco::decl::KVStyle;

struct Options {
DecoKV(style = KVStyle::JoinedOrSeparate,
Expand Down Expand Up @@ -72,8 +74,8 @@ int main(int argc, const char** argv) {
signal(SIGPIPE, SIG_IGN);
#endif

auto args = deco::util::argvify(argc, argv);
auto result = deco::cli::parse<clice::Options>(args);
auto args = kota::deco::util::argvify(argc, argv);
auto result = kota::deco::cli::parse<clice::Options>(args);

if(!result.has_value()) {
LOG_ERROR("{}", result.error().message);
Expand All @@ -83,7 +85,7 @@ int main(int argc, const char** argv) {
auto& opts = result->options;

if(opts.help.value_or(false)) {
deco::cli::write_usage_for<clice::Options>(std::cout, "clice [OPTIONS]");
kota::deco::cli::write_usage_for<clice::Options>(std::cout, "clice [OPTIONS]");
return 0;
}

Expand Down Expand Up @@ -132,23 +134,22 @@ int main(int argc, const char** argv) {
if(mode == "pipe") {
clice::logging::stderr_logger("master", clice::logging::options);

namespace et = eventide;
et::event_loop loop;
kota::event_loop loop;

auto transport = et::ipc::StreamTransport::open_stdio(loop);
auto transport = kota::ipc::StreamTransport::open_stdio(loop);
if(!transport) {
LOG_ERROR("failed to open stdio transport");
return 1;
}

std::unique_ptr<et::ipc::Transport> final_transport = std::move(*transport);
std::unique_ptr<kota::ipc::Transport> final_transport = std::move(*transport);
if(opts.record.has_value()) {
final_transport =
std::make_unique<et::ipc::RecordingTransport>(std::move(final_transport),
*opts.record);
std::make_unique<kota::ipc::RecordingTransport>(std::move(final_transport),
*opts.record);
}

et::ipc::JsonPeer peer(loop, std::move(final_transport));
kota::ipc::JsonPeer peer(loop, std::move(final_transport));
clice::MasterServer server(loop, peer, std::move(self_path));
server.register_handlers();

Expand All @@ -160,21 +161,20 @@ int main(int argc, const char** argv) {
if(mode == "socket") {
clice::logging::stderr_logger("master", clice::logging::options);

namespace et = eventide;
et::event_loop loop;
kota::event_loop loop;

auto host = opts.host.value_or("127.0.0.1");
auto port = opts.port.value_or(50051);

auto acceptor = et::tcp::listen(host, port, {}, loop);
auto acceptor = kota::tcp::listen(host, port, {}, loop);
if(!acceptor) {
LOG_ERROR("failed to listen on {}:{}", host, port);
return 1;
}

LOG_INFO("Listening on {}:{} ...", host, port);

auto task = [&]() -> et::task<> {
auto task = [&]() -> kota::task<> {
auto client = co_await acceptor->accept();
if(!client.has_value()) {
LOG_ERROR("failed to accept connection");
Expand All @@ -184,13 +184,13 @@ int main(int argc, const char** argv) {

LOG_INFO("Client connected");

std::unique_ptr<et::ipc::Transport> transport =
std::make_unique<et::ipc::StreamTransport>(std::move(client.value()));
std::unique_ptr<kota::ipc::Transport> transport =
std::make_unique<kota::ipc::StreamTransport>(std::move(client.value()));
if(opts.record.has_value()) {
transport = std::make_unique<et::ipc::RecordingTransport>(std::move(transport),
*opts.record);
transport = std::make_unique<kota::ipc::RecordingTransport>(std::move(transport),
*opts.record);
}
et::ipc::JsonPeer peer(loop, std::move(transport));
kota::ipc::JsonPeer peer(loop, std::move(transport));
clice::MasterServer server(loop, peer, std::string(self_path));
server.register_handlers();

Expand Down
4 changes: 2 additions & 2 deletions src/command/toolchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <vector>

#include "command/argument_parser.h"
#include "eventide/reflection/enum.h"
#include "support/filesystem.h"
#include "support/logging.h"

#include "kota/meta/enum.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
Expand Down Expand Up @@ -363,7 +363,7 @@ std::vector<const char*> query_toolchain(const QueryParams& params) {
case CompilerFamily::Unknown: {
/// TODO: nvcc and intel compilers need further exploration.
LOG_ERROR("Fail to query driver, unknown supported driver kind: {}, driver is {}",
eventide::refl::enum_name(family),
kota::meta::enum_name(family),
driver);

std::vector<const char*> result;
Expand Down
5 changes: 3 additions & 2 deletions src/feature/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#include <string>
#include <vector>

#include "eventide/ipc/lsp/uri.h"
#include "feature/feature.h"

#include "kota/ipc/lsp/uri.h"

namespace clice::feature {

namespace {

namespace lsp = eventide::ipc::lsp;
namespace lsp = kota::ipc::lsp;

auto to_uri(llvm::StringRef file) -> std::string {
const auto file_view = std::string_view(file.data(), file.size());
Expand Down
13 changes: 7 additions & 6 deletions src/feature/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

#include "compile/compilation.h"
#include "compile/compilation_unit.h"
#include "eventide/ipc/lsp/position.h"
#include "eventide/ipc/lsp/protocol.h"

#include "kota/ipc/lsp/position.h"
#include "kota/ipc/lsp/protocol.h"

namespace clang {

Expand All @@ -18,11 +19,11 @@ class NamedDecl;

namespace clice::feature {

namespace protocol = eventide::ipc::protocol;
namespace protocol = kota::ipc::protocol;

using eventide::ipc::lsp::PositionEncoding;
using eventide::ipc::lsp::PositionMapper;
using eventide::ipc::lsp::parse_position_encoding;
using kota::ipc::lsp::PositionEncoding;
using kota::ipc::lsp::PositionMapper;
using kota::ipc::lsp::parse_position_encoding;

inline auto to_range(const PositionMapper& converter, LocalSourceRange range) -> protocol::Range {
return protocol::Range{
Expand Down
Loading
Loading