Commit 7e0331c
authored
Debugging: refactor stack frame cursor into frame handle abstraction. (#12566)
* Debugging: refactor stack frame cursor into frame handle abstraction.
This addresses some of the issues described #12486: we need the ability
to keep a handle to a stack frame as long as execution is frozen, and
keep multiple of these handles around, alongside the `Store`, without
any handle directly holding a borrow of the store.
The frame handles work by means of an "execution version" scheme: the
idea is that whenever any execution resumes in a given store, all
handles to existing frames could be invalidated, but if no such
execution occurs, all handles should still be valid. A tuple of
(globally unique for process lifetime) store ID, and execution version
within that store, should be sufficient to uniquely identify any
frozen-stack period during execution. This accomplishes cheap handle
invalidation without the need to track existing handles.
This PR also implements a cache of parsed frame-table data. Previously
this was lazily parsed by the cursor as it walked up a stack, but with
multiple handles hanging around, and with handles meant to be cheap to
hold and clone, and with handles being invalidated eagerly, it makes
much more sense to persist this parsed metadata at the `Store` level.
(It cannot persist at the `Engine` level because PCs are local per
store.)
* Re-bless disas tests (offsets in VMStoreContext changed).
* Handle invalidation tests.
* Review comments, and make API return `Result`s rather than panic'ing on stale handles.
* Review feedback.
* Doc-comment link fix.
* Review feedback.
* cfg-gate Activation method to `debug` feature only.
* Fix unused-import warning in no-debug cfg.
* Fix doc link (again, after rename from latest feedback).1 parent 3623501 commit 7e0331c
1,857 files changed
Lines changed: 3658 additions & 3369 deletions
File tree
- crates
- cranelift/src
- debugger/src
- environ/src
- unwinder/src
- wasmtime/src
- runtime
- vm
- traphandlers
- tests
- all
- disas
- component-model
- gc
- drc
- null
- load-store
- s390x
- stack-switching
- winch
- aarch64
- br_if
- br_table
- br
- call_indirect
- call
- f32_abs
- f32_add
- f32_ceil
- f32_convert_i32_s
- f32_convert_i32_u
- f32_convert_i64_s
- f32_convert_i64_u
- f32_copysign
- f32_demote_f64
- f32_div
- f32_eq
- f32_floor
- f32_ge
- f32_gt
- f32_le
- f32_lt
- f32_max
- f32_min
- f32_mul
- f32_nearest
- f32_neg
- f32_ne
- f32_reinterpret_i32
- f32_sqrt
- f32_sub
- f32_trunc
- f64_abs
- f64_add
- f64_ceil
- f64_convert_i32_s
- f64_convert_i32_u
- f64_convert_i64_s
- f64_convert_i64_u
- f64_copysign
- f64_div
- f64_eq
- f64_floor
- f64_ge
- f64_gt
- f64_le
- f64_lt
- f64_max
- f64_min
- f64_mul
- f64_nearest
- f64_neg
- f64_ne
- f64_promote_f32
- f64_reinterpret_i64
- f64_sqrt
- f64_sub
- f64_trunc
- i32_add
- i32_and
- i32_clz
- i32_ctz
- i32_divs
- i32_divu
- i32_eq
- i32_extend_16_s
- i32_extend_8_s
- i32_ge_s
- i32_ge_u
- i32_gt_s
- i32_gt_u
- i32_le_s
- i32_le_u
- i32_lt_s
- i32_lt_u
- i32_mul
- i32_ne
- i32_or
- i32_popcnt
- i32_reinterpret_f32
- i32_rems
- i32_remu
- i32_rotl
- i32_rotr
- i32_shl
- i32_shr_s
- i32_shr_u
- i32_sub
- i32_trunc_f32_s
- i32_trunc_f32_u
- i32_trunc_f64_s
- i32_trunc_f64_u
- i32_wrap_i64
- i32_xor
- i64_add
- i64_and
- i64_clz
- i64_ctz
- i64_divs
- i64_divu
- i64_eq
- i64_extend_16_s
- i64_extend_32_s
- i64_extend_8_s
- i64_extend_i32_s
- i64_extend_i32_u
- i64_ge_s
- i64_ge_u
- i64_gt_s
- i64_gt_u
- i64_le_s
- i64_le_u
- i64_lt_s
- i64_lt_u
- i64_mul
- i64_ne
- i64_or
- i64_popcnt
- i64_reinterpret_f64
- i64_rems
- i64_remu
- i64_rotl
- i64_rotr
- i64_shl
- i64_shr_s
- i64_shr_u
- i64_sub
- i64_trunc_f32_s
- i64_trunc_f32_u
- i64_trunc_f64_s
- i64_trunc_f64_u
- i64_xor
- load
- nop
- params
- store
- x64
- atomic
- fence
- load
- notify
- rmw
- add
- and
- cmpxchg
- or
- sub
- xchg
- xor
- store
- wait
- block
- br_if
- br_table
- br
- call_indirect
- call
- epoch
- f32_abs
- f32_add
- f32_ceil
- f32_const
- f32_convert_i32_s
- f32_convert_i32_u
- f32_convert_i64_s
- f32_convert_i64_u
- f32_copysign
- f32_demote_f64
- f32_div
- f32_eq
- f32_floor
- f32_ge
- f32_gt
- f32_le
- f32_lt
- f32_max
- f32_min
- f32_mul
- f32_nearest
- f32_neg
- f32_ne
- f32_reinterpret_i32
- f32_sqrt
- f32_sub
- f32_trunc
- f32x4_abs
- f32x4_add
- f32x4_ceil
- f32x4_convert_i32x4_s
- f32x4_convert_i32x4_u
- f32x4_demote_f64x2_zero
- f32x4_div
- f32x4_eq
- f32x4_extract_lane
- f32x4_floor
- f32x4_ge
- f32x4_gt
- f32x4_le
- f32x4_lt
- f32x4_max
- f32x4_min
- f32x4_mul
- f32x4_nearest
- f32x4_neg
- f32x4_ne
- f32x4_pmax
- f32x4_pmin
- f32x4_replace_lane
- f32x4_splat
- f32x4_sqrt
- f32x4_sub
- f32x4_trunc
- f64_abs
- f64_add
- f64_ceil
- f64_const
- f64_convert_i32_s
- f64_convert_i32_u
- f64_convert_i64_s
- f64_convert_i64_u
- f64_copysign
- f64_div
- f64_eq
- f64_floor
- f64_ge
- f64_gt
- f64_le
- f64_lt
- f64_max
- f64_min
- f64_mul
- f64_nearest
- f64_neg
- f64_ne
- f64_promote_f32
- f64_reinterpret_i64
- f64_sqrt
- f64_sub
- f64_trunc
- f64x2_abs
- f64x2_add
- f64x2_ceil
- f64x2_convert_low_i32x4_s
- f64x2_convert_low_i32x4_u
- f64x2_div
- f64x2_eq
- f64x2_extract_lane
- f64x2_floor
- f64x2_ge
- f64x2_gt
- f64x2_le
- f64x2_lt
- f64x2_max
- f64x2_min
- f64x2_mul
- f64x2_nearest
- f64x2_neg
- f64x2_ne
- f64x2_pmax
- f64x2_pmin
- f64x2_promote_low_f32x4
- f64x2_replace_lane
- f64x2_splat
- f64x2_sqrt
- f64x2_sub
- f64x2_trunc
- fuel
- i16x8_abs
- i16x8_all_true
- i16x8_avgr_u
- i16x8_bitmask
- i16x8_eq
- i16x8_extend_high_i8x16_s
- i16x8_extend_high_i8x16_u
- i16x8_extend_low_i8x16_s
- i16x8_extend_low_i8x16_u
- i16x8_ge_s
- i16x8_ge_u
- i16x8_gt_s
- i16x8_gt_u
- i16x8_le_s
- i16x8_le_u
- i16x8_lt_s
- i16x8_lt_u
- i16x8_narrow_i32x4_s
- i16x8_narrow_i32x4_u
- i16x8_ne
- i16x8_q15mulr_sat_s
- i16x8
- add
- extadd
- extmul
- extract_lane_s
- extract_lane_u
- max
- min
- mul
- neg
- replace_lane
- shift
- splat
- sub
- i32_add
- i32_and
- i32_clz
- i32_ctz
- i32_divs
- i32_divu
- i32_eqz
- i32_eq
- i32_extend_16_s
- i32_extend_8_s
- i32_ge_s
- i32_ge_u
- i32_gt_s
- i32_gt_u
- i32_le_s
- i32_le_u
- i32_lt_s
- i32_lt_u
- i32_mul
- i32_ne
- i32_or
- i32_popcnt
- i32_reinterpret_f32
- i32_rems
- i32_remu
- i32_rotl
- i32_rotr
- i32_shl
- i32_shr_s
- i32_shr_u
- i32_sub
- i32_trunc_f32_s
- i32_trunc_f32_u
- i32_trunc_f64_s
- i32_trunc_f64_u
- i32_wrap_i64
- i32_xor
- i32x4_abs
- i32x4_all_true
- i32x4_bitmask
- i32x4_dot_i16x8_s
- i32x4_eq
- i32x4_extend_high_i16x8_s
- i32x4_extend_high_i16x8_u
- i32x4_extend_low_i16x8_s
- i32x4_extend_low_i16x8_u
- i32x4_ge_s
- i32x4_ge_u
- i32x4_gt_s
- i32x4_gt_u
- i32x4_le_s
- i32x4_le_u
- i32x4_lt_s
- i32x4_lt_u
- i32x4_ne
- i32x4_trunc_sat_f32x4_s
- i32x4_trunc_sat_f32x4_u
- i32x4_trunc_sat_f64x2_s_zero
- i32x4_trunc_sat_f64x2_u_zero
- i32x4
- add
- extadd
- extmul
- extract_lane
- max
- min
- mul
- neg
- replace_lane
- shift
- splat
- sub
- i64_add
- i64_and
- i64_clz
- i64_ctz
- i64_divs
- i64_divu
- i64_eqz
- i64_eq
- i64_extend_16_s
- i64_extend_32_s
- i64_extend_8_s
- i64_extend_i32_s
- i64_extend_i32_u
- i64_ge_s
- i64_ge_u
- i64_gt_s
- i64_gt_u
- i64_le_s
- i64_le_u
- i64_lt_s
- i64_lt_u
- i64_mul
- i64_ne
- i64_or
- i64_popcnt
- i64_reinterpret_f64
- i64_rems
- i64_remu
- i64_rotl
- i64_rotr
- i64_shl
- i64_shr_s
- i64_shr_u
- i64_sub
- i64_trunc_f32_s
- i64_trunc_f32_u
- i64_trunc_f64_s
- i64_trunc_f64_u
- i64_xor
- i64x2_abs
- i64x2_all_true
- i64x2_bitmask
- i64x2_eq
- i64x2_extend_high_i32x4_s
- i64x2_extend_high_i32x4_u
- i64x2_extend_low_i32x4_s
- i64x2_extend_low_i32x4_u
- i64x2_ge_s
- i64x2_gt_s
- i64x2_le_s
- i64x2_lt_s
- i64x2_ne
- i64x2
- add
- extmul
- extract_lane
- mul
- neg
- replace_lane
- shift
- splat
- sub
- i8x16_abs
- i8x16_all_true
- i8x16_avgr_u
- i8x16_bitmask
- i8x16_eq
- i8x16_ge_s
- i8x16_ge_u
- i8x16_gt_s
- i8x16_gt_u
- i8x16_le_s
- i8x16_le_u
- i8x16_lt_s
- i8x16_lt_u
- i8x16_narrow_i16x8_s
- i8x16_narrow_i16x8_u
- i8x16_ne
- i8x16_popcnt
- i8x16
- add
- extract_lane_s
- extract_lane_u
- max
- min
- neg
- replace_lane
- shift
- shuffle
- splat
- sub
- swizzle
- if
- load
- local
- loop
- nop
- return
- select
- store
- table
- unreachable
- v128_const
- v128_ops
- load_lane
- store_lane
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
437 | 463 | | |
438 | 464 | | |
| 465 | + | |
| 466 | + | |
439 | 467 | | |
440 | 468 | | |
441 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
512 | 526 | | |
513 | 527 | | |
514 | 528 | | |
515 | 529 | | |
516 | 530 | | |
517 | 531 | | |
518 | 532 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
531 | 559 | | |
532 | 560 | | |
533 | 561 | | |
534 | 562 | | |
535 | 563 | | |
536 | 564 | | |
537 | 565 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
551 | 593 | | |
552 | 594 | | |
553 | 595 | | |
554 | 596 | | |
555 | 597 | | |
556 | 598 | | |
557 | 599 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
570 | 626 | | |
571 | 627 | | |
572 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
187 | | - | |
| 194 | + | |
188 | 195 | | |
189 | 196 | | |
190 | 197 | | |
| |||
0 commit comments