Skip to content

Commit a5d6fae

Browse files
committed
Fix crash
1 parent 644ad34 commit a5d6fae

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

Tools/cases_generator/analyzer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from parser import Stmt, SimpleStmt, BlockStmt, IfStmt, WhileStmt, ForStmt, MacroIfStmt
99

1010
MAX_GENERATED_CACHED_REGISTER = 5
11+
MAX_CACHED_REGISTER = 3 # Platform-specific; controls compile-time case pruning
1112

1213
@dataclass
1314
class EscapingCall:

Tools/cases_generator/uop_id_generator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Analysis,
1010
analyze_files,
1111
get_uop_cache_depths,
12+
MAX_CACHED_REGISTER,
1213
)
1314
from generators_common import (
1415
DEFAULT_INPUT,
@@ -48,6 +49,7 @@ def generate_uop_ids(
4849
next_id += 1
4950

5051
out.emit(f"#define MAX_UOP_ID {next_id-1}\n")
52+
out.emit(f"#define MAX_CACHED_REGISTER {MAX_CACHED_REGISTER}\n")
5153
for name, uop in sorted(uops):
5254
if uop.properties.tier == 1:
5355
continue

Tools/cases_generator/uop_metadata_generator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Analysis,
1010
analyze_files,
1111
get_uop_cache_depths,
12+
MAX_CACHED_REGISTER,
1213
Uop,
1314
)
1415
from generators_common import (
@@ -22,7 +23,6 @@
2223
from typing import TextIO
2324

2425
DEFAULT_OUTPUT = ROOT / "Include/internal/pycore_uop_metadata.h"
25-
MAX_CACHED_REGISTER = 3 # Specify this by different platform
2626

2727

2828
def uop_cache_info(uop: Uop) -> list[str] | None:
@@ -65,7 +65,6 @@ def uop_cache_info(uop: Uop) -> list[str] | None:
6565

6666

6767
def generate_names_and_flags(analysis: Analysis, out: CWriter) -> None:
68-
out.emit(f"#define MAX_CACHED_REGISTER {MAX_CACHED_REGISTER}\n")
6968
out.emit("extern const uint32_t _PyUop_Flags[MAX_UOP_ID+1];\n")
7069
out.emit("typedef struct _rep_range { uint8_t start; uint8_t stop; } ReplicationRange;\n")
7170
out.emit("extern const ReplicationRange _PyUop_Replication[MAX_UOP_ID+1];\n")

0 commit comments

Comments
 (0)