Implement the VLS roadmap on the native VBS build

Native VBS and CMake builds of the server and every registered suite:
protocol and document sync, VBS/compdb providers, stock GCC diagnostics
(including in-process default profile preparation), the stock occurrence
observer and hover/definition, the bounded Scheduler, C++ module graph,
scan and artifact cache with real CMI production, the context-aware
symbol index with schema-2 snapshot migration, navigation and guarded
rename, reflection provenance with splice-origin extraction, index-backed
completion and signature help, live GCC worker control with a registered
DAP suite, and the Neovim and VS Code clients.

VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced
from the versioned patches and verified stepping reflection/template code
with projected values 17/34 and 41/82.
This commit is contained in:
faumaray committed 2026-12-05 14:06:50 +03:00
1 parent ca04975d54
commit da8003f6d4
310 files changed
+47552 -480

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
#pragma once
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <stop_token>
#include <string>
#include <string_view>
namespace vls::scheduler {
enum class Priority { artifact = 0, background = 1, foreground = 2 };
struct Budget {
std::size_t foreground{4};
std::size_t background{2};
std::size_t artifact{1};
std::size_t queued{64};
std::size_t memory_mib{1024};
std::chrono::milliseconds watchdog{30000};
[[nodiscard]] bool valid() const noexcept;
};
enum class Outcome { completed, failed, cancelled, timed_out };
struct Estimate {
Priority priority{Priority::background};
std::string key;
std::uint64_t revision{};
std::size_t memory_mib{};
};
struct Result {
std::string key;
std::uint64_t revision{};
Outcome outcome{Outcome::failed};
std::string detail;
};
struct Metrics {
std::uint64_t accepted{}, completed{}, failed{}, cancelled{}, timed_out{}, rejected{};
std::size_t queued_peak{}, running_peak{}, running_memory_peak{};
std::uint64_t queue_nanoseconds{}, run_nanoseconds{};
};
// Work returns a detail string on success or throws on failure. It must honor
// the stop token so cancellation and the running watchdog stay bounded.
using Work = std::function<std::string(std::stop_token)>;
using Completion = std::function<void(Result)>;
// Bounded, priority-separated executor. Foreground, background and artifact
// pools have reserved capacity, so a saturated background queue never delays a
// foreground request. Every accepted submission receives exactly one terminal
// completion; a refused submission receives none and returns false.
class Scheduler {
public:
explicit Scheduler(Budget = Budget{});
~Scheduler();
Scheduler(const Scheduler &) = delete;
Scheduler &operator=(const Scheduler &) = delete;
Scheduler(Scheduler &&) = delete;
Scheduler &operator=(Scheduler &&) = delete;
// A newer revision of the same key supersedes queued work immediately and
// requests cooperative cancellation of running work.
[[nodiscard]] bool submit(Estimate, Work, Completion);
void cancel(std::string_view key);
void cancel_all();
// Waits until every accepted submission has reached a terminal result.
void drain();
[[nodiscard]] Metrics metrics() const;
[[nodiscard]] const Budget &budget() const noexcept;
private:
struct State;
std::unique_ptr<State> state_;
};
} // namespace vls::scheduler