Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3d16533
fix parser regex unicode escapes
andrewtdiz Jun 3, 2026
9507789
Drop duplicate regex normalizer arm
andrewtdiz Jun 3, 2026
0abf46c
Guard cyclic inheritance walks in codegen
andrewtdiz Jun 3, 2026
01870b3
Fix export alias function symbol collisions
andrewtdiz Jun 3, 2026
4366108
Share imported class field seeds across modules
andrewtdiz Jun 3, 2026
2fb2aea
Disambiguate duplicate local function symbols
andrewtdiz Jun 3, 2026
3100e65
Separate static and instance method symbols
andrewtdiz Jun 3, 2026
0f9e04b
Reserve renamed value export symbols
andrewtdiz Jun 3, 2026
67fa596
Deduplicate exported value getter symbols
andrewtdiz Jun 3, 2026
5514a0d
Shorten generated object filenames
andrewtdiz Jun 3, 2026
0a03ceb
Pack mixed property push spreads
andrewtdiz Jun 3, 2026
5b5173b
Fix async generator catch route loop control
andrewtdiz Jun 3, 2026
c8b9b1c
Route large imported closure calls through spread helper
andrewtdiz Jun 3, 2026
a88dc4e
Merge branch 'main' into codex/fix-pointer-local-type-growth
andrewtdiz Jun 3, 2026
0df627b
Resolve dot namespace re-export targets
andrewtdiz Jun 4, 2026
2716349
Use namespace imports for CJS require of ESM
andrewtdiz Jun 4, 2026
2047e31
Append extensions for dotted import basenames
andrewtdiz Jun 4, 2026
f7204c7
Skip runtime JS edges for type-only named imports
andrewtdiz Jun 4, 2026
ffda496
Fix exported no-init var bindings
andrewtdiz Jun 4, 2026
b7afff5
Fix missing native link producers
andrewtdiz Jun 4, 2026
7327fec
Fix namespace materialization for OpenCode graph
andrewtdiz Jun 4, 2026
a0c1c6e
Fix export-all function forwarders
andrewtdiz Jun 4, 2026
8775fbe
Fix scoped namespace import aliases
andrewtdiz Jun 4, 2026
fa56551
Fix aliased import compatibility collisions
andrewtdiz Jun 4, 2026
6c63c31
Fix package exports array resolution
andrewtdiz Jun 4, 2026
a841a98
Fix renamed value export namespace getters
andrewtdiz Jun 4, 2026
5ca8ff2
Fix CJS class re-export method origins
andrewtdiz Jun 4, 2026
dff77f4
Fix canonical class origins for generic id collisions
andrewtdiz Jun 4, 2026
6a3e0c9
Avoid class origin lookup allocations
andrewtdiz Jun 4, 2026
6f49196
Fix duplicate native archive link symbols
andrewtdiz Jun 4, 2026
9cabee9
Fix CommonJS circular require exports cache
andrewtdiz Jun 4, 2026
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
211 changes: 207 additions & 4 deletions crates/perry-codegen/src/codegen/artifacts.rs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions crates/perry-codegen/src/codegen/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub(super) fn compile_closure(
strings: &mut StringPool,
classes: &HashMap<String, &perry_hir::Class>,
methods: &HashMap<(String, String), String>,
static_methods: &HashMap<(String, String), String>,
module_globals: &HashMap<u32, String>,
import_function_prefixes: &HashMap<String, String>,
enums: &HashMap<(String, String), perry_hir::EnumValue>,
Expand Down Expand Up @@ -259,6 +260,7 @@ pub(super) fn compile_closure(
new_target_stack,
class_stack,
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -297,6 +299,7 @@ pub(super) fn compile_closure(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down
13 changes: 7 additions & 6 deletions crates/perry-codegen/src/codegen/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub(super) fn compile_module_entry(
strings: &mut StringPool,
classes: &HashMap<String, &perry_hir::Class>,
methods: &HashMap<(String, String), String>,
static_methods: &HashMap<(String, String), String>,
module_globals: &HashMap<u32, String>,
import_function_prefixes: &HashMap<String, String>,
enums: &HashMap<(String, String), perry_hir::EnumValue>,
Expand Down Expand Up @@ -252,6 +253,7 @@ pub(super) fn compile_module_entry(
new_target_stack: Vec::new(),
class_stack: Vec::new(),
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -283,6 +285,7 @@ pub(super) fn compile_module_entry(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down Expand Up @@ -395,9 +398,7 @@ pub(super) fn compile_module_entry(
// is a target). The populator emits `js_create_namespace(0, ...)`
// → an empty NaN-boxed object → stored into `@__perry_ns_<prefix>`,
// satisfying the consumer-side extern reference.
if (!cross_module.namespace_entries.is_empty() || cross_module.is_dynamic_import_target)
&& !ctx.block().is_terminated()
{
if cross_module.needs_namespace_global(module_prefix) && !ctx.block().is_terminated() {
emit_namespace_populator(
&mut ctx,
&cross_module.namespace_entries,
Expand Down Expand Up @@ -674,6 +675,7 @@ pub(super) fn compile_module_entry(
new_target_stack: Vec::new(),
class_stack: Vec::new(),
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -705,6 +707,7 @@ pub(super) fn compile_module_entry(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down Expand Up @@ -811,9 +814,7 @@ pub(super) fn compile_module_entry(
// is a target). The populator emits `js_create_namespace(0, ...)`
// → an empty NaN-boxed object → stored into `@__perry_ns_<prefix>`,
// satisfying the consumer-side extern reference.
if (!cross_module.namespace_entries.is_empty() || cross_module.is_dynamic_import_target)
&& !ctx.block().is_terminated()
{
if cross_module.needs_namespace_global(module_prefix) && !ctx.block().is_terminated() {
emit_namespace_populator(
&mut ctx,
&cross_module.namespace_entries,
Expand Down
3 changes: 3 additions & 0 deletions crates/perry-codegen/src/codegen/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub(super) fn compile_function(
strings: &mut StringPool,
classes: &HashMap<String, &perry_hir::Class>,
methods: &HashMap<(String, String), String>,
static_methods: &HashMap<(String, String), String>,
module_globals: &HashMap<u32, String>,
module_global_types: &HashMap<u32, perry_types::Type>,
import_function_prefixes: &HashMap<String, String>,
Expand Down Expand Up @@ -168,6 +169,7 @@ pub(super) fn compile_function(
new_target_stack: Vec::new(),
class_stack: Vec::new(),
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -199,6 +201,7 @@ pub(super) fn compile_function(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down
11 changes: 10 additions & 1 deletion crates/perry-codegen/src/codegen/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ pub(super) fn init_static_fields_late(
{
continue;
}
if let Some(llvm_name) = ctx.methods.get(&key).cloned() {
if let Some(llvm_name) = ctx.static_methods.get(&key).cloned() {
ctx.block().call(DOUBLE, &llvm_name, &[]);
}
}
Expand Down Expand Up @@ -803,6 +803,15 @@ pub(super) fn emit_namespace_populator(
NamespaceEntryKind::NestedNamespace { source_prefix } => ctx
.block()
.load(DOUBLE, &format!("@__perry_ns_{}", source_prefix)),
NamespaceEntryKind::NativeModuleNamespace { module_name } => {
let mod_label = crate::expr::emit_string_literal_global(ctx, module_name);
let mod_len = module_name.len().to_string();
ctx.block().call(
DOUBLE,
"js_create_native_module_namespace",
&[(PTR, &mod_label), (I64, &mod_len)],
)
}
};

let blk = ctx.block();
Expand Down
6 changes: 6 additions & 0 deletions crates/perry-codegen/src/codegen/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub(super) fn compile_method(
strings: &mut StringPool,
classes: &HashMap<String, &perry_hir::Class>,
methods: &HashMap<(String, String), String>,
static_methods: &HashMap<(String, String), String>,
module_globals: &HashMap<u32, String>,
module_global_types: &HashMap<u32, perry_types::Type>,
import_function_prefixes: &HashMap<String, String>,
Expand Down Expand Up @@ -155,6 +156,7 @@ pub(super) fn compile_method(
new_target_stack: Vec::new(),
class_stack: vec![class.name.clone()],
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -186,6 +188,7 @@ pub(super) fn compile_method(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down Expand Up @@ -547,6 +550,7 @@ pub(super) fn compile_static_method(
strings: &mut StringPool,
classes: &HashMap<String, &perry_hir::Class>,
methods: &HashMap<(String, String), String>,
static_methods: &HashMap<(String, String), String>,
module_globals: &HashMap<u32, String>,
import_function_prefixes: &HashMap<String, String>,
enums: &HashMap<(String, String), perry_hir::EnumValue>,
Expand Down Expand Up @@ -639,6 +643,7 @@ pub(super) fn compile_static_method(
// `this`). The class_stack is empty here.
class_stack: Vec::new(),
methods,
static_methods,
module_globals,
import_function_prefixes,
import_function_origin_names: &cross_module.import_function_origin_names,
Expand Down Expand Up @@ -670,6 +675,7 @@ pub(super) fn compile_static_method(
namespace_imports: &cross_module.namespace_imports,
namespace_reexport_named_imports: &cross_module.namespace_reexport_named_imports,
namespace_member_prefixes: &cross_module.namespace_member_prefixes,
namespace_member_origin_names: &cross_module.namespace_member_origin_names,
imported_async_funcs: &cross_module.imported_async_funcs,
local_async_funcs: &cross_module.local_async_funcs,
local_generator_funcs: &cross_module.local_generator_funcs,
Expand Down
Loading