| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Sorry, something went wrong.
| _tmp_3 = res; | ||
| } | ||
| next_instr += 5; | ||
| static_assert(INLINE_CACHE_ENTRIES_OP == 5, "incorrect cache size"); |
There was a problem hiding this comment.
It isn't clear to me how/where the INLINE_CACHE_ENTRIES_OP instruction is generated.
Changing the test to pass w/o understanding doesn't inspire confidence on my end so any guidance or explanation here is greatly appreciated.
Sorry, something went wrong.
There was a problem hiding this comment.
It is the second parameter to family.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you! I hope I've given you enough hints on what to do about the static assert -- if not, let me know.
Sorry, something went wrong.
| } | ||
|
|
||
| case TO_BOOL_ALWAYS_TRUE: { | ||
| static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size"); |
There was a problem hiding this comment.
While it works, I think it's better to keep the static assert in the "family head".
Sorry, something went wrong.
There was a problem hiding this comment.
This still isn't resolved?
Sorry, something went wrong.
There was a problem hiding this comment.
No, I think this might be related to the change in Lib/_opcode_metadata.pyas well; the op from the family name isn't getting inserted into instrs
I'm having some trouble getting the name into instrs / parsed as an instruction. Any advice?
Sorry, something went wrong.
| _tmp_3 = res; | ||
| } | ||
| next_instr += 5; | ||
| static_assert(INLINE_CACHE_ENTRIES_OP == 5, "incorrect cache size"); |
There was a problem hiding this comment.
It is the second parameter to family.
Sorry, something went wrong.
…06.29zp8E.rst Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
There was a problem hiding this comment.
I think you pushed a rebase? Please don't do that once review is in progress -- everything will be squashed when we merge into main.
Can you look into moving the static_assert back to the family head?
And I'm unsure why the metadata file was truncated. (Let me know if you need help figuring this out.)
Sorry, something went wrong.
| "STORE_SUBSCR_DICT", | ||
| "STORE_SUBSCR_LIST_INT", | ||
| ], | ||
| "SEND": [ |
There was a problem hiding this comment.
That this file changed surprises me. Maybe this points to a problem?
Sorry, something went wrong.
There was a problem hiding this comment.
It didn't change originally, I think only after 178e300 ?
Sorry, something went wrong.
| } | ||
|
|
||
| case TO_BOOL_ALWAYS_TRUE: { | ||
| static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size"); |
There was a problem hiding this comment.
This still isn't resolved?
Sorry, something went wrong.
| if family.name not in self.macro_instrs and family.name not in self.instrs: | ||
| self.error( | ||
| f"Family {family.name!r} has unknown instruction {family.name!r}", | ||
| family, | ||
| ) |
There was a problem hiding this comment.
Good catch!
Sorry, something went wrong.
Ya there was a conflict in one of the header files so I rebased and re-generated it. Will keep that in mind next time. |
Sorry, something went wrong.
The missing part of the metadata will be reconstructed if you simply run make regen-cases and then commit the resulting changes to Lib/_opcode_metadata.py. Not sure yet why the stat asserts moved, will look into it later. (Did you find where they are generated?) |
Sorry, something went wrong.
Yes, https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L1555 I had changed this on my local from .members[0] to family.name but: This condition is always falsy because last_instr.family is None on the instruction used as family.name. That instruction misses in map_families (https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L835) because it isn't added to the instrs in parse_file https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L787 I'm thinking that there would be far fewer changes to generate_cases while keeping the desired syntax for a family template if the family name was added to the members here https://github.com/python/cpython/blob/main/Tools/cases_generator/parser.py#L347 eg ..., [tkn.txt] + members I considered just starting fresh from there but thought I would check given we've been back and forth on this implementation for a couple days. |
Sorry, something went wrong.
Interesting idea. It would mean fewer changes, but some of the ugliness would remain as well (e.g. the several places where you have to slice .members[1:]). As you point out, the problem is that the family head doesn't have self.family set to the family whose head it is. I think this will fix it: diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py
index 48c082a429..4756f50b8f 100644
--- a/Tools/cases_generator/generate_cases.py
+++ b/Tools/cases_generator/generate_cases.py
@@ -438,7 +438,7 @@ def write(self, out: Formatter, tier: Tiers = TIER_ONE) -> None:
"""Write one instruction, sans prologue and epilogue."""
# Write a static assertion that a family's cache size is correct
if family := self.family:
- if self.name == family.members[0]:
+ if self.name == family.name:
if cache_size := family.size:
out.emit(
f"static_assert({cache_size} == "
@@ -831,7 +831,7 @@ def find_predictions(self) -> None:
def map_families(self) -> None:
"""Link instruction names back to their family, if they have one."""
for family in self.families.values():
- for member in family.members:
+ for member in [family.name] + family.members:
if member_instr := self.instrs.get(member):
if member_instr.family not in (family, None):
self.error( |
Sorry, something went wrong.
|
Awesome! I’ll get everything cleaned up in a little bit.
…On Sat, Jul 15, 2023 at 14:15 Guido van Rossum ***@***.***> wrote:
I'm thinking that there would be far fewer changes to generate_cases
while keeping the desired syntax for a family template if the family name
was added to the members here
https://github.com/python/cpython/blob/main/Tools/cases_generator/parser.py#L347
eg ..., [tkn.txt] + members
I considered just starting fresh from there but thought I would check
given we've been back and forth on this implementation for a couple days.
Interesting idea. It would mean fewer changes, but some of the ugliness
would remain as well (e.g. the several places where you have to slice
.members[1:]).
As you point out, the problem is that the family head doesn't have
self.family set to the family whose head it is. I think this will fix it:
diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py
index 48c082a429..4756f50b8f 100644--- a/Tools/cases_generator/generate_cases.py+++ b/Tools/cases_generator/generate_cases.py@@ -438,7 +438,7 @@ def write(self, out: Formatter, tier: Tiers = TIER_ONE) -> None:
"""Write one instruction, sans prologue and epilogue."""
# Write a static assertion that a family's cache size is correct
if family := self.family:- if self.name == family.members[0]:+ if self.name == family.name:
if cache_size := family.size:
out.emit(
f"static_assert({cache_size} == "@@ -831,7 +831,7 @@ def find_predictions(self) -> None:
def map_families(self) -> None:
"""Link instruction names back to their family, if they have one."""
for family in self.families.values():- for member in family.members:+ for member in [family.name] + family.members:
if member_instr := self.instrs.get(member):
if member_instr.family not in (family, None):
self.error(
—
Reply to this email directly, view it on GitHub
<#106716 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEAQ5K6WG2BKIGMCJN7VFDXQLM4FANCNFSM6AAAAAA2I2HEUA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sorry, something went wrong.
I committed those changes but I'd actually outlined them in my previous comment:
family.name is never mapped because it isn't present in self.instrs; This results in the assertion never being emitted. |
Sorry, something went wrong.
Looks like the generated headers are now correct / unchanged and the test is testing for a macro instruction and what I described above is still missing here https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L1555 But the generated header files after that change are correct. Makes a lot more sense now why the macro isn't in self.instrs, wasn't thinking about it correctly before. Still unsure of what to do or if the test is wrong. |
Sorry, something went wrong.
Got it! Instead of checking the last instruction, get the family from self.families |
Sorry, something went wrong.
There was a problem hiding this comment.
Perfect! I'll merge.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.