Revert "debug: mark"

This reverts commit 5eb0a50a23.
This commit is contained in:
Shunsuke Shibayama 2024-09-16 21:32:01 +09:00
parent 6781db1588
commit fd76f56ba4
4 changed files with 4 additions and 16 deletions

View file

@ -418,7 +418,7 @@ impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable>
let res = self.resolve(&mut ast, &cfg); let res = self.resolve(&mut ast, &cfg);
debug_assert!(res.is_ok(), "{:?}", res.unwrap_err()); debug_assert!(res.is_ok(), "{:?}", res.unwrap_err());
log!(info "Dependency resolution process completed"); log!(info "Dependency resolution process completed");
println!("graph:\n{}", self.shared.graph.display()); log!("graph:\n{}", self.shared.graph.display());
if self.parse_errors.errors.is_empty() { if self.parse_errors.errors.is_empty() {
self.shared.warns.extend(self.parse_errors.warns.flush()); self.shared.warns.extend(self.parse_errors.warns.flush());
// continue analysis if ELS mode // continue analysis if ELS mode
@ -838,12 +838,9 @@ impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable>
write!(out, "Checking 0/{nmods}").unwrap(); write!(out, "Checking 0/{nmods}").unwrap();
out.flush().unwrap(); out.flush().unwrap();
} }
println!("here?: {path}");
let mut limit = 100000;
while let Some(ancestor) = ancestors.pop() { while let Some(ancestor) = ancestors.pop() {
if graph.ancestors(&ancestor).is_empty() { if graph.ancestors(&ancestor).is_empty() {
graph.remove(&ancestor); graph.remove(&ancestor);
limit = 100000;
if let Some(entry) = self.asts.remove(&ancestor) { if let Some(entry) = self.asts.remove(&ancestor) {
if print_progress { if print_progress {
let name = ancestor.file_name().unwrap_or_default().to_string_lossy(); let name = ancestor.file_name().unwrap_or_default().to_string_lossy();
@ -864,10 +861,6 @@ impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable>
self.build_inlined_module(&ancestor, graph); self.build_inlined_module(&ancestor, graph);
} }
} else { } else {
limit -= 1;
if limit == 0 {
panic!("{ancestor} is in a circular dependency");
}
ancestors.insert(0, ancestor); ancestors.insert(0, ancestor);
} }
} }
@ -950,7 +943,6 @@ impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable>
} }
} }
}; };
println!("Start to analyze {path}");
if SINGLE_THREAD { if SINGLE_THREAD {
run(); run();
self.shared.promises.mark_as_joined(path); self.shared.promises.mark_as_joined(path);

View file

@ -73,7 +73,7 @@ impl Context {
} }
if self.shared.is_some() && self.promises().is_registered(&path) && !self.mod_cached(&path) if self.shared.is_some() && self.promises().is_registered(&path) && !self.mod_cached(&path)
{ {
self.promises().join(&path).unwrap(); let _result = self.promises().join(&path);
} }
self.opt_mod_cache()? self.opt_mod_cache()?
.raw_ref_ctx(&path) .raw_ref_ctx(&path)

View file

@ -340,7 +340,6 @@ impl SharedModuleCache {
where where
NormalizedPathBuf: Borrow<Q>, NormalizedPathBuf: Borrow<Q>,
{ {
println!("343");
let mut cache = loop { let mut cache = loop {
if let Some(cache) = self.0.try_borrow_mut() { if let Some(cache) = self.0.try_borrow_mut() {
break cache; break cache;

View file

@ -160,7 +160,6 @@ impl SharedPromises {
} }
pub fn wait_until_finished(&self, path: &NormalizedPathBuf) { pub fn wait_until_finished(&self, path: &NormalizedPathBuf) {
println!("163");
if self.promises.borrow().get(path).is_none() { if self.promises.borrow().get(path).is_none() {
panic!("not registered: {path}"); panic!("not registered: {path}");
} }
@ -180,11 +179,9 @@ impl SharedPromises {
return Ok(()); return Ok(());
} }
if SINGLE_THREAD { if SINGLE_THREAD {
println!("182: {path}");
assert!(self.is_joined(path)); assert!(self.is_joined(path));
return Ok(()); return Ok(());
} }
println!("!?: {path}");
// Suppose A depends on B and C, and B depends on C. // Suppose A depends on B and C, and B depends on C.
// In this case, B must join C before A joins C. Otherwise, a deadlock will occur. // In this case, B must join C before A joins C. Otherwise, a deadlock will occur.
let children = self.graph.children(path); let children = self.graph.children(path);
@ -226,14 +223,14 @@ impl SharedPromises {
paths.push(path.clone()); paths.push(path.clone());
} }
for path in paths { for path in paths {
self.join(&path).unwrap(); let _result = self.join(&path);
} }
} }
pub fn join_all(&self) { pub fn join_all(&self) {
let paths = self.promises.borrow().keys().cloned().collect::<Vec<_>>(); let paths = self.promises.borrow().keys().cloned().collect::<Vec<_>>();
for path in paths { for path in paths {
self.join(&path).unwrap(); let _result = self.join(&path);
} }
} }