(
filenames: list[str], analysis: Analysis, outfile: TextIO, lines: bool
)
| 147 | """ |
| 148 | |
| 149 | def generate_tier1( |
| 150 | filenames: list[str], analysis: Analysis, outfile: TextIO, lines: bool |
| 151 | ) -> None: |
| 152 | write_header(__file__, filenames, outfile) |
| 153 | outfile.write(""" |
| 154 | #ifdef TIER_TWO |
| 155 | #error "This file is for Tier 1 only" |
| 156 | #endif |
| 157 | #define TIER_ONE 1 |
| 158 | """) |
| 159 | outfile.write(f""" |
| 160 | #if !_Py_TAIL_CALL_INTERP |
| 161 | #if !USE_COMPUTED_GOTOS |
| 162 | dispatch_opcode: |
| 163 | switch (dispatch_code) |
| 164 | #endif |
| 165 | {{ |
| 166 | #endif /* _Py_TAIL_CALL_INTERP */ |
| 167 | {INSTRUCTION_START_MARKER} |
| 168 | """ |
| 169 | ) |
| 170 | generate_tier1_cases(analysis, outfile, lines) |
| 171 | outfile.write(f""" |
| 172 | {INSTRUCTION_END_MARKER} |
| 173 | #if !_Py_TAIL_CALL_INTERP |
| 174 | #if USE_COMPUTED_GOTOS |
| 175 | _unknown_opcode: |
| 176 | #else |
| 177 | EXTRA_CASES // From pycore_opcode_metadata.h, a 'case' for each unused opcode |
| 178 | #endif |
| 179 | /* Tell C compilers not to hold the opcode variable in the loop. |
| 180 | next_instr points the current instruction without TARGET(). */ |
| 181 | opcode = next_instr->op.code; |
| 182 | {UNKNOWN_OPCODE_HANDLER} |
| 183 | |
| 184 | }} |
| 185 | |
| 186 | /* This should never be reached. Every opcode should end with DISPATCH() |
| 187 | or goto error. */ |
| 188 | Py_UNREACHABLE(); |
| 189 | #endif /* _Py_TAIL_CALL_INTERP */ |
| 190 | {LABEL_START_MARKER} |
| 191 | """) |
| 192 | out = CWriter(outfile, 2, lines) |
| 193 | emitter = Emitter(out, analysis.labels) |
| 194 | generate_tier1_labels(analysis, emitter) |
| 195 | outfile.write(f"{LABEL_END_MARKER}\n") |
| 196 | outfile.write(FOOTER) |
| 197 | |
| 198 | |
| 199 |
no test coverage detected
searching dependent graphs…