Fix memory pool test failures (27/27 pass)
- SHA
0c7311f3ff9570657cb3ee5b70ec2c1edd1c4a96- Parents
-
e372ba6 - Tree
c7b9e80
0c7311f
0c7311f3ff9570657cb3ee5b70ec2c1edd1c4a96e372ba6
c7b9e80| Status | File | + | - |
|---|---|---|---|
| M |
Makefile
|
10 | 6 |
| M |
src/common/memory_dashboard.f90
|
6 | 0 |
| M |
tests/memory_pool_test_bench.sh
|
5 | 5 |
Makefilemodified@@ -31,7 +31,12 @@ ifeq ($(NO_MEMPOOL),1) | ||
| 31 | 31 | $(info Memory pooling DISABLED - using standard allocation) |
| 32 | 32 | else |
| 33 | 33 | POOL_FLAGS = -DUSE_MEMORY_POOL |
| 34 | - $(info Memory pooling ENABLED - using zero-copy string pool [DEFAULT]) | |
| 34 | + ifeq ($(MEMPOOL_DEBUG),1) | |
| 35 | + POOL_FLAGS += -DMEMPOOL_DEBUG | |
| 36 | + $(info Memory pooling ENABLED with DEBUG output - using zero-copy string pool) | |
| 37 | + else | |
| 38 | + $(info Memory pooling ENABLED - using zero-copy string pool [DEFAULT]) | |
| 39 | + endif | |
| 35 | 40 | endif |
| 36 | 41 | |
| 37 | 42 | # C compiler for string operations library |
@@ -97,11 +102,9 @@ else | ||
| 97 | 102 | POOL_OBJECTS = $(BUILDDIR)/common/string_pool.o $(BUILDDIR)/common/memory_dashboard.o |
| 98 | 103 | endif |
| 99 | 104 | |
| 100 | -# Object files in dependency order | |
| 101 | -# Note: Circular dependencies exist between parser/expansion/substitution/command_capture | |
| 102 | -# The linker resolves these at link time, so build order matters | |
| 103 | -# Force sequential build to handle circular dependencies correctly | |
| 104 | -.NOTPARALLEL: | |
| 105 | +# Object files with explicit dependencies | |
| 106 | +# All module dependencies are properly declared in the rules below, | |
| 107 | +# so parallel builds work correctly | |
| 105 | 108 | OBJECTS = $(BUILDDIR)/common/types.o \ |
| 106 | 109 | $(BUILDDIR)/common/error_handling.o \ |
| 107 | 110 | $(BUILDDIR)/common/performance.o \ |
@@ -415,6 +418,7 @@ help: | ||
| 415 | 418 | @echo "Memory pooling options:" |
| 416 | 419 | @echo " make - Build with memory pooling (DEFAULT)" |
| 417 | 420 | @echo " NO_MEMPOOL=1 make - Build without memory pooling" |
| 421 | + @echo " MEMPOOL_DEBUG=1 make - Build with memory pool debug output" | |
| 418 | 422 | @echo "" |
| 419 | 423 | @echo "C string library (flang-new workaround):" |
| 420 | 424 | @echo " c-strings - Build C string library test" |
src/common/memory_dashboard.f90modified@@ -84,6 +84,12 @@ contains | ||
| 84 | 84 | dashboard%verbose = .false. |
| 85 | 85 | if (present(verbose)) dashboard%verbose = verbose |
| 86 | 86 | |
| 87 | +#ifdef MEMPOOL_DEBUG | |
| 88 | + ! Enable verbose output when MEMPOOL_DEBUG is defined | |
| 89 | + dashboard%verbose = .true. | |
| 90 | + write(output_unit, '(A)') "[MEMPOOL_DEBUG] Memory dashboard initialized in debug mode" | |
| 91 | +#endif | |
| 92 | + | |
| 87 | 93 | ! Get start time (simplified - would use system clock in real implementation) |
| 88 | 94 | dashboard%session_start_time = 0 |
| 89 | 95 | |
tests/memory_pool_test_bench.shmodified@@ -76,7 +76,7 @@ section "1. BUILD VALIDATION" | ||
| 76 | 76 | subsection "Building pooled version" |
| 77 | 77 | cd "$FORTSH_DIR" || exit 1 |
| 78 | 78 | make clean > /dev/null 2>&1 |
| 79 | -if MEMPOOL=1 make > /dev/null 2>&1; then | |
| 79 | +if make > /dev/null 2>&1; then | |
| 80 | 80 | pass "Pooled build successful" |
| 81 | 81 | cp bin/fortsh "$FORTSH_POOLED" |
| 82 | 82 | else |
@@ -86,7 +86,7 @@ fi | ||
| 86 | 86 | |
| 87 | 87 | subsection "Building traditional version" |
| 88 | 88 | make clean > /dev/null 2>&1 |
| 89 | -if make > /dev/null 2>&1; then | |
| 89 | +if make NO_MEMPOOL=1 > /dev/null 2>&1; then | |
| 90 | 90 | pass "Traditional build successful" |
| 91 | 91 | cp bin/fortsh "$FORTSH_TRADITIONAL" |
| 92 | 92 | else |
@@ -266,15 +266,15 @@ else | ||
| 266 | 266 | fi |
| 267 | 267 | |
| 268 | 268 | subsection "Nested expansions" |
| 269 | -# Test deeply nested expansions | |
| 270 | -TEST_CMD='A=1; B=A; C=B; D=C; E=D; eval eval eval eval echo \$\$\$\$$E' | |
| 269 | +# Test deeply nested expansions with variable indirection (deterministic) | |
| 270 | +TEST_CMD='V=world; X="\$V"; Y="\$X"; eval eval echo "$Y"' | |
| 271 | 271 | POOLED_OUT=$("$FORTSH_POOLED" -c "$TEST_CMD" 2>&1) |
| 272 | 272 | TRAD_OUT=$("$FORTSH_TRADITIONAL" -c "$TEST_CMD" 2>&1) |
| 273 | 273 | |
| 274 | 274 | if [ "$POOLED_OUT" = "$TRAD_OUT" ]; then |
| 275 | 275 | pass "Stress: Nested expansions" |
| 276 | 276 | else |
| 277 | - fail "Stress: Different nested expansion behavior" | |
| 277 | + fail "Stress: Different nested expansion behavior" "Pooled: '$POOLED_OUT', Traditional: '$TRAD_OUT'" | |
| 278 | 278 | fi |
| 279 | 279 | |
| 280 | 280 | # ===================================== |