Skip to content
Open
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
123 changes: 29 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ tree-sitter-ruby = "0.23.0"
tree-sitter-php = "0.24.2"
tree-sitter-dart = "0.0.4"

# Extended language support
tree-sitter-scala = "0.25"
# tree-sitter-svelte = "0.10" # Windows build fails, disabled temporarily

# GraphQL
async-graphql = "7.0"
async-graphql-axum = "7.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/codegraph-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ clap = { workspace = true }
colored = { workspace = true }
indicatif = { workspace = true }
once_cell = { workspace = true }
tikv-jemallocator = { workspace = true }
hashbrown = { workspace = true }
rustc-hash = { workspace = true }
sha2 = { workspace = true }
Expand All @@ -54,6 +53,7 @@ rkyv = { workspace = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2"
tikv-jemallocator = { workspace = true }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = [
Expand Down
4 changes: 2 additions & 2 deletions crates/codegraph-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub use types::*;
pub use versioning::*;
pub use watch::*;

// Use jemalloc as the global allocator when the feature is enabled
#[cfg(feature = "jemalloc")]
// Jemalloc is only available in this crate on Unix targets.
#[cfg(all(feature = "jemalloc", unix))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
8 changes: 4 additions & 4 deletions crates/codegraph-core/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ fn prefetch_range_impl(m: &MappedFile, offset: usize, len: usize) {

#[cfg(windows)]
fn prefetch_range_impl(m: &MappedFile, offset: usize, len: usize) {
use core::mem::size_of;
use windows_sys::Win32::System::Memory::{PrefetchVirtualMemory, _WIN32_MEMORY_RANGE_ENTRY};
use std::ptr::null_mut;
use windows_sys::Win32::System::Memory::{PrefetchVirtualMemory, WIN32_MEMORY_RANGE_ENTRY};

let end = offset.saturating_add(len).min(m.len);
if end <= offset {
Expand All @@ -180,13 +180,13 @@ fn prefetch_range_impl(m: &MappedFile, offset: usize, len: usize) {
let ptr = unsafe { m.mmap.as_ptr().add(offset) } as *mut core::ffi::c_void;
let bytes = end - offset;

let mut range = _WIN32_MEMORY_RANGE_ENTRY {
let mut range = WIN32_MEMORY_RANGE_ENTRY {
VirtualAddress: ptr,
NumberOfBytes: bytes,
};
unsafe {
// Best-effort; ignore failure.
let _ = PrefetchVirtualMemory(0, 1, &mut range as *mut _ as *mut _, 0);
let _ = PrefetchVirtualMemory(null_mut(), 1, &mut range as *mut _, 0);
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/codegraph-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub enum Language {
Ruby,
Php,
Dart,
Scala,
Svelte,
Other(String),
}

Expand Down
Loading