Skip to content
Merged
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
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ members = [
"crates/perry-ext-events",
"crates/perry-ext-decimal",
"crates/perry-ext-dayjs",
"crates/perry-ext-qs",
"crates/perry-ext-moment",
"crates/perry-ext-cheerio",
"crates/perry-ext-sharp",
Expand Down Expand Up @@ -491,6 +492,7 @@ perry-ext-axios = { path = "crates/perry-ext-axios" }
perry-ext-events = { path = "crates/perry-ext-events" }
perry-ext-decimal = { path = "crates/perry-ext-decimal" }
perry-ext-dayjs = { path = "crates/perry-ext-dayjs" }
perry-ext-qs = { path = "crates/perry-ext-qs" }
perry-ext-moment = { path = "crates/perry-ext-moment" }
perry-ext-cheerio = { path = "crates/perry-ext-cheerio" }
perry-ext-sharp = { path = "crates/perry-ext-sharp" }
Expand Down
1 change: 1 addition & 0 deletions changelog.d/8751-native-qs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**Native `qs` compatibility:** bundle nested query-string parsing and serialization so Stripe request encoding no longer compiles the AOT-hostile `get-intrinsic` dependency chain.
1 change: 1 addition & 0 deletions changelog.d/8813-map-ordered-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ordered `Map.delete` now compacts surviving entries with one overlap-safe move and repairs numeric, string, and pointer side-index offsets in place instead of barrier-storing and rehashing every survivor. Insertion order, SameValueZero lookup, delete-then-readd ordering, moving-GC pointer-index rebuilds, and old-to-young external-slot tracking are preserved.
4 changes: 4 additions & 0 deletions changelog.d/8816-runtime-library-build-stamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fixed stale or mismatched `libperry_runtime` archives passing `perry doctor` and
then failing during native linking with undefined runtime symbols. Runtime
archives now carry a compiler build identity that `perry doctor` and compile
pipelines verify before linking, with actionable rebuild and reinstall guidance.
6 changes: 6 additions & 0 deletions changelog.d/8817-compiled-package-builtin-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Added regression coverage for Node builtin named imports used from natively
compiled dependencies. The exact `@hono/node-server` fallback from
`options.createServer` to its module-scope `http.createServer` import now has an
offline compiler fixture and a real-package listen/fetch/close release smoke,
covering both `http` and `node:http` spellings without relying on app-level
imports.
1 change: 1 addition & 0 deletions changelog.d/8818-sharp-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix(sharp): support object-form `create` inputs with solid RGB or RGBA backgrounds, so `sharp({ create: ... })` can encode images instead of failing with an invalid handle.
1 change: 1 addition & 0 deletions changelog.d/8820-call-return-array-stores.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Array index assignments whose base is a call expression now preserve the call's statically known Array type and use the typed array-store path while evaluating the base exactly once. Strict writes through that path also honor non-writable and accessor descriptors, read-only length, and non-extensible holes.
1 change: 1 addition & 0 deletions crates/perry-api-manifest/src/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub const NATIVE_MODULES: &[&str] = &[
"mysql2/promise", // mysql2's promise-API subpath
"pg", // PostgreSQL client
"uuid", // RFC-4122 UUID generation
"qs", // nested query-string parser/stringifier (Stripe dependency)
"bcrypt", // bcrypt password hashing (replaces the N-API addon)
"argon2", // Argon2 password hashing (replaces the N-API addon)
"ioredis", // Redis/Valkey client
Expand Down
19 changes: 19 additions & 0 deletions crates/perry-api-manifest/src/entries/part_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,4 +1114,23 @@ pub(crate) const API_MANIFEST_PART_4: &[ApiEntry] = &[
property("bun", "stdin"),
property("bun", "stdout"),
property("bun", "stderr"),
// --- qs (issue #8751) ---
// Native nested query-string codec. This keeps Stripe's request encoder
// off qs' legacy get-intrinsic/ES-shims dependency chain.
method_sig(
"qs",
"stringify",
false,
None,
&[p_any("value"), p_any("options")],
TypeSpec::String,
),
method_sig(
"qs",
"parse",
false,
None,
&[p_str("input"), p_any("options")],
TypeSpec::Any,
),
];
175 changes: 175 additions & 0 deletions crates/perry-codegen/src/expr/call_return_array_index_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
use crate::{compile_module, CompileOptions};
use perry_hir::types::Type;
use perry_hir::{Class, Expr, Function, Module, Param, Stmt};

fn param(id: u32, name: &str, ty: Type) -> Param {
Param {
id,
name: name.to_string(),
ty,
default: None,
decorators: Vec::new(),
is_rest: false,
arguments_object: None,
}
}

fn function(
id: u32,
name: &str,
params: Vec<Param>,
return_type: Type,
body: Vec<Stmt>,
) -> Function {
Function {
id,
name: name.to_string(),
type_params: Vec::new(),
params,
return_type,
body,
is_async: false,
is_generator: false,
is_strict: true,
is_exported: false,
captures: Vec::new(),
decorators: Vec::new(),
was_plain_async: false,
was_unrolled: false,
}
}

fn call_get_data(selector: i64) -> Expr {
Expr::Call {
callee: Box::new(Expr::PropertyGet {
object: Box::new(Expr::This),
property: "getData".to_string(),
byte_offset: 0,
}),
args: vec![Expr::Integer(selector)],
type_args: Vec::new(),
byte_offset: 0,
}
}

fn store_class(receiver_selector: i64) -> Class {
let get_data = function(
2,
"getData",
vec![param(3, "selector", Type::Number)],
Type::Array(Box::new(Type::Any)),
vec![Stmt::Return(Some(Expr::Array(vec![Expr::Number(0.0)])))],
);
let write = function(
3,
"write",
vec![
param(1, "index", Type::Number),
param(2, "value", Type::Any),
],
Type::Void,
vec![Stmt::Expr(Expr::PutValueSet {
target: Box::new(call_get_data(0)),
key: Box::new(Expr::LocalGet(1)),
value: Box::new(Expr::LocalGet(2)),
receiver: Box::new(call_get_data(receiver_selector)),
strict: true,
})],
);
Class {
id: 1,
name: "Store".to_string(),
type_params: Vec::new(),
extends: None,
extends_name: None,
native_extends: None,
extends_expr: None,
heritage_lexically_shadowed: false,
fields: Vec::new(),
constructor: None,
methods: vec![get_data, write],
getters: Vec::new(),
setters: Vec::new(),
static_accessor_names: Vec::new(),
static_accessor_fn_ids: Vec::new(),
computed_members: Vec::new(),
static_fields: Vec::new(),
static_methods: Vec::new(),
decorators: Vec::new(),
is_exported: false,
aliases: Vec::new(),
is_nested: false,
alloc_width_hint: 0,
specialized_from: None,
}
}

fn compile_store_ir(receiver_selector: i64) -> String {
let mut module = Module::new("call_return_array_put_value.ts");
module.classes.push(store_class(receiver_selector));
let bytes = compile_module(
&module,
CompileOptions {
emit_ir_only: true,
..Default::default()
},
)
.expect("call-returned array store compiles");
String::from_utf8(bytes).expect("LLVM IR is UTF-8")
}

fn write_method_ir(ir: &str) -> &str {
let signature = "define double @perry_method_call_return_array_put_value_ts__Store__write(";
let start = ir.find(signature).expect("write method is present in IR");
let method_and_rest = &ir[start..];
let end = method_and_rest
.find("\n}\n")
.expect("write method has a closing brace");
&method_and_rest[..end + 3]
}

#[test]
fn same_call_returned_array_uses_array_index_store_and_evaluates_receiver_once() {
let ir = compile_store_ir(0);
let write_ir = write_method_ir(&ir);

assert!(
write_ir.contains("call i64 @js_typed_feedback_array_set_index_or_string("),
"a call with an Array return type must use the array-index semantic fallback:\n{write_ir}"
);
assert!(
!write_ir.contains("call double @js_put_value_set_dyn_ic("),
"the proven array receiver must not enter the generic Proxy-compatible PutValue ladder:\n{write_ir}"
);
assert_eq!(
write_ir
.matches(
"call double @perry_method_call_return_array_put_value_ts__Store__getData("
)
.count(),
1,
"the syntactically duplicated target/receiver call represents one evaluated assignment base"
);
}

#[test]
fn distinct_call_receiver_stays_on_explicit_receiver_put_value_path() {
let ir = compile_store_ir(1);
let write_ir = write_method_ir(&ir);

assert!(
!write_ir.contains("call i64 @js_typed_feedback_array_set_index_or_string("),
"a receiver that differs from the target must not use same-receiver array lowering:\n{write_ir}"
);
assert!(
write_ir.contains("call double @js_put_value_set("),
"the distinct receiver must be passed to the generic PutValue helper:\n{write_ir}"
);
assert_eq!(
write_ir
.matches("call double @perry_method_call_return_array_put_value_ts__Store__getData(")
.count(),
2,
"target and distinct receiver calls are independently evaluated"
);
}
2 changes: 2 additions & 0 deletions crates/perry-codegen/src/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ mod write_pic_barrier_tests;
// temp alloca through the same shadow-slot emission every named local uses,
// and it now lives outside `crate::expr`.
#[cfg(test)]
mod call_return_array_index_tests;
#[cfg(test)]
mod call_spread_rooting_tests;
mod call_spread_short;
#[cfg(test)]
Expand Down
10 changes: 9 additions & 1 deletion crates/perry-codegen/src/expr/proxy_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,15 @@ fn is_numeric_string_key(key: &str) -> bool {
}

fn put_value_index_fast_path(ctx: &FnCtx<'_>, target: &Expr, key: &Expr, receiver: &Expr) -> bool {
if !same_side_effect_free_receiver(target, receiver) {
// `PutValueSet` stores the assignment base in both `target` and `receiver`;
// those two HIR trees describe one source evaluation, not two evaluations
// that may be coalesced only when pure. Use the same structural-identity
// check as the generic same-receiver PutValue lowering below so expressions
// such as `this.getData()[index] = value` can retain the statically known
// Array type. `IndexSet::lower` evaluates that base once. A genuinely
// distinct receiver (including a call with different arguments) still
// fails closed to the explicit-receiver runtime path.
if !same_put_value_receiver_expr(target, receiver) {
return false;
}
if is_array_expr(ctx, target) {
Expand Down
Loading
Loading