Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 0 additions & 22 deletions src/bun_core/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,15 +754,6 @@ impl String {
bytes.len() == lit.len() && strings::eql_comptime_ignore_len(bytes, lit)
}

/// `bun.String.githubAction` — returns a `Display`
/// formatter that escapes the string for GitHub Actions annotation output
/// (`%0A` for newlines, ANSI stripped). Encoding-aware: materialises a
/// UTF-8 view inside `fmt` so 16-bit / WTF-backed strings are handled.
#[inline]
pub fn github_action(&self) -> StringGithubActionFormatter<'_> {
StringGithubActionFormatter { text: self }
}

/// `bun.String.hasPrefixComptime` — ASCII prefix check. Dispatches on
/// encoding so only `prefix.len()` units are touched; never scans or
/// transcodes `self`.
Expand Down Expand Up @@ -1266,19 +1257,6 @@ impl core::fmt::Display for String {
}
}

/// `Display` adapter for [`String::github_action`]. Converts to UTF-8 on the
/// fly (handles 16-bit / WTF-backed strings) and delegates to
/// `crate::fmt::github_action_writer`.
pub struct StringGithubActionFormatter<'a> {
text: &'a String,
}
impl core::fmt::Display for StringGithubActionFormatter<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let utf8 = self.text.to_utf8_without_ref();
crate::fmt::github_action_writer(f, utf8.slice())
}
}

/// `Display` adapter for [`ZigString::github_action`]. Converts to UTF-8 on
/// the fly (handles 16-bit / latin-1 encodings) and delegates to
/// `crate::fmt::github_action_writer`.
Expand Down
10 changes: 1 addition & 9 deletions src/install/PackageManager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ pub use enqueue::{
};

use self::package_manager_lifecycle as lifecycle;
pub use lifecycle::{
LifecycleScriptTimeLog, LifecycleScriptTimeLogEntry, determine_preinstall_state,
get_preinstall_state, set_preinstall_state,
};
pub use lifecycle::{determine_preinstall_state, get_preinstall_state, set_preinstall_state};

use self::package_manager_resolution as resolution;
pub use resolution::{assign_root_resolution, resolve_from_disk_cache};
Expand Down Expand Up @@ -349,9 +346,6 @@ pub struct PackageManager {
pub(crate) preallocated_network_tasks: PreallocatedNetworkTasks,
pub(crate) preallocated_resolve_tasks: PreallocatedTaskStore,

/// items are only inserted into this if they took more than 500ms
pub(crate) lifecycle_script_time_log: LifecycleScriptTimeLog,

pub pending_lifecycle_script_tasks: AtomicU32,
pub(crate) finished_installing: AtomicBool,
pub(crate) total_scripts: usize,
Expand Down Expand Up @@ -1924,7 +1918,6 @@ pub fn init(
wr!(pending_pre_calc_hashes, AtomicU32::new(0));
wr!(pending_tasks, AtomicU32::new(0));
wr!(total_tasks, 0);
wr!(lifecycle_script_time_log, LifecycleScriptTimeLog::default());
wr!(pending_lifecycle_script_tasks, AtomicU32::new(0));
wr!(finished_installing, AtomicBool::new(false));
wr!(total_scripts, 0);
Expand Down Expand Up @@ -2357,7 +2350,6 @@ fn init_with_runtime_once(
wr!(pending_pre_calc_hashes, AtomicU32::new(0));
wr!(pending_tasks, AtomicU32::new(0));
wr!(total_tasks, 0);
wr!(lifecycle_script_time_log, LifecycleScriptTimeLog::default());
wr!(pending_lifecycle_script_tasks, AtomicU32::new(0));
wr!(finished_installing, AtomicBool::new(false));
wr!(total_scripts, 0);
Expand Down
17 changes: 0 additions & 17 deletions src/install/PackageManager/PackageManagerLifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use bun_paths::resolve_path::{join_abs_string_z, platform};
use bun_paths::{AutoAbsPath, EnvPath};
use bun_semver::string::Builder as SemverStringBuilder;
use bun_sys as Syscall;
use bun_threading::Mutex;

use crate::bun_fs::FileSystem;

Expand All @@ -28,22 +27,6 @@ use bun_install::{
PackageID, PackageManager, PreinstallState, TruncatedPackageNameHash, invalid_package_id,
};

#[derive(Default)]
pub struct LifecycleScriptTimeLog {
mutex: Mutex,
list: Vec<LifecycleScriptTimeLogEntry>,
}

pub struct LifecycleScriptTimeLogEntry {}

impl LifecycleScriptTimeLog {
pub(crate) fn append_concurrent(&mut self, entry: LifecycleScriptTimeLogEntry) {
self.mutex.lock();
self.list.push(entry);
self.mutex.unlock();
}
}

impl PackageManager {
pub(crate) fn ensure_preinstall_state_list_capacity(&mut self, count: usize) {
if self.preinstall_state.len() >= count {
Expand Down
30 changes: 0 additions & 30 deletions src/install/lifecycle_script_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::isolated_install::store::{EntryColumns, entry};
use crate::lockfile_real::Scripts as LockfileScripts;
use crate::lockfile_real::package::scripts::List as ScriptsList;
use crate::package_manager_real::ProgressStrings;
use crate::package_manager_real::package_manager_lifecycle::LifecycleScriptTimeLogEntry;
use bun_core::{Global, Output};
use bun_io::BufferedReader;
use bun_io::heap as io_heap;
Expand Down Expand Up @@ -273,8 +272,6 @@ pub struct LifecycleScriptSubprocess<'a> {
pub(crate) envp: bun_dotenv::NullDelimitedEnvMap,
pub(crate) shell_bin: Option<&'a ZStr>,

pub(crate) timer: Option<Timer>,

pub(crate) has_incremented_alive_count: bool,

pub(crate) foreground: bool,
Expand Down Expand Up @@ -337,8 +334,6 @@ impl<'a> io_heap::HeapContext<LifecycleScriptSubprocess<'a>> for StartedAtCtx {
}
}

const MIN_MILLISECONDS_TO_LOG: u64 = 500;

static ALIVE_COUNT: AtomicUsize = AtomicUsize::new(0);

impl<'a> LifecycleScriptSubprocess<'a> {
Expand All @@ -356,8 +351,6 @@ use bun_sys::windows::libuv as uv;

pub type OutputReader = BufferedReader;

pub(crate) type Timer = bun_core::time::Timer;

impl<'a> LifecycleScriptSubprocess<'a> {
/// Heap-allocate and return a raw pointer; this type is intrusive (heap field,
/// OutputReader parent backrefs), so it lives behind `*mut Self`.
Expand All @@ -372,16 +365,6 @@ impl<'a> LifecycleScriptSubprocess<'a> {
self.manager.get()
}

/// # Safety
/// See [`Self::manager`]. Mutable access is sound because callers run on
/// the single install thread and no `&PackageManager`
/// outlives the brief field accesses below.
#[inline]
unsafe fn manager_mut(&mut self) -> &mut PackageManager {
// SAFETY: see fn doc.
unsafe { self.manager.get_mut() }
}

pub(crate) fn script_name(&self) -> &'static [u8] {
debug_assert!((self.current_script_index as usize) < LockfileScripts::NAMES.len());
LockfileScripts::NAMES[self.current_script_index as usize].as_bytes()
Expand Down Expand Up @@ -866,8 +849,6 @@ impl<'a> LifecycleScriptSubprocess<'a> {

match status {
Status::Exited(exit) => {
let maybe_duration = self.timer.as_mut().map(|t| t.read());

if exit.code > 0 {
if self.optional {
if let Some(ctx) = &self.ctx {
Expand Down Expand Up @@ -909,16 +890,6 @@ impl<'a> LifecycleScriptSubprocess<'a> {
}
}

if let Some(nanos) = maybe_duration {
if nanos > MIN_MILLISECONDS_TO_LOG * bun_core::time::NS_PER_MS {
let entry = LifecycleScriptTimeLogEntry {};
// SAFETY: see [`Self::manager_mut`].
unsafe { self.manager_mut() }
.lifecycle_script_time_log
.append_concurrent(entry);
}
}

if let Some(ctx) = &self.ctx {
match self.current_script_index {
// preinstall
Expand Down Expand Up @@ -1145,7 +1116,6 @@ impl<'a> LifecycleScriptSubprocess<'a> {
stdout: OutputReader::init::<Self>(),
stderr: OutputReader::init::<Self>(),
has_called_process_exit: false,
timer: None,
has_incremented_alive_count: false,
started_at: 0,
heap: io_heap::IntrusiveField::default(),
Expand Down
7 changes: 0 additions & 7 deletions src/jsc/Errorable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ impl<T: Copy> Errorable<T> {
}
}

pub fn value(val: T) -> Self {
Self {
result: Result { value: val },
success: true,
}
}

pub fn ok(val: T) -> Self {
Self {
result: Result { value: val },
Expand Down
13 changes: 0 additions & 13 deletions src/jsc/JSUint8Array.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::ffi::c_void;

use crate::sizes;
use crate::{JSGlobalObject, JSValue};

bun_opaque::opaque_ffi! {
Expand All @@ -9,18 +8,6 @@ bun_opaque::opaque_ffi! {
}

impl JSUint8Array {
pub fn ptr(&self) -> *mut u8 {
// SAFETY: `self` points at a live JSUint8Array cell; the typed-array vector
// pointer lives at a fixed byte offset computed by the C++ codegen
// (`crate::sizes`). `byte_add` preserves pointer provenance.
unsafe {
std::ptr::from_ref::<Self>(self)
.byte_add(sizes::BUN_FFI_POINTER_OFFSET_TO_TYPED_ARRAY_VECTOR)
.cast::<*mut u8>()
.read()
}
}

/// `bytes` must come from `bun.default_allocator` (the global mimalloc allocator);
/// ownership is transferred to the returned JS Uint8Array.
// The global allocator IS mimalloc, so `Box<[u8]>` encodes that ownership.
Expand Down
9 changes: 0 additions & 9 deletions src/jsc/RefString.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
use core::ffi::c_void;
use core::ptr::NonNull;

use bun_jsc::{JSGlobalObject, JSValue, JsResult};
// `bun_core::WTFStringImpl` is the *pointer* type (= `*mut WTFStringImplStruct`).
use bun_core::WTFStringImpl;
use bun_jsc::StringJsc as _; // extension trait providing `.to_js()` on `bun_core::String`

pub(crate) type Hash = u32;

Expand All @@ -36,13 +34,6 @@ pub struct RefString {
}

impl RefString {
pub fn to_js(&self, global: &JSGlobalObject) -> JsResult<JSValue> {
// Wrap the raw
// `WTFStringImpl` pointer without bumping the refcount (`String` has
// no `Drop`, so this is adopt-then-forget).
bun_core::String::adopt_wtf_impl(self.impl_).to_js(global)
}

pub(crate) fn compute_hash(input: &[u8]) -> u32 {
bun_hash::XxHash32::hash(0, input)
}
Expand Down
5 changes: 0 additions & 5 deletions src/jsc/bindings/BunClientData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ void JSVMClientData::JSHeapDataDeleter::operator()(JSHeapData* heapData) const

JSVMClientData::~JSVMClientData()
{
m_clients.forEach([](auto& client) {
client.willDestroyVM();
});
m_clients.clear();

m_normalWorld = nullptr;
}
void JSVMClientData::create(VM* vm, void* bunVM)
Expand Down
4 changes: 0 additions & 4 deletions src/jsc/bindings/BunClientData.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
// #include "WorkerThreadType.h"
#include <wtf/Function.h>
#include <wtf/HashSet.h>
#include <wtf/WeakHashSet.h>

Check warning on line 22 in src/jsc/bindings/BunClientData.h

View check run for this annotation

Claude / Claude Code Review

Now-dead #include <wtf/WeakHashSet.h> left in BunClientData.h

Now that `WeakHashSet<JSVMClientDataClient> m_clients` is gone, `#include <wtf/WeakHashSet.h>` on this line is the only remaining reference to `WeakHashSet` in the file — it can be dropped alongside the field per the same "delete dead code in the PR that makes it dead" rule this diff is applying elsewhere.
Comment thread
robobun marked this conversation as resolved.
Outdated
#include <wtf/RefPtr.h>
#include "JSVMClientDataClient.h"
#include <JavaScriptCore/WeakInlines.h>
#include <wtf/StdLibExtras.h>
#include "JSCTaskScheduler.h"
Expand Down Expand Up @@ -151,8 +150,6 @@
// after every swap.
WTF::UncheckedKeyHashMap<WTF::String, RefPtr<JSC::SourceProvider>> isolationSourceProviderCache;

void addClient(JSVMClientDataClient& client) { m_clients.add(client); }

private:
bool isWebCoreJSClientData() const final { return true; }

Expand Down Expand Up @@ -185,7 +182,6 @@
Vector<JSC::IsoSubspace*> m_outputConstraintSpaces;

WebCore::HTTPHeaderIdentifiers m_httpHeaderIdentifiers;
WeakHashSet<JSVMClientDataClient> m_clients;
};

} // namespace WebCore
Expand Down
8 changes: 0 additions & 8 deletions src/jsc/bindings/JSDOMWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ inline constexpr uint8_t JSDOMWrapperType = 0b11101110;
inline constexpr uint8_t JSEventType = 0b11101111;
inline constexpr uint8_t JSNodeType = 0b11110000;
inline constexpr uint8_t JSNodeTypeMask = 0b00001111;
inline constexpr uint8_t JSTextNodeType = JSNodeType | NodeConstants::TEXT_NODE;
inline constexpr uint8_t JSProcessingInstructionNodeType = JSNodeType | NodeConstants::PROCESSING_INSTRUCTION_NODE;
inline constexpr uint8_t JSDocumentTypeNodeType = JSNodeType | NodeConstants::DOCUMENT_TYPE_NODE;
inline constexpr uint8_t JSDocumentFragmentNodeType = JSNodeType | NodeConstants::DOCUMENT_FRAGMENT_NODE;
inline constexpr uint8_t JSDocumentWrapperType = JSNodeType | NodeConstants::DOCUMENT_NODE;
inline constexpr uint8_t JSCommentNodeType = JSNodeType | NodeConstants::COMMENT_NODE;
inline constexpr uint8_t JSCDATASectionNodeType = JSNodeType | NodeConstants::CDATA_SECTION_NODE;
inline constexpr uint8_t JSAttrNodeType = JSNodeType | NodeConstants::ATTRIBUTE_NODE;
inline constexpr uint8_t JSElementType = 0b11110000 | NodeConstants::ELEMENT_NODE;
inline constexpr uint8_t JSAsJSONType = JSElementType;

Expand Down
13 changes: 0 additions & 13 deletions src/jsc/bindings/JSVMClientDataClient.h

This file was deleted.

42 changes: 0 additions & 42 deletions src/jsc/bindings/ares_build.h

This file was deleted.

Loading
Loading