[pull] master from GaijinEntertainment:master#997
Merged
Conversation
fix: ensure proper GC collection on serialization failure
Two cards from the dasImgui PR #32 session: * how-do-i-embed-a-bound-cpp-struct-as-a-daslang-state-field-and-what- binding-overrides-do-i-need — the four C++ ManagedStructureAnnotation overrides (isLocal / canBePlacedInContainer / hasNonTrivialCtor / canCopy) needed before a daslang state struct can embed a bound C value field, plus the two daslang-side overrides (JV + archive::serialize) that short-circuit json_boost's and LiveVarsPass's field walkers. Surfaced one error at a time during the ImGuiTextFilter embed work for the Example Console port — documents the cbind_boost-emits-only-two-of-four gotcha and the pure-daslang escape hatch as a reality check. * how-do-i-rebuild-a-loaded-daslang-shared-module-when-linker-fails- lnk1104-dll-locked — the rename-then-build workaround for the case where MCP has the DLL mapped. Keeps the session alive across multiple rebuild cycles without forcing the user to kill MCP. Documents the in-process vs subprocess code-loading distinction (fresh daslang.exe subprocesses see the new code; MCP-internal compile_check sees the old until MCP restarts). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
paranoid_collect (and its perf_lint / style_lint twins) were slow because
get_file_source_line walked from byte 0 every call, counting '\n'. Each
candidate warning hit is_suppressed -> get_file_source_line, so per-file
cost was roughly O(warnings x file_size). The per-line scanners in
style_lint (source_line_between, check_defer_pipe, scan_file_lines)
amplified this to O(L^2) on big files.
Three changes in one PR:
1) Lazy line-offset index on FileInfo (debug_info.{h,cpp}). buildLineIndex
builds a vector<uint32_t> of line-start byte offsets on first call;
getLine is O(1) thereafter. get_file_source_line rewritten to use it.
Every existing caller (3 lint modules + 8 sites in utils/fix-lint-errors)
benefits transparently. Tiny memory overhead (~4 bytes per source line,
per file, lazy).
2) Unified lint suppression API. Two new C-side scanners in rtti_core
(module_builtin_rtti.cpp): rtti_get_source_line and the pointer-math
rtti_is_nolint_suppressed (no std::regex, no allocation). daslib/rtti.das
exposes is_lint_suppressed(at, code) + extract_lint_code(text). The three
in-tree lint visitors collapse to one-liners; future custom lints
(imgui_lint, decs_lint, user code) just require daslib/rtti and call
is_lint_suppressed.
Recognized nolint forms (all backward-compatible):
// nolint:CODE
// nolint:CODE1,CODE2,CODE3
// nolint:CODE1 nolint:CODE2 (repeated directives, e.g.
modules/dasPEG/peg/parser_generator.das:543)
// prose nolint:CODE more prose (directive anywhere after //)
3) reported_locations: array<uint64> -> table<uint64> (set form) in
perf_lint and style_lint. Linear has_value scan -> O(1) hash lookup.
Tests:
- tests-cpp/small/test_file_info_line_index.cpp: FileInfo::getLine truth
table (LF/CRLF, idempotent build, out-of-range, single-line) and
rtti_is_nolint_suppressed truth table (all four forms above, substring
traps, null guards).
- tests/rtti/test_lint_suppression.das: extract_lint_code.
- tests/lint/test_nolint_suppression.das: end-to-end paranoid_collect
over a 3-LINT003 fixture with 2 suppressions; asserts count == 1.
tests/aot/CMakeLists.txt registers the new test dirs for AOT compilation.
Wall-time on tutorials/ (215 files): 43.66s -> 42.37s. Modest because
tutorials produce 0 lint warnings, so the per-warning fast path isn't
exercised - the structural fix compounds dramatically on files with many
warnings. Issue count: 0 -> 0 (no semantic drift).
Verified: Release + Debug builds clean; tests-cpp 22/22; AOT mode pass for
tests/lint, tests/rtti, tests/daslib, tests/language (939/939), tests/strings
(361/361).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three cards accumulated during the dasImgui `_no_imgui_legacy` lint detour (PR #29) — captured but not yet committed: * imgui2rst-strict-struct-fields-docstring-count — the //!-per-field requirement enforced by daslib/rst.das's strict_struct_fields rule. Real failure mode: imgui2rst CI panics "has less documentation than values, expected at least N lines" when a class's //! block has fewer lines than fields. Fix shape: one //! per public field. * lint-macro-opt-in-via-options-find-arg — the `prog._options |> find_arg("...") ?as tBool ?? false` early-return pattern that makes a [lint_macro] opt-in per file via `options _flag = true`. Mirrors the `_comment_hygiene` / `_no_imgui_legacy` shape; off-by-default lints don't fire on every consumer until they opt in. * lint-macro-skip-qmacro-synth-calls-via-fileinfo — the combined skip in preVisitExprCall: bail when the containing function is generated OR when the call's at.fileInfo differs from the containing function's. Avoids false positives on calls baked into user code by qmacro splices (e.g. `with_id` PushID/PopID emitted inside a user body). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot caught a garbled sentence on the DLL-rebuild card: the original text mashed two ideas together with a non-grammatical `via` and named a PowerShell command that doesn't actually work — `Win32_Process` CIM instances don't expose a `.Modules` property. Split into two coherent sentences and corrected the command to use `Get-Process` (System.Diagnostics.Process — its `.Modules` collection DOES list loaded DLLs). This is the form actually used during the dasImgui session that surfaced the card; the original write-up was a transcription error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…fo-line-index lint: O(1) FileInfo line index + unified suppression API in rtti_core
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 : )