Skip to content

Old pony 4915#103

Merged
IgorDeepakM merged 6 commits intomasterfrom
old_pony_4915
Mar 5, 2026
Merged

Old pony 4915#103
IgorDeepakM merged 6 commits intomasterfrom
old_pony_4915

Conversation

@IgorDeepakM
Copy link
Owner

No description provided.

SeanTAllen and others added 6 commits March 4, 2026 21:47
The root CMakeLists.txt sets config-specific output directories with
PONY_OUTPUT_SUFFIX (e.g., release-pool_memalign), but the tool
CMakeLists.txt files only check the generic CMAKE_RUNTIME_OUTPUT_DIRECTORY
— which was never set — and fall back to the unsuffixed path. This puts
tools in build/release/ while ponyc goes to build/release-pool_memalign/,
causing `make install` to fail with "cannot stat" errors.

Set CMAKE_RUNTIME_OUTPUT_DIRECTORY in the root CMakeLists.txt so the
existing guards in tool CMakeLists.txt files pick up the correct suffixed
path. Also add if-guards to the Makefile install target for tool copies
and symlinks, matching the pattern already used for optional libraries.

Closes #4907
The --checktree AST validation used mutual recursion
(check_from_list -> rule -> check_children -> check_from_list) with
depth proportional to AST nesting. json-ng's deeply nested expression
trees overflow the 1MB Windows default stack in the tree checker's
binop rule (STATUS_STACK_OVERFLOW at treecheckdef.h:173).

Convert check_children from recursive child validation to deferred
validation using the runtime's existing Stack (explicit worklist).
Rule functions now short-circuit after the ID check when
g_check_id_only is set, and full child validation is deferred to an
iterative loop in check_tree.

Maximum stack depth is now bounded by the shallowest rule chain
(GROUP -> RULE, 2-3 frames) regardless of AST depth.
The pool allocator's pool_free_pages had a 10-year-old TODO where it
should have been returning physical pages to the OS. Freed blocks (>1 MB)
were kept on the free list with physical pages committed, so RSS never
decreased even after the memory was no longer needed.

Now decommits the page-aligned interior of freed blocks via
madvise(MADV_DONTNEED) on POSIX / VirtualAlloc(MEM_RESET) on Windows.
The virtual address range is preserved so pages fault back in
transparently on reuse. This primarily helps programs with large temporary
allocations (the compiler, programs with large arrays/strings).

The old behavior (never decommit) can be restored with
make configure use=pool_retain.
The scheduler stats memory allocation and used values can result in
negative values in cases where memory is allocated on a different scheduler.

This is expected behaviour.

However, the printf format specifier is mistakenly unsigned, resulting in
improbably large positive numbers instead of the correct negative values.

For example:
```
Scheduler stats for index: 13, total memory allocated: 18446744073709408560, total memory used: 18446744073709453440,
```

This PR corrects the printf specifier to be the signed 64 bit value.
…919)

When an object literal inside a trait method implements the same trait,
expr_object clears PRESERVE on the object literal's children and creates
an anonymous class. The anonymous class inherits the trait's methods via
PASS_TRAITS, but the inherited method body still contains the raw object
literal (with PRESERVE cleared and children not through name resolution).
Processing this inherited copy during PASS_EXPR crashes because it
encounters unresolved nodes.

Two changes fix this:

1. In catch_up_provides, skip ast_passes_type when the provided type
   definition is an ancestor of the object literal, preventing re-entrant
   expression pass processing on the enclosing trait.

2. In expr_object, replace the object literal with the $0.create(...)
   call and process it through PASS_REFER before ast_passes_type. This
   way, when PASS_TRAITS copies methods from the trait into the anonymous
   class, the copied method body has the resolved replacement call
   instead of the raw object literal. PASS_EXPR processing of the call
   is deferred until after the anonymous type is fully type-checked.

Closes #4451
When `pony_os_accept` returned `-1` to signal a persistent error
(e.g., EMFILE), the accept loop continued instead of bailing out,
spinning indefinitely and starving other actors.

Return on `-1` so the loop exits. The ASIO event will re-notify when
the socket becomes readable. Also fix the FFI declaration from `U32`
to `I32` to match the signed `int` that `pony_os_accept` actually
returns.

Closes #4906
@IgorDeepakM IgorDeepakM merged commit 4e05471 into master Mar 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants