summaryrefslogtreecommitdiff
path: root/oryxc/src/compiler.rs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2026-03-15 23:07:01 +0100
committerThomas Voss <mail@thomasvoss.com> 2026-03-15 23:07:25 +0100
commitbb4d0a8b49aed021fe8f13893d2e651923368c23 (patch)
treec80e4c63581cac95f5998daa11b8e477c1f07a28 /oryxc/src/compiler.rs
parent72b874a081fed4788378e16b0bfb3a0ed7e5725f (diff)
New DepMap type
Diffstat (limited to 'oryxc/src/compiler.rs')
-rw-r--r--oryxc/src/compiler.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/oryxc/src/compiler.rs b/oryxc/src/compiler.rs
index 1c1240e..123475e 100644
--- a/oryxc/src/compiler.rs
+++ b/oryxc/src/compiler.rs
@@ -27,13 +27,13 @@ use crossbeam_deque::{
Stealer,
Worker,
};
-use dashmap::DashMap;
use soa_rs::Soa;
use crate::arena::{
GlobalArena,
LocalArena,
};
+use crate::depmap::DepMap;
use crate::errors::OryxError;
use crate::hashtrie::HTrie;
use crate::intern::Interner;
@@ -85,6 +85,7 @@ impl FileData {
}
#[allow(dead_code)]
+#[derive(Clone)]
pub enum JobType {
Lex {
file: FileId,
@@ -107,6 +108,8 @@ pub enum JobType {
}
mkidtype!(JobId);
+
+#[derive(Clone)]
pub struct Job {
id: JobId,
kind: JobType,
@@ -125,7 +128,7 @@ struct CompilerState<'a> {
* order to avoid any potential undefined behaviour. */
interner: Interner<UniStr<'a>, SymbolId>,
files: Vec<Arc<FileData>>,
- deps: DashMap<usize, boxcar::Vec<Job>>,
+ deps: DepMap,
next_id: AtomicU32,
types: boxcar::Vec<OryxType>,
}
@@ -168,15 +171,6 @@ impl<'a> CompilerState<'a> {
fn job_complete(&self) -> usize {
return self.njobs.fetch_sub(1, Ordering::Release) - 1;
}
-
- /// Push all jobs that depend on JOB to QUEUE, clearing the dep list.
- fn job_push_deps(&self, job: JobId, queue: &Worker<Job>) {
- if let Some((_, deps)) = self.deps.remove(&(job.0 as usize)) {
- for x in deps {
- self.job_push(&queue, x);
- }
- }
- }
}
/// Initialize compiler state and drive all source files through the
@@ -214,7 +208,7 @@ where
flags,
worker_threads: OnceLock::new(),
interner: Interner::new(),
- deps: DashMap::new(),
+ deps: DepMap::with_capacity(256),
next_id: AtomicU32::new(njobs as u32),
/* Temporary solution */
types: boxcar::vec![
@@ -451,7 +445,6 @@ fn worker_loop(
ok = false;
}
- c_state.job_push_deps(job.id, &queue);
if c_state.job_complete() == 0 {
c_state.wake_all();
return ok;