| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1316,7 +1316,7 @@ regen-limited-abi: all | |||
| 1316 | 1316 | # Regenerate all generated files | |
| 1317 | 1317 | ||
| 1318 | 1318 | .PHONY: regen-all | |
| 1319 | - regen-all: regen-cases regen-opcode regen-opcode-targets regen-typeslots \ | ||
| 1319 | + regen-all: regen-cases regen-opcode regen-typeslots \ | ||
| 1320 | 1320 | regen-token regen-ast regen-keyword regen-sre regen-frozen clinic \ | |
| 1321 | 1321 | regen-pegen-metaparser regen-pegen regen-test-frozenmain \ | |
| 1322 | 1322 | regen-test-levenshtein regen-global-objects | |
@@ -1428,8 +1428,10 @@ regen-opcode: | |||
| 1428 | 1428 | $(srcdir)/Lib/opcode.py \ | |
| 1429 | 1429 | $(srcdir)/Lib/_opcode_metadata.py \ | |
| 1430 | 1430 | $(srcdir)/Include/opcode.h.new \ | |
| 1431 | + $(srcdir)/Python/opcode_targets.h.new \ | ||
| 1431 | 1432 | $(srcdir)/Include/internal/pycore_opcode.h.new | |
| 1432 | 1433 | $(UPDATE_FILE) $(srcdir)/Include/opcode.h $(srcdir)/Include/opcode.h.new | |
| 1434 | + $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new | ||
| 1433 | 1435 | $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode.h $(srcdir)/Include/internal/pycore_opcode.h.new | |
| 1434 | 1436 | ||
| 1435 | 1437 | .PHONY: regen-token | |
@@ -1531,13 +1533,6 @@ Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS) | |||
| 1531 | 1533 | Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h | |
| 1532 | 1534 | Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h | |
| 1533 | 1535 | ||
| 1534 | - .PHONY: regen-opcode-targets | ||
| 1535 | - regen-opcode-targets: | ||
| 1536 | - # Regenerate Python/opcode_targets.h from Lib/opcode.py | ||
| 1537 | - # using Python/makeopcodetargets.py | ||
| 1538 | - $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \ | ||
| 1539 | - $(srcdir)/Python/opcode_targets.h.new | ||
| 1540 | - $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new | ||
| 1541 | 1536 | ||
| 1542 | 1537 | .PHONY: regen-cases | |
| 1543 | 1538 | regen-cases: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Remove the make target ``regen-opcode-targets``, merge its work into ``regen-opcode`` which repeats most of the calculation. This simplifies the code for the build and reduces code duplication. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,9 +59,7 @@ | |||
| 59 | 59 | Inputs="@(_OpcodeSources)" Outputs="@(_OpcodeOutputs)" | |
| 60 | 60 | DependsOnTargets="FindPythonForBuild"> | |
| 61 | 61 | <Message Text="Regenerate @(_OpcodeOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> | |
| 62 | - <Exec Command="$(PythonForBuild) Tools\build\generate_opcode_h.py Lib\opcode.py Lib\_opcode_metadata.py Include\opcode.h Include\internal\pycore_opcode.h Include\internal\pycore_intrinsics.h" | ||
| 63 | - WorkingDirectory="$(PySourcePath)" /> | ||
| 64 | - <Exec Command="$(PythonForBuild) Python\makeopcodetargets.py Python\opcode_targets.h" | ||
| 62 | + <Exec Command="$(PythonForBuild) Tools\build\generate_opcode_h.py Lib\opcode.py Lib\_opcode_metadata.py Include\opcode.h Python/opcode_targets.h Include\internal\pycore_opcode.h Include\internal\pycore_intrinsics.h" | ||
| 65 | 63 | WorkingDirectory="$(PySourcePath)" /> | |
| 66 | 64 | </Target> | |
| 67 | 65 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,7 @@ def get_python_module_dict(filename): | |||
| 64 | 64 | def main(opcode_py, | |
| 65 | 65 | _opcode_metadata_py='Lib/_opcode_metadata.py', | |
| 66 | 66 | outfile='Include/opcode.h', | |
| 67 | + opcode_targets_h='Python/opcode_targets.h', | ||
| 67 | 68 | internaloutfile='Include/internal/pycore_opcode.h'): | |
| 68 | 69 | ||
| 69 | 70 | _opcode_metadata = get_python_module_dict(_opcode_metadata_py) | |
@@ -161,9 +162,18 @@ def main(opcode_py, | |||
| 161 | 162 | fobj.write(footer) | |
| 162 | 163 | iobj.write(internal_footer) | |
| 163 | 164 | ||
| 165 | + with open(opcode_targets_h, "w") as f: | ||
| 166 | + targets = ["_unknown_opcode"] * 256 | ||
| 167 | + for op, name in enumerate(opname_including_specialized): | ||
| 168 | + if op < 256 and not name.startswith("<"): | ||
| 169 | + targets[op] = f"TARGET_{name}" | ||
| 170 | + | ||
| 171 | + f.write("static void *opcode_targets[256] = {\n") | ||
| 172 | + f.write(",\n".join([f" &&{s}" for s in targets])) | ||
| 173 | + f.write("\n};\n") | ||
| 164 | 174 | ||
| 165 | 175 | print(f"{outfile} regenerated from {opcode_py}") | |
| 166 | 176 | ||
| 167 | 177 | ||
| 168 | 178 | if __name__ == '__main__': | |
| 169 | - main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) | ||
| 179 | + main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments