[pull] master from GaijinEntertainment:master#838
Merged
Conversation
Detect push, push_clone, emplace on arrays inside loops without a preceding reserve() call. Uses propagateWrite-style expression chain walking to trace through field access (self.items), index, deref, cast to find the root variable and check scope. Key features: - Field path tracking: reserve(t.a, N) does not suppress warning for t.b - Conditional suppression: push inside if/else is not flagged - Closure suppression: push in lambda/block inside loop is not flagged - fromGeneric-based function matching for builtin generics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detect push, push_clone, emplace on arrays inside loops without a preceding reserve() call. Uses propagateWrite-style expression chain walking (ExprField, ExprAt, ExprCast, etc.) to trace through field access chains and find the root variable. Key features: - Field path tracking: reserve(t.a, N) does not suppress warning for t.b - Known-length loop detection: only warns in for loops with known-length sources (array, range, fixed_array, string), not iterators/generators - While loops always warn (user controls the bound) - Conditional suppression: push inside if/else is not flagged - Closure suppression: push in lambda/block inside loop is not flagged - inferStack reporting: warnings on generic instances show instantiation chain - fromGeneric-based function matching for builtin generics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add reserve() before push/emplace loops in 15 daslib files: aot_standalone, apply, ast_cursor, coverage, dap, das_source_formatter, daspkg, debug, decs_state, json, match, rst, spoof, templates, typemacro_boost. Fix json_boost JV generic: reserve for is_array/is_dim sources. Fix templates.das: store hashes in array, build_string after loop. Fix perf_lint.das: use build_string for inferStack message (require strings). Improve PERF006 accuracy: - While loops no longer trigger (bound is runtime-dependent, can't reserve) - Update test file with while loop as good pattern Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tiny fixed-size loop (4 hex chars max), reserve adds overhead for no benefit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-allocate vertex and index arrays in gen_sphere and gen_cylinder based on computed sizes. Fixes PERF006 warnings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- linq: reserve in zip_impl/zip3_impl (min of source lengths, require math) - json_boost: reserve in from_JV array deserialization - soa: reserve in generated from_array and to_array functions - geom_gen: reserve vertices/indices in gen_sphere/gen_cylinder - arcanoid: reserve in gen_rounded_cube geometry - gameplay/test_gameplay: reserve in build_double_deck, test hand array - 34_decs tutorial: reserve in entity creation loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add PERF006 rule and fix perf_lint warnings across codebase
- Add `perf_lint` MCP tool: runs PERF001-006 checks on .das files via `perf_lint_collect()` API (single file, batch, glob support) - Add `lint` MCP tool: runs paranoid lint checks via `paranoid_collect()` API (unused vars, unreachable code, const suggestions) - Add `compile_only()` helper in common.das (compile without simulate) - Add `write_deduped()` helper for collapsing duplicate messages (x26) - Both tools compile with no_optimizations to match lint-pass timing - Refactor perf_lint.das: add collect_warnings mode + perf_lint_collect() - Refactor lint.das: add collect_errors mode + paranoid_collect() - lint.das: skip generated variables and canShadow for-loop variables (filters out decs ECS query bindings) - decs_boost.das: mark index-lookup query variables as generated - Fix lint warnings in arcanoid (var->let, remove unused hw) - Fix live_vars.das: var->let for extractData result - Standalone perf_lint tool: add no_optimizations for correct AST - 8 new tests (4 perf_lint + 4 lint), all passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes PERF006 warnings in the collect functions themselves. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add perf_lint and lint MCP tools
Lint sweep across daslib/ and modules/ using the new lint MCP tool. daslib fixes: - aot_cpp.das: remove unused vars, var->let, comment unreachable code - aot_standalone.das: remove dead disableInit, shadowed modules_str - ast_print.das: comment unused bfa, var->let - coverage.das: unused for-loop var, var->let Module fixes: - dasAudio/audio_boost.das: 6x var->let for variant reads - dasAudio/audio_live.das: var->let for extractData - dasGlfw/glfw_live.das: var->let for extractData - dasLiveHost/decs_live.das: var->let for extractData - dasLiveHost/live_commands.das: var->let - dasOpenGL/opengl_state.das: 2x var->let - dasOpenGL/points/points.das: unused loop var, 3x var->let - dasOpenGL/points/sdfi.das: 3x var->let, 2x unused loop var, unused tmax C++ fix: - module_builtin_fio.cpp: stat/fstat bindings used modifyExternal but take FStat& -- changed to modifyArgumentAndExternal so compiler correctly tracks argument modification Also adds utils/mcp/lint_issues.md tracking lint false positives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix lint warnings across daslib and modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )