aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun_queue.zig8
-rw-r--r--src/resolver/resolver.zig11
2 files changed, 10 insertions, 9 deletions
diff --git a/src/bun_queue.zig b/src/bun_queue.zig
index 4c289d511..e602adc6d 100644
--- a/src/bun_queue.zig
+++ b/src/bun_queue.zig
@@ -1,6 +1,5 @@
const std = @import("std");
const Mutex = @import("./lock.zig").Mutex;
-const Channel = @import("./sync.zig").Channel;
const WaitGroup = @import("./sync.zig").WaitGroup;
usingnamespace @import("./global.zig");
const Wyhash = std.hash.Wyhash;
@@ -145,8 +144,6 @@ pub fn NewBunQueue(comptime Value: type) type {
const KeyType = u32;
const BunQueue = @This();
const Queue = NewBlockQueue(Value, 64, 48);
- // pub const Fifo = NewFifo(Value);
-
allocator: *std.mem.Allocator,
queue: Queue,
keys: Keys,
@@ -170,14 +167,12 @@ pub fn NewBunQueue(comptime Value: type) type {
pub const Keys = struct {
pub const OverflowList = std.ArrayList([*]KeyType);
- // Half a page of memory
blocks: [overflow_size][*]KeyType = undefined,
offset: AtomicOffset,
block_overflow: OverflowList,
block_overflow_lock: bool = false,
first_key_list: [block_size]KeyType = undefined,
- mutex: Mutex = Mutex{},
write_lock: bool = false,
append_readers: u8 = 0,
append_lock: bool = false,
@@ -195,7 +190,9 @@ pub fn NewBunQueue(comptime Value: type) type {
}
};
+ // Half a page of memory
pub const block_size = 2048 / @sizeOf(KeyType);
+ // 32 is arbitrary
pub const overflow_size = 32;
// In one atomic load/store, get the length and offset of the keys
@@ -228,7 +225,6 @@ pub fn NewBunQueue(comptime Value: type) type {
inline fn contains(this: *BunQueue, key: KeyType) bool {
@fence(.Acquire);
if (@atomicLoad(KeyType, &this.keys.pending_write, .SeqCst) == key) return true;
- // this.keys.mutex.tryAcquire()
var offset = this.getOffset();
std.debug.assert(&this.keys.first_key_list == this.keys.blocks[0]);
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 46a849dc9..c6daad16e 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -914,14 +914,19 @@ pub fn NewResolver(cache_files: bool) type {
// ^------------^
var end = strings.lastIndexOf(absolute, node_module_root_string) orelse return null;
end += node_module_root_string.len;
+
+ const is_scoped_package = absolute[end] == '@';
end += strings.indexOfChar(absolute[end..], std.fs.path.sep) orelse return null;
- end += 1;
+
// /foo/node_modules/@babel/standalone/index.js
// ^
- if (absolute[end] == '@') {
- end += strings.indexOfChar(absolute[end..], std.fs.path.sep) orelse return null;
+ if (is_scoped_package) {
end += 1;
+ end += strings.indexOfChar(absolute[end..], std.fs.path.sep) orelse return null;
}
+
+ end += 1;
+
// /foo/node_modules/@babel/standalone/index.js
// ^
const slice = absolute[0..end];