Commit 88a5489
committed
Mark frames as escaped even when the first escape happens after the transition to cached.
Traceback collection counted frames during exception unwinding, but did not
mark them as escaped. In uncached execution, we had the PFrame.Reference links
unconditionally, so this worked when it happened then, and we marked the root
as needing the PFrame.Reference link, so on later cached calls we have them.
But if we raise and escape the frame for the very first time when already
cached we did not preserve the f_back chain and could not reconstruct it
properly later.
This change makes the frames that belong to a traceback mark their current
PFrame.Reference as escaped while the exception is unwinding and the
VirtualFrame is thus still on the stack. The CalleeContext#exit logic then
materializes the frame and propagates to caller frames and this preserves the
f_back chain.
This can be triggered by forcing immediately cached execution, but a regression
test covers the case where functions first transition to cached execution
without raising, then later raises after some time (presumably after we
transitioned to cached) and inspect traceback backrefs.1 parent 73a9cec commit 88a5489
3 files changed
Lines changed: 33 additions & 2 deletions
File tree
- graalpython
- com.oracle.graal.python.test/src/tests
- com.oracle.graal.python/src/com/oracle/graal/python
- nodes/bytecode_dsl
- runtime/exception
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
241 | 259 | | |
242 | 260 | | |
243 | 261 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
366 | 378 | | |
367 | 379 | | |
368 | 380 | | |
| |||
401 | 413 | | |
402 | 414 | | |
403 | 415 | | |
404 | | - | |
| 416 | + | |
405 | 417 | | |
406 | 418 | | |
| 419 | + | |
407 | 420 | | |
408 | 421 | | |
409 | 422 | | |
| |||
0 commit comments