Enable automatic native checkpoints and browser preview

This commit is contained in:
gloamxun committed 2026-11-19 10:05:41 +08:00
1 parent bb1a166c4c
commit 06463399bb
10 files changed
+877 -92

No files matched your search

+22 -6
View File
@@ -550,7 +550,13 @@ impl NativeCompiler {
/// position is a lower bound for a physical command boundary to retain.
/// Invalidated prefixes use the same full compiler in the same revision.
pub fn with_entry_checkpoints(mut self, minimum_frontier: usize) -> Self {
self.entry_checkpoints = Some(Arc::new(CheckpointCache::new(minimum_frontier)));
self.entry_checkpoints = Some(Arc::new(CheckpointCache::new(Some(minimum_frontier))));
self
}
/// Enable automatic prefix selection for a long-lived atomic project session.
pub fn with_automatic_entry_checkpoints(mut self) -> Self {
self.entry_checkpoints = Some(Arc::new(CheckpointCache::new(None)));
self
}
@@ -848,7 +854,16 @@ impl CompileJob {
.filter(|_| checkpoint_guard::can_stage(&request));
let format_cache = &self.compiler.format_cache;
let mut entry_checkpoint_work = EntryCheckpointWork::default();
let mut active_checkpoint = checkpoints.and_then(CheckpointCache::current);
let mut active_checkpoint =
checkpoints
.and_then(CheckpointCache::current)
.and_then(|available| match available.select(&request) {
Ok(selected) => Some(selected),
Err(error) => {
entry_checkpoint_work.rejection = Some(error);
None
}
});
let prepared = match active_checkpoint.as_ref() {
Some(candidate) => {
match candidate.prepare(&request, format_cache, &cancellation, evidence) {
@@ -909,14 +924,15 @@ impl CompileJob {
let before = cache.work();
let executor = executor.with_line_break_cache(cache.clone());
let (executed, next_checkpoint) = if let Some(current) = active_checkpoint {
let executed =
let (executed, next) =
current.resume(self.job, source, files, &mut entry_checkpoint_work)?;
(executed, Some(current))
(executed, Some(next))
} else if let Some(cache) = checkpoints {
let (executed, captured) =
cache.capture(&request, self.job, executor, source, files);
entry_checkpoint_work.captured_frontier =
captured.as_ref().map(|entry| entry.frontier());
if let Some(snapshot) = &captured {
snapshot.report_capture(&mut entry_checkpoint_work);
}
(executed, captured)
} else {
(self.job.run_detailed(executor, source, files), None)