GH-93897: Store frame size in code object and de-opt if insufficient space on thread frame stack. (GH-93908)

This commit is contained in:
Mark Shannon 2022-06-20 12:59:25 +01:00 committed by GitHub
parent 774ef28814
commit 45e62a2bc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 67 deletions

View file

@ -118,6 +118,7 @@ class Printer:
self.write('#include "Python.h"')
self.write('#include "internal/pycore_gc.h"')
self.write('#include "internal/pycore_code.h"')
self.write('#include "internal/pycore_frame.h"')
self.write('#include "internal/pycore_long.h"')
self.write("")
@ -256,6 +257,7 @@ class Printer:
self.field(code, "co_argcount")
self.field(code, "co_posonlyargcount")
self.field(code, "co_kwonlyargcount")
self.write(f".co_framesize = {code.co_stacksize + len(localsplusnames)} + FRAME_SPECIALS_SIZE,")
self.field(code, "co_stacksize")
self.field(code, "co_firstlineno")
self.write(f".co_nlocalsplus = {len(localsplusnames)},")