fix(loader): encode initial pcdata safe value#940
Draft
liuq19 wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #940 +/- ##
==========================================
- Coverage 51.86% 51.28% -0.59%
==========================================
Files 127 172 +45
Lines 10893 14147 +3254
==========================================
+ Hits 5650 7255 +1605
- Misses 4920 6502 +1582
- Partials 323 390 +67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
fix(loader): 编码初始 pcdata safe 值
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
This PR fixes a loader pcdata encoder edge case where a single entry whose value equals the runtime pcdata start value (-1) was skipped entirely. In particular, Loader.LoadOne/LoadMany with NoPreempt left as false builds a PcUnsafePoint table containing one PCDATA_UnsafePointSafe entry. Before this change, MarshalBinary encoded that table as only the trailing terminator byte, so the runtime async-preempt path could hit an invalid pc-encoded table.
The fix allows the first emitted pcdata record to carry a zero value delta, which matches the runtime decoder behavior for the first pcdata step. Later zero value deltas are still skipped so the terminator encoding remains unambiguous. The PR also adds regression coverage for the single safe-entry encoding and the LoadOne/LoadMany helper path.
zh(optional):
修复 loader pcdata 编码的边界情况:当首条记录的值等于 runtime pcdata 初始值 -1 时,之前会被 dv == 0 逻辑跳过,导致 NoPreempt=false 生成的 PcUnsafePoint 表只剩 terminator。现在允许首条实际发出的记录使用零 value delta,同时保留后续 dv == 0 的跳过逻辑,避免和 terminator 语义冲突。
Validation:
(Optional) Which issue(s) this PR fixes:
Fixes #939
(optional) The PR that updates user documentation:
Not required.