Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-111485: Separate out parsing, analysis and code-gen phases #112299

Merged
merged 42 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
503f19a
Sort cases
markshannon Nov 16, 2023
be741bc
Reorganize code gen
markshannon Nov 16, 2023
56e5001
Add type annotations
markshannon Nov 20, 2023
3c35ba0
Various improvements to formatting
markshannon Nov 20, 2023
59bdeca
Revert to declaration ordering of instructions
markshannon Nov 20, 2023
d41dfa5
Tweak formatting
markshannon Nov 20, 2023
efdcda1
Don't treat newline at end of '//' comment as part of the comment
markshannon Nov 20, 2023
f2d6a21
Add back static asserts
markshannon Nov 20, 2023
2b593dc
Fix type annotation
markshannon Nov 20, 2023
0a329a8
Use argparse and support multiple input files
markshannon Nov 20, 2023
570d07a
Add support for line directives
markshannon Nov 20, 2023
bb18010
Tier 2 code gen. Work in progress
markshannon Nov 20, 2023
bbe3113
Merge branch 'main' into refactor-code-gen
markshannon Nov 20, 2023
bec93cf
Indent within parens to match the parens
markshannon Nov 20, 2023
8481bea
Fix indenting
markshannon Nov 20, 2023
c91e61a
Fix indenting
markshannon Nov 20, 2023
f76160c
Remove surplus whitespace
markshannon Nov 20, 2023
ae2baea
Remove extra blank line
markshannon Nov 22, 2023
92c9440
Attempt to placate MyPy
markshannon Nov 22, 2023
f9e41c6
Annotate false positives
markshannon Nov 22, 2023
ab2dbb3
Further attempts to make MyPy happy
markshannon Nov 22, 2023
21a018b
Remove white space
markshannon Nov 22, 2023
8078302
Fix newline and indentation handling
markshannon Nov 22, 2023
d5fcbed
Fix newline and indentation handling
markshannon Nov 22, 2023
6c1ed31
A couple more type annotations
markshannon Nov 22, 2023
fc0f6ed
Fix alignment of comments
markshannon Nov 22, 2023
39ebd6c
Avoid emitting blank lines
markshannon Nov 22, 2023
7b21025
Further changes to keep MyPy happy
markshannon Nov 22, 2023
796dcf6
Fix type annotation
markshannon Nov 22, 2023
2272937
Correct previous 'fix'
markshannon Nov 22, 2023
65b0c48
Fix type annotation
markshannon Nov 22, 2023
0ce4dd2
Fix up multi-line comments
markshannon Nov 22, 2023
54a727f
Tier 2 generator can wait for another PR
markshannon Nov 22, 2023
e0a4d35
Merge branch 'main' into refactor-code-gen
markshannon Nov 22, 2023
9a81bbe
Don't use old case generator for tier 1
markshannon Nov 22, 2023
28561cd
Avoid emitting unreachable code
markshannon Nov 22, 2023
30f3015
Format new files with black
markshannon Nov 23, 2023
5e01a73
Address review comments.
markshannon Nov 23, 2023
6aacaca
Tidy
markshannon Nov 23, 2023
19c9c1b
Add some explanatory comments
markshannon Nov 24, 2023
8e385f5
Address review comments
markshannon Nov 25, 2023
bb6d42f
Rerun black
markshannon Nov 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1587,14 +1587,15 @@ regen-cases:
$(PYTHON_FOR_REGEN) \
$(srcdir)/Tools/cases_generator/generate_cases.py \
$(CASESFLAG) \
-o $(srcdir)/Python/generated_cases.c.h.new \
markshannon marked this conversation as resolved.
Show resolved Hide resolved
-n $(srcdir)/Include/opcode_ids.h.new \
-t $(srcdir)/Python/opcode_targets.h.new \
-m $(srcdir)/Include/internal/pycore_opcode_metadata.h.new \
-e $(srcdir)/Python/executor_cases.c.h.new \
-p $(srcdir)/Lib/_opcode_metadata.py.new \
-a $(srcdir)/Python/abstract_interp_cases.c.h.new \
$(srcdir)/Python/bytecodes.c
$(PYTHON_FOR_REGEN) \
$(srcdir)/Tools/cases_generator/tier1_generator.py -o $(srcdir)/Python/generated_cases.c.h.new $(srcdir)/Python/bytecodes.c
$(UPDATE_FILE) $(srcdir)/Python/generated_cases.c.h $(srcdir)/Python/generated_cases.c.h.new
$(UPDATE_FILE) $(srcdir)/Include/opcode_ids.h $(srcdir)/Include/opcode_ids.h.new
$(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
Expand Down
3 changes: 2 additions & 1 deletion Python/abstract_interp_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,11 @@ dummy_func(
// We also push it onto the stack on exit, but that's a
// different frame, and it's accounted for by _PUSH_FRAME.
op(_POP_FRAME, (retval --)) {
assert(EMPTY());
#if TIER_ONE
assert(frame != &entry_frame);
#endif
STORE_SP();
assert(EMPTY());
_Py_LeaveRecursiveCallPy(tstate);
// GH-99729: We need to unlink the frame *before* clearing it:
_PyInterpreterFrame *dying = frame;
Expand Down Expand Up @@ -1165,7 +1165,6 @@ dummy_func(
}
}


inst(STORE_NAME, (v -- )) {
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
PyObject *ns = LOCALS();
Expand Down Expand Up @@ -3130,7 +3129,7 @@ dummy_func(
// The 'unused' output effect represents the return value
// (which will be pushed when the frame returns).
// It is needed so CALL_PY_EXACT_ARGS matches its family.
op(_PUSH_FRAME, (new_frame: _PyInterpreterFrame* -- unused)) {
op(_PUSH_FRAME, (new_frame: _PyInterpreterFrame* -- unused if (0))) {
// Write it out explicitly because it's subtly different.
// Eventually this should be the only occurrence of this code.
assert(tstate->interp->eval_frame == NULL);
Expand Down
2 changes: 1 addition & 1 deletion Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading