cfsolve 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +10 -9
- data/THIRD_PARTY_LICENSES/README.md +71 -254
- data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
- data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
- data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
- data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
- data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
- data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
- data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
- data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
- data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
- data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
- data/UPSTREAM.md +10 -8
- data/ext/cfsolve/Cargo.lock +534 -1727
- data/ext/cfsolve/Cargo.toml +4 -0
- data/ext/cfsolve/src/main.rs +1 -1
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/lib/cfsolve/profiles/safari-26-ios.json +102 -156
- data/lib/cfsolve/version.rb +2 -2
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +4 -35
- data/vendor/cfsolve/examples/build_profile.rs +17 -15
- data/vendor/cfsolve/examples/capture_session.rs +37 -0
- data/vendor/cfsolve/examples/check_answers.rs +66 -0
- data/vendor/cfsolve/examples/compare_session.rs +189 -0
- data/vendor/cfsolve/examples/solver_profile.rs +84 -0
- data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
- data/vendor/cfsolve/examples/stage2_snapshot.rs +6 -3
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/vendor/cfsolve/profiles/safari-26-ios.json +102 -156
- data/vendor/cfsolve/scripts/capture_cssom.mjs +42 -0
- data/vendor/cfsolve/scripts/serve_cssom.py +111 -0
- data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
- data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
- data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
- data/vendor/cfsolve/src/capture/profile.rs +7 -18
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/recorded.rs +42 -7
- data/vendor/cfsolve/src/capture/sessions.rs +4 -3
- data/vendor/cfsolve/src/capture/upstream.rs +1 -1
- data/vendor/cfsolve/src/challenge/codec.rs +4 -2
- data/vendor/cfsolve/src/challenge/expression.rs +161 -117
- data/vendor/cfsolve/src/challenge/installed/audit.rs +132 -0
- data/vendor/cfsolve/src/challenge/installed.rs +127 -269
- data/vendor/cfsolve/src/challenge/merge.rs +120 -80
- data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
- data/vendor/cfsolve/src/challenge/payload.rs +175 -35
- data/vendor/cfsolve/src/challenge/program.rs +197 -178
- data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
- data/vendor/cfsolve/src/challenge/source.rs +151 -96
- data/vendor/cfsolve/src/challenge/state.rs +236 -122
- data/vendor/cfsolve/src/challenge/tally.rs +64 -50
- data/vendor/cfsolve/src/challenge.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
- data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
- data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
- data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
- data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
- data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
- data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
- data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
- data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
- data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
- data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
- data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
- data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
- data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
- data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
- data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +201 -205
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +346 -536
- data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
- data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
- data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
- data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
- data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
- data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
- data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +361 -322
- data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
- data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
- data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
- data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
- data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
- data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
- data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
- data/vendor/cfsolve/src/deobfuscate.rs +15 -11
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -32
- data/vendor/cfsolve/src/embedding_page/page.rs +28 -2
- data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
- data/vendor/cfsolve/src/error.rs +40 -5
- data/vendor/cfsolve/src/fingerprint.rs +8 -2
- data/vendor/cfsolve/src/http/client.rs +9 -1
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -254
- data/vendor/cfsolve/src/js/objects.rs +9 -2
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -92
- data/vendor/cfsolve/src/listing/query.rs +26 -291
- data/vendor/cfsolve/src/listing.rs +0 -1
- data/vendor/cfsolve/src/performance_clock.rs +20 -1
- data/vendor/cfsolve/src/profiling.rs +49 -0
- data/vendor/cfsolve/src/script.rs +35 -24
- data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
- data/vendor/cfsolve/src/session/channel.rs +2 -2
- data/vendor/cfsolve/src/session/initial.rs +19 -10
- data/vendor/cfsolve/src/session/probes.rs +160 -125
- data/vendor/cfsolve/src/session/sink.rs +26 -1
- data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
- data/vendor/cfsolve/src/session/timing.rs +58 -53
- data/vendor/cfsolve/src/session/widget.rs +5 -6
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +50 -33
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +61 -66
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +33 -22
- data/vendor/cfsolve/src/stage2/analysis/recognize.rs +3 -5
- data/vendor/cfsolve/src/stage2/analysis.rs +0 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +378 -0
- data/vendor/cfsolve/src/stage2/benchmark.rs +66 -38
- data/vendor/cfsolve/src/stage2/call_stack.rs +1463 -1017
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
- data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
- data/vendor/cfsolve/src/stage2/interaction/native.rs +2 -1
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -7
- data/vendor/cfsolve/src/stage2/payload/recover.rs +56 -25
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/ice.rs +11 -10
- data/vendor/cfsolve/src/stage2/probes/media.rs +47 -33
- data/vendor/cfsolve/src/stage2/probes/performance.rs +13 -8
- data/vendor/cfsolve/src/stage2/probes/rects.rs +12 -17
- data/vendor/cfsolve/src/stage2/probes/stack.rs +50 -103
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +17 -86
- data/vendor/cfsolve/src/stage2/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/records.rs +4 -13
- data/vendor/cfsolve/src/stage2/reference.json +1 -1
- data/vendor/cfsolve/src/stage2/reference.rs +98 -100
- data/vendor/cfsolve/src/stage2/registry.rs +41 -34
- data/vendor/cfsolve/src/stage2/replay.rs +182 -254
- data/vendor/cfsolve/src/stage2/stylesheets.rs +176 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +152 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +103 -403
- data/vendor/cfsolve/src/stage2.rs +4 -1
- data/vendor/cfsolve/src/vm/disassemble.rs +46 -13
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/extract.rs +347 -250
- data/vendor/cfsolve/src/vm/interpret/access.rs +67 -68
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +16 -63
- data/vendor/cfsolve/src/vm/interpret/call.rs +192 -51
- data/vendor/cfsolve/src/vm/interpret/compile.rs +643 -0
- data/vendor/cfsolve/src/vm/interpret/copies.rs +232 -120
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +149 -40
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +189 -572
- data/vendor/cfsolve/src/vm/interpret/explore.rs +159 -46
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +169 -0
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +414 -0
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +605 -330
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +314 -54
- data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
- data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
- data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
- data/vendor/cfsolve/src/vm/interpret.rs +16 -3
- data/vendor/cfsolve/src/vm/machine.rs +58 -47
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +311 -0
- data/vendor/cfsolve/src/vm/session.rs +197 -110
- data/vendor/cfsolve/src/vm/value.rs +35 -19
- data/vendor/cfsolve/src/vm.rs +3 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- data/vendor/cfsolve/vendor/btls-sys/src/lib.rs +3 -0
- metadata +106 -183
- data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
- data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
- data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
- data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
- data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
- data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
- data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
- data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
- data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
- data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
- data/vendor/cfsolve/src/listing/normalize.rs +0 -264
- data/vendor/cfsolve/src/stage2/analysis/outputs.rs +0 -327
- data/vendor/cfsolve/src/stage2/probes/stylesheets.rs +0 -249
- data/vendor/cfsolve/src/stage2/reference-expanded.json +0 -42
- data/vendor/cfsolve/src/stage2/session_names.rs +0 -470
- /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
//! journal that undoes speculative attempts.
|
|
3
3
|
|
|
4
4
|
use std::borrow::Cow;
|
|
5
|
+
use std::cell::RefCell;
|
|
5
6
|
use std::hash::Hash;
|
|
6
7
|
use std::mem;
|
|
7
8
|
use std::rc::Rc;
|
|
8
9
|
|
|
9
|
-
use
|
|
10
|
-
use swc_core::ecma::ast::{BinaryOp, UnaryOp};
|
|
10
|
+
use oxc::syntax::operator::{BinaryOperator, UnaryOperator};
|
|
11
11
|
|
|
12
12
|
use super::builtin;
|
|
13
|
-
use super::copies::{self, Copies};
|
|
13
|
+
use super::copies::{self, Copies, Fork};
|
|
14
14
|
use super::explore::Invocation;
|
|
15
|
+
use super::frozen::{self, Frozen};
|
|
16
|
+
use crate::js::ast::{Binding, Script};
|
|
15
17
|
use crate::vm::output::{Constant, Effect, Exit, Path, Position, Term};
|
|
16
18
|
use crate::vm::session::Session;
|
|
17
19
|
use crate::vm::value::{Callable, Env, Scope, Value};
|
|
18
|
-
use crate::vm::{HashMap, convert};
|
|
20
|
+
use crate::vm::{HashMap, convert, disassemble};
|
|
19
21
|
|
|
20
22
|
/// Why evaluation stopped before completing normally.
|
|
21
23
|
pub(crate) enum Stop<'ast> {
|
|
@@ -42,8 +44,8 @@ pub(super) type Evaluation<'ast, T> = Result<T, Box<Stop<'ast>>>;
|
|
|
42
44
|
pub(super) enum Flow<'ast> {
|
|
43
45
|
Normal,
|
|
44
46
|
Return(Value<'ast>),
|
|
45
|
-
Break(Option
|
|
46
|
-
Continue(Option
|
|
47
|
+
Break(Option<&'ast str>),
|
|
48
|
+
Continue(Option<&'ast str>),
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
pub(crate) struct Run<'ast, 'session> {
|
|
@@ -51,16 +53,18 @@ pub(crate) struct Run<'ast, 'session> {
|
|
|
51
53
|
pub(super) program: &'session [u8],
|
|
52
54
|
/// Instance fields derived from program bytes by the constructor, once known.
|
|
53
55
|
constructed: Option<&'session HashMap<String, Value<'ast>>>,
|
|
56
|
+
/// Strings decrypted from the program's records, once a program is loaded.
|
|
57
|
+
pub(super) decrypted: Option<&'session Decrypted<'ast>>,
|
|
54
58
|
pub(super) registers: HashMap<u8, Value<'ast>>,
|
|
55
59
|
/// Tags written before their register values; see [`crate::vm::registers`].
|
|
56
60
|
pub(super) tags: HashMap<u8, Value<'ast>>,
|
|
57
61
|
/// Instance fields this run has read or written.
|
|
58
62
|
pub(super) fields: HashMap<String, Value<'ast>>,
|
|
59
63
|
/// Session bindings this run has read or written.
|
|
60
|
-
pub(super) globals: HashMap<
|
|
61
|
-
///
|
|
64
|
+
pub(super) globals: HashMap<Binding<'ast>, Value<'ast>>,
|
|
65
|
+
/// Bindings unavailable after interrupted setup, with their errors. Setup copies the
|
|
62
66
|
/// session's map when it changes it.
|
|
63
|
-
pub(super) unavailable: Cow<'session, HashMap<
|
|
67
|
+
pub(super) unavailable: Cow<'session, HashMap<Binding<'ast>, String>>,
|
|
64
68
|
/// Copies isolate session objects; absent while building the session.
|
|
65
69
|
copies: Option<Copies<'ast>>,
|
|
66
70
|
pub(super) frames: Vec<Frame<'ast>>,
|
|
@@ -76,6 +80,23 @@ pub(crate) struct Run<'ast, 'session> {
|
|
|
76
80
|
facts: Vec<(Term, Value<'ast>)>,
|
|
77
81
|
journal: Journal<'ast>,
|
|
78
82
|
pub(super) spare: Spare<'ast>,
|
|
83
|
+
/// Whether the run shares [`Frozen`] session objects instead of copying them.
|
|
84
|
+
pub(super) sharing: bool,
|
|
85
|
+
/// Whether the run wrote to a shared object, thawing it. Its results are discarded.
|
|
86
|
+
pub(super) thawed: bool,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// Strings decrypted from a program's string records, by record contents (see
|
|
90
|
+
/// [`RecordKey`]).
|
|
91
|
+
pub(crate) type Decrypted<'ast> = RefCell<HashMap<RecordKey, Value<'ast>>>;
|
|
92
|
+
|
|
93
|
+
/// The contents of a string record after the program: numbers and arrays of numbers, as bits.
|
|
94
|
+
pub(crate) type RecordKey = Vec<RecordPart>;
|
|
95
|
+
|
|
96
|
+
#[derive(Clone, PartialEq, Eq, Hash)]
|
|
97
|
+
pub(crate) enum RecordPart {
|
|
98
|
+
Number(u64),
|
|
99
|
+
Numbers(Vec<u64>),
|
|
79
100
|
}
|
|
80
101
|
|
|
81
102
|
/// Cleared buffers from completed calls. Handler runs take them from the session and
|
|
@@ -129,22 +150,22 @@ struct Polarity<'term> {
|
|
|
129
150
|
|
|
130
151
|
#[derive(PartialEq)]
|
|
131
152
|
enum Base<'term> {
|
|
132
|
-
Binary(
|
|
153
|
+
Binary(BinaryOperator, &'term Term, &'term Term),
|
|
133
154
|
Other(&'term Term),
|
|
134
155
|
}
|
|
135
156
|
|
|
136
157
|
impl<'term> Polarity<'term> {
|
|
137
158
|
fn of(mut term: &'term Term) -> Self {
|
|
138
159
|
let mut negated = false;
|
|
139
|
-
while let Term::Unary(
|
|
160
|
+
while let Term::Unary(UnaryOperator::LogicalNot, inner) = term {
|
|
140
161
|
term = inner;
|
|
141
162
|
negated = !negated;
|
|
142
163
|
}
|
|
143
164
|
let base = match term {
|
|
144
165
|
Term::Binary(operator, left, right) => {
|
|
145
166
|
let (operator, inequality) = match operator {
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
BinaryOperator::StrictInequality => (BinaryOperator::StrictEquality, true),
|
|
168
|
+
BinaryOperator::Inequality => (BinaryOperator::Equality, true),
|
|
148
169
|
operator => (*operator, false),
|
|
149
170
|
};
|
|
150
171
|
negated ^= inequality;
|
|
@@ -193,22 +214,76 @@ pub(super) struct Checkpoint {
|
|
|
193
214
|
enum Undo<'ast> {
|
|
194
215
|
Register(u8, Option<Value<'ast>>),
|
|
195
216
|
Field(String, Option<Value<'ast>>),
|
|
196
|
-
Global(
|
|
217
|
+
Global(Binding<'ast>, Option<Value<'ast>>),
|
|
197
218
|
}
|
|
198
219
|
|
|
199
220
|
/// Active call receiver and local scope.
|
|
200
221
|
pub(super) struct Frame<'ast> {
|
|
201
222
|
pub(super) this: Value<'ast>,
|
|
202
|
-
pub(super) scope:
|
|
223
|
+
pub(super) scope: CallScope<'ast>,
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/// A call's own scope. Most slot-plan calls never store a variable in it, so it is created
|
|
227
|
+
/// on first use. Until then, the call sees exactly the variables of the scope it would enclose.
|
|
228
|
+
pub(super) enum CallScope<'ast> {
|
|
229
|
+
Own(Scope<'ast>),
|
|
230
|
+
/// Not yet created; it would enclose this scope.
|
|
231
|
+
Deferred(Option<Scope<'ast>>),
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
impl<'ast> CallScope<'ast> {
|
|
235
|
+
fn fork(&self, fork: &mut Fork<'_, 'ast>) -> Self {
|
|
236
|
+
match self {
|
|
237
|
+
Self::Own(scope) => Self::Own(fork.scope(scope)),
|
|
238
|
+
Self::Deferred(outer) => Self::Deferred(outer.as_ref().map(|outer| fork.scope(outer))),
|
|
239
|
+
}
|
|
240
|
+
}
|
|
203
241
|
}
|
|
204
242
|
|
|
205
243
|
impl<'ast> Frame<'ast> {
|
|
206
244
|
pub(super) fn new(this: Value<'ast>) -> Self {
|
|
207
245
|
Self {
|
|
208
246
|
this,
|
|
209
|
-
scope:
|
|
247
|
+
scope: CallScope::Deferred(None),
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/// The call's own scope, creating it if needed.
|
|
252
|
+
pub(super) fn own_scope(&mut self) -> &Scope<'ast> {
|
|
253
|
+
if let CallScope::Deferred(outer) = &mut self.scope {
|
|
254
|
+
self.scope = CallScope::Own(Env::scope(HashMap::default(), outer.take()));
|
|
255
|
+
}
|
|
256
|
+
let CallScope::Own(scope) = &self.scope else {
|
|
257
|
+
unreachable!("the scope was just created");
|
|
258
|
+
};
|
|
259
|
+
scope
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/// The scope enclosing the call's own variables, if the call has any.
|
|
263
|
+
fn visible(&self) -> Option<&Scope<'ast>> {
|
|
264
|
+
match &self.scope {
|
|
265
|
+
CallScope::Own(scope) => Some(scope),
|
|
266
|
+
CallScope::Deferred(outer) => outer.as_ref(),
|
|
210
267
|
}
|
|
211
268
|
}
|
|
269
|
+
|
|
270
|
+
pub(super) fn find(&self, binding: Binding<'ast>) -> Option<Value<'ast>> {
|
|
271
|
+
Env::find(self.visible()?, binding)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/// Assigns `binding` in the nearest scope containing it, as [`Env::assign`] does.
|
|
275
|
+
pub(super) fn assign(&self, binding: Binding<'ast>, value: Value<'ast>) -> Option<Value<'ast>> {
|
|
276
|
+
match self.visible() {
|
|
277
|
+
Some(scope) => Env::assign(scope, binding, value),
|
|
278
|
+
None => Some(value),
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/// Whether the call itself declares `binding`.
|
|
283
|
+
pub(super) fn declares(&self, binding: Binding<'ast>) -> bool {
|
|
284
|
+
matches!(&self.scope, CallScope::Own(scope)
|
|
285
|
+
if scope.borrow().variables.contains_key(&binding))
|
|
286
|
+
}
|
|
212
287
|
}
|
|
213
288
|
|
|
214
289
|
impl<'ast, 'session> Run<'ast, 'session> {
|
|
@@ -222,6 +297,7 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
222
297
|
session,
|
|
223
298
|
program,
|
|
224
299
|
constructed: None,
|
|
300
|
+
decrypted: None,
|
|
225
301
|
registers: HashMap::default(),
|
|
226
302
|
tags: HashMap::default(),
|
|
227
303
|
fields: HashMap::default(),
|
|
@@ -240,21 +316,15 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
240
316
|
facts: Vec::new(),
|
|
241
317
|
journal: Journal::default(),
|
|
242
318
|
spare: Spare::default(),
|
|
319
|
+
sharing: false,
|
|
320
|
+
thawed: false,
|
|
243
321
|
}
|
|
244
322
|
}
|
|
245
323
|
|
|
246
324
|
/// A handler run that follows `decisions`, then takes any further symbolic branch as true.
|
|
247
325
|
pub(super) fn handler(invocation: &Invocation<'session, 'ast>, decisions: Vec<bool>) -> Self {
|
|
248
|
-
let
|
|
249
|
-
|
|
250
|
-
session,
|
|
251
|
-
invocation.program,
|
|
252
|
-
decisions,
|
|
253
|
-
Some(Copies::default()),
|
|
254
|
-
);
|
|
255
|
-
run.constructed = Some(invocation.fields);
|
|
256
|
-
run.spare = session.spare.take();
|
|
257
|
-
for (register, value) in &session.initial {
|
|
326
|
+
let mut run = Self::invoked(invocation, decisions, Some(Copies::default()));
|
|
327
|
+
for (register, value) in &invocation.session.initial {
|
|
258
328
|
let value = run.isolate(value);
|
|
259
329
|
run.registers.insert(*register, value);
|
|
260
330
|
}
|
|
@@ -263,6 +333,20 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
263
333
|
run
|
|
264
334
|
}
|
|
265
335
|
|
|
336
|
+
/// A run of `invocation`'s handler with no registers set, sharing frozen session objects.
|
|
337
|
+
fn invoked(
|
|
338
|
+
invocation: &Invocation<'session, 'ast>,
|
|
339
|
+
decisions: Vec<bool>,
|
|
340
|
+
copies: Option<Copies<'ast>>,
|
|
341
|
+
) -> Self {
|
|
342
|
+
let mut run = Self::new(invocation.session, invocation.program, decisions, copies);
|
|
343
|
+
run.constructed = Some(invocation.fields);
|
|
344
|
+
run.decrypted = Some(invocation.decrypted);
|
|
345
|
+
run.spare = invocation.session.spare.take();
|
|
346
|
+
run.sharing = true;
|
|
347
|
+
run
|
|
348
|
+
}
|
|
349
|
+
|
|
266
350
|
/// Sets the program counter to `pc` and the dispatch key to `key`.
|
|
267
351
|
pub(super) fn start_at(&mut self, pc: u32, key: u8) {
|
|
268
352
|
let layout = self.session.layout;
|
|
@@ -291,6 +375,11 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
291
375
|
run
|
|
292
376
|
}
|
|
293
377
|
|
|
378
|
+
/// The script whose code the run interprets.
|
|
379
|
+
pub(in crate::vm) fn source(&self) -> Script<'ast> {
|
|
380
|
+
self.session.script
|
|
381
|
+
}
|
|
382
|
+
|
|
294
383
|
/// The path this run took, or why the handler rejected its operands.
|
|
295
384
|
pub(super) fn finish(mut self, outcome: Evaluation<'ast, Value<'ast>>) -> Result<Path, String> {
|
|
296
385
|
self.session.spare.replace(mem::take(&mut self.spare));
|
|
@@ -311,6 +400,19 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
311
400
|
},
|
|
312
401
|
},
|
|
313
402
|
};
|
|
403
|
+
// A catch handler can be pushed onto a constructor-created register stack.
|
|
404
|
+
// Native array operations mutate that stack without producing an effect; retain
|
|
405
|
+
// its frame so disassembly can also visit the exception continuation.
|
|
406
|
+
for (register, _) in &self.session.initial {
|
|
407
|
+
if let Some(value @ Value::Array(elements)) = self.registers.get(register)
|
|
408
|
+
&& elements.borrow().iter().any(|element| {
|
|
409
|
+
matches!(element.expr(), Term::Array(ref frame)
|
|
410
|
+
if disassemble::catch_frame(frame).is_some())
|
|
411
|
+
})
|
|
412
|
+
{
|
|
413
|
+
self.effects.push(Effect::Set(*register, value.expr()));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
314
416
|
// The listing retains every path, so release unused vector capacity.
|
|
315
417
|
let mut conditions = self.branches.conditions;
|
|
316
418
|
conditions.shrink_to_fit();
|
|
@@ -364,7 +466,7 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
364
466
|
/// Records that an expression equals a constant after a true strict equality test or a false
|
|
365
467
|
/// strict inequality test.
|
|
366
468
|
fn learn(&mut self, mut condition: &Term, mut holds: bool) {
|
|
367
|
-
while let Term::Unary(
|
|
469
|
+
while let Term::Unary(UnaryOperator::LogicalNot, inner) = condition {
|
|
368
470
|
condition = inner;
|
|
369
471
|
holds = !holds;
|
|
370
472
|
}
|
|
@@ -372,8 +474,8 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
372
474
|
return;
|
|
373
475
|
};
|
|
374
476
|
let equal = match operator {
|
|
375
|
-
|
|
376
|
-
|
|
477
|
+
BinaryOperator::StrictEquality => holds,
|
|
478
|
+
BinaryOperator::StrictInequality => !holds,
|
|
377
479
|
_ => return,
|
|
378
480
|
};
|
|
379
481
|
if equal
|
|
@@ -408,44 +510,54 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
408
510
|
self.frames.last().expect("code runs inside a frame")
|
|
409
511
|
}
|
|
410
512
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
513
|
+
pub(super) fn frame_mut(&mut self) -> &mut Frame<'ast> {
|
|
514
|
+
self.frames.last_mut().expect("code runs inside a frame")
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/// Declares `binding` in the active call's scope.
|
|
518
|
+
pub(super) fn declare(&mut self, binding: Binding<'ast>, value: Value<'ast>) {
|
|
519
|
+
self.frame_mut()
|
|
520
|
+
.own_scope()
|
|
415
521
|
.borrow_mut()
|
|
416
522
|
.variables
|
|
417
|
-
.insert(
|
|
523
|
+
.insert(binding, value);
|
|
418
524
|
}
|
|
419
525
|
|
|
420
|
-
|
|
421
|
-
|
|
526
|
+
/// Reads `binding` from the scopes, then from session bindings and functions declared
|
|
527
|
+
/// beside the class. A binding none of them hold, such as a parameter of a function
|
|
528
|
+
/// enclosing the VM, reads as the global of its name, as an unresolved reference does.
|
|
529
|
+
pub(super) fn lookup(&mut self, binding: Binding<'ast>) -> Evaluation<'ast, Value<'ast>> {
|
|
530
|
+
if let Some(value) = self.frame().find(binding) {
|
|
422
531
|
return Ok(value);
|
|
423
532
|
}
|
|
424
|
-
if let Some(value) = self.globals.get(
|
|
533
|
+
if let Some(value) = self.globals.get(&binding) {
|
|
425
534
|
return Ok(value.clone());
|
|
426
535
|
}
|
|
427
|
-
|
|
536
|
+
let name = self.session.script.name(binding);
|
|
537
|
+
if let Some(reason) = self.unavailable.get(&binding) {
|
|
428
538
|
return Err(Stop::unsupported(&format!(
|
|
429
539
|
"{name}, whose setup stopped: {reason}"
|
|
430
540
|
)));
|
|
431
541
|
}
|
|
432
|
-
if let Some(value) = self.session.bindings.get(
|
|
542
|
+
if let Some(value) = self.session.bindings.get(&binding) {
|
|
433
543
|
let value = self.isolate(value);
|
|
434
|
-
self.set_global(
|
|
544
|
+
self.set_global(binding, value.clone());
|
|
435
545
|
return Ok(value);
|
|
436
546
|
}
|
|
437
|
-
if let
|
|
547
|
+
if let Binding::Symbol(symbol) = binding
|
|
548
|
+
&& let Some(&function) = self.session.functions.get(&symbol)
|
|
549
|
+
{
|
|
438
550
|
let mut values = self.session.function_values.borrow_mut();
|
|
439
|
-
let value = values.entry(
|
|
551
|
+
let value = values.entry(symbol).or_insert_with(|| {
|
|
440
552
|
Value::function(Callable::Script {
|
|
441
|
-
name: Some(name
|
|
553
|
+
name: Some(name),
|
|
442
554
|
function,
|
|
443
555
|
scope: None,
|
|
444
556
|
})
|
|
445
557
|
});
|
|
446
558
|
return Ok(value.clone());
|
|
447
559
|
}
|
|
448
|
-
Ok(match
|
|
560
|
+
Ok(match name {
|
|
449
561
|
"undefined" => Value::Undefined,
|
|
450
562
|
"NaN" => Value::Number(f64::NAN),
|
|
451
563
|
"Infinity" => Value::Number(f64::INFINITY),
|
|
@@ -454,15 +566,17 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
454
566
|
})
|
|
455
567
|
}
|
|
456
568
|
|
|
457
|
-
|
|
458
|
-
|
|
569
|
+
/// Assigns `binding` in the nearest scope holding it, or else the session binding. Otherwise
|
|
570
|
+
/// declares it in the active call's scope.
|
|
571
|
+
pub(super) fn assign(&mut self, binding: Binding<'ast>, value: Value<'ast>) {
|
|
572
|
+
let Some(value) = self.frame().assign(binding, value) else {
|
|
459
573
|
return;
|
|
460
574
|
};
|
|
461
|
-
if self.globals.contains_key(
|
|
462
|
-
self.set_global(
|
|
575
|
+
if self.globals.contains_key(&binding) || self.session.bindings.contains_key(&binding) {
|
|
576
|
+
self.set_global(binding, value);
|
|
463
577
|
return;
|
|
464
578
|
}
|
|
465
|
-
self.declare(
|
|
579
|
+
self.declare(binding, value);
|
|
466
580
|
}
|
|
467
581
|
|
|
468
582
|
/// Returns an instance field from the current run or the constructor's initial value.
|
|
@@ -495,9 +609,9 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
495
609
|
}
|
|
496
610
|
}
|
|
497
611
|
|
|
498
|
-
fn set_global(&mut self,
|
|
499
|
-
let old = self.globals.insert(
|
|
500
|
-
self.journal.record(Undo::Global(
|
|
612
|
+
fn set_global(&mut self, binding: Binding<'ast>, value: Value<'ast>) {
|
|
613
|
+
let old = self.globals.insert(binding, value);
|
|
614
|
+
self.journal.record(Undo::Global(binding, old));
|
|
501
615
|
}
|
|
502
616
|
|
|
503
617
|
/// Starts a speculative attempt. [`Run::restore`] rolls it back; [`Run::release`] commits
|
|
@@ -554,7 +668,7 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
554
668
|
|
|
555
669
|
/// Returns the scope that a newly created function would capture.
|
|
556
670
|
pub(super) fn closure_scope(&mut self) -> Scope<'ast> {
|
|
557
|
-
let scope = self.
|
|
671
|
+
let scope = self.frame_mut().own_scope().clone();
|
|
558
672
|
if !self
|
|
559
673
|
.closed
|
|
560
674
|
.last()
|
|
@@ -578,10 +692,156 @@ impl<'ast, 'session> Run<'ast, 'session> {
|
|
|
578
692
|
|
|
579
693
|
/// Copies a session value for use by this run, preserving run-local sharing.
|
|
580
694
|
pub(super) fn isolate(&mut self, value: &Value<'ast>) -> Value<'ast> {
|
|
695
|
+
let frozen = self.frozen();
|
|
581
696
|
let Some(copies) = &mut self.copies else {
|
|
582
697
|
return value.clone();
|
|
583
698
|
};
|
|
584
|
-
copies::copy(value, copies)
|
|
699
|
+
copies::copy(value, copies, frozen)
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/// The session objects this run shares, if it shares them.
|
|
703
|
+
fn frozen(&self) -> Option<&'session Frozen> {
|
|
704
|
+
self.sharing.then_some(&self.session.frozen)
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/// Checks that the run may write to `object`. A write to a shared session object thaws its
|
|
708
|
+
/// group and stops the run, whose caller reruns the instruction with the group copied.
|
|
709
|
+
pub(super) fn writable(&mut self, object: &Value<'ast>) -> Evaluation<'ast, ()> {
|
|
710
|
+
if let Some(frozen) = self.frozen()
|
|
711
|
+
&& let Some(address) = frozen::address(object)
|
|
712
|
+
&& frozen.contains(address)
|
|
713
|
+
{
|
|
714
|
+
frozen.thaw(address);
|
|
715
|
+
self.thawed = true;
|
|
716
|
+
return Err(Stop::unsupported("a write to a shared session object"));
|
|
717
|
+
}
|
|
718
|
+
Ok(())
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/// Takes a snapshot of a handler run before top-level statement `statement`, with the
|
|
722
|
+
/// handler's `locals`. Returns `None` if the run is inside a speculative attempt or setup
|
|
723
|
+
/// changed which names are unavailable, which a snapshot does not restore.
|
|
724
|
+
pub(super) fn snapshot(
|
|
725
|
+
&self,
|
|
726
|
+
statement: usize,
|
|
727
|
+
locals: &[Option<Value<'ast>>],
|
|
728
|
+
) -> Option<Snapshot<'ast>> {
|
|
729
|
+
if self.journal.recording()
|
|
730
|
+
|| matches!(self.unavailable, Cow::Owned(_))
|
|
731
|
+
|| self.frames.len() != 1
|
|
732
|
+
|| self.setup.is_some()
|
|
733
|
+
|| self.constructed.is_none()
|
|
734
|
+
{
|
|
735
|
+
return None;
|
|
736
|
+
}
|
|
737
|
+
let mut fork = Fork::new(self.frozen());
|
|
738
|
+
let frame = self.frame();
|
|
739
|
+
Some(Snapshot {
|
|
740
|
+
statement,
|
|
741
|
+
decided: self.branches.decisions[..self.branches.decided].to_vec(),
|
|
742
|
+
registers: fork.map(&self.registers),
|
|
743
|
+
tags: fork.map(&self.tags),
|
|
744
|
+
fields: fork.map(&self.fields),
|
|
745
|
+
globals: fork.map(&self.globals),
|
|
746
|
+
copies: self.copies.as_ref().map(|copies| fork.copies(copies)),
|
|
747
|
+
closed: self.closed.iter().map(|scope| fork.scope(scope)).collect(),
|
|
748
|
+
effects: self.effects.clone(),
|
|
749
|
+
temps: self.temps,
|
|
750
|
+
conditions: self.branches.conditions.clone(),
|
|
751
|
+
facts: self
|
|
752
|
+
.facts
|
|
753
|
+
.iter()
|
|
754
|
+
.map(|(term, value)| (term.clone(), fork.value(value)))
|
|
755
|
+
.collect(),
|
|
756
|
+
this: fork.value(&frame.this),
|
|
757
|
+
scope: frame.scope.fork(&mut fork),
|
|
758
|
+
locals: locals
|
|
759
|
+
.iter()
|
|
760
|
+
.map(|local| local.as_ref().map(|value| fork.value(value)))
|
|
761
|
+
.collect(),
|
|
762
|
+
copied: fork.copied,
|
|
763
|
+
})
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/// A handler run resumed from `snapshot`, following `decisions`, whose first decisions are
|
|
767
|
+
/// the snapshot's. Returns the run, the handler's locals, and the scopes copied for it,
|
|
768
|
+
/// which the caller clears when the run ends.
|
|
769
|
+
pub(super) fn resume(
|
|
770
|
+
invocation: &Invocation<'session, 'ast>,
|
|
771
|
+
snapshot: &Snapshot<'ast>,
|
|
772
|
+
decisions: Vec<bool>,
|
|
773
|
+
) -> (Self, Vec<Option<Value<'ast>>>, Vec<Scope<'ast>>) {
|
|
774
|
+
let mut fork = Fork::new(Some(&invocation.session.frozen));
|
|
775
|
+
let copies = snapshot.copies.as_ref().map(|copies| fork.copies(copies));
|
|
776
|
+
let mut run = Self::invoked(invocation, decisions, copies);
|
|
777
|
+
run.registers = fork.map(&snapshot.registers);
|
|
778
|
+
run.tags = fork.map(&snapshot.tags);
|
|
779
|
+
run.fields = fork.map(&snapshot.fields);
|
|
780
|
+
run.globals = fork.map(&snapshot.globals);
|
|
781
|
+
run.closed = snapshot
|
|
782
|
+
.closed
|
|
783
|
+
.iter()
|
|
784
|
+
.map(|scope| fork.scope(scope))
|
|
785
|
+
.collect();
|
|
786
|
+
run.effects = snapshot.effects.clone();
|
|
787
|
+
run.temps = snapshot.temps;
|
|
788
|
+
run.branches.decided = snapshot.decided.len();
|
|
789
|
+
run.branches.conditions = snapshot.conditions.clone();
|
|
790
|
+
run.facts = snapshot
|
|
791
|
+
.facts
|
|
792
|
+
.iter()
|
|
793
|
+
.map(|(term, value)| (term.clone(), fork.value(value)))
|
|
794
|
+
.collect();
|
|
795
|
+
run.frames.push(Frame {
|
|
796
|
+
this: fork.value(&snapshot.this),
|
|
797
|
+
scope: snapshot.scope.fork(&mut fork),
|
|
798
|
+
});
|
|
799
|
+
let locals = snapshot
|
|
800
|
+
.locals
|
|
801
|
+
.iter()
|
|
802
|
+
.map(|local| local.as_ref().map(|value| fork.value(value)))
|
|
803
|
+
.collect();
|
|
804
|
+
(run, locals, fork.copied)
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/// A handler run's state before one of the top-level statements of its body. Paths that share
|
|
809
|
+
/// the decisions made before that statement resume here instead of rerunning the statements
|
|
810
|
+
/// before it.
|
|
811
|
+
pub(super) struct Snapshot<'ast> {
|
|
812
|
+
/// The top-level statement to resume at.
|
|
813
|
+
pub(super) statement: usize,
|
|
814
|
+
/// The decisions consumed before the statement.
|
|
815
|
+
decided: Vec<bool>,
|
|
816
|
+
registers: HashMap<u8, Value<'ast>>,
|
|
817
|
+
tags: HashMap<u8, Value<'ast>>,
|
|
818
|
+
fields: HashMap<String, Value<'ast>>,
|
|
819
|
+
globals: HashMap<Binding<'ast>, Value<'ast>>,
|
|
820
|
+
copies: Option<Copies<'ast>>,
|
|
821
|
+
closed: Vec<Scope<'ast>>,
|
|
822
|
+
effects: Vec<Effect>,
|
|
823
|
+
temps: usize,
|
|
824
|
+
conditions: Vec<(Term, bool)>,
|
|
825
|
+
facts: Vec<(Term, Value<'ast>)>,
|
|
826
|
+
this: Value<'ast>,
|
|
827
|
+
scope: CallScope<'ast>,
|
|
828
|
+
locals: Vec<Option<Value<'ast>>>,
|
|
829
|
+
/// Every scope the snapshot holds, cleared when it is dropped to break cycles.
|
|
830
|
+
copied: Vec<Scope<'ast>>,
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
impl Drop for Snapshot<'_> {
|
|
834
|
+
fn drop(&mut self) {
|
|
835
|
+
for scope in &self.copied {
|
|
836
|
+
scope.borrow_mut().variables.clear();
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
impl<'ast> Snapshot<'ast> {
|
|
842
|
+
/// Whether a run following `decisions` makes the same decisions before the statement.
|
|
843
|
+
pub(super) fn resumes(&self, decisions: &[bool]) -> bool {
|
|
844
|
+
decisions.starts_with(&self.decided)
|
|
585
845
|
}
|
|
586
846
|
}
|
|
587
847
|
|