Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #113.
Summary
Counts heap-allocated
BigInts (BigNum::SmallandBigNum::Large) towardLimits::max_heap_bytes, visitsValue::Biginsideheap::Walk::value(for closure cells and own properties on functions/errors), and chargesBigNum::Largebyte length toward allocation pacing inVm::heap_big.Changes
builtins/bigint.rs:BigNum::byte_len(&self) -> u64(16forSmall,n.bits().div_ceil(8)forLarge).Largebyte length viaself.charge_heap(extra)inVm::heap_bigso largeBigIntallocations pace heap measurement promptly.heap.rs:BIGINT_BYTES = 16and countKind::BigInt(n)asBIGINT_BYTES + n.byte_len()inobject_bytes(each distinct interned value counts once; inlineBigInts remain 0).Value::Big(id) if crate::builtins::bigint::on_heap(id)inWalk::valueso closure-capturedBigInts andBigInts stored on function/error properties are reached and counted.tests/heap.rs:large_bigints_count_toward_the_heap_limitcovering array-held, closure-captured, function-property, error-property, shared interned, and GC-collectedBigInts.Verification
cargo fmt --checkcargo clippy --offline --locked -p psychoscript --all-targets -- -D warningscargo test --offline --locked -p psychoscript --test heap(12/12 passed)PSYCHOSCRIPT_GC_STRESS=1 cargo test --offline --locked -p psychoscript --test heap(12/12 passed)