CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[SOT][3.13] add LOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests files
#69196
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
Conversation
…_LOAD_FAST` and add skip tests files
你的PR提交成功,感谢你对开源项目的贡献! |
self.fused_load_store(instr) | ||
|
||
def STORE_FAST_LOAD_FAST(self, instr: Instruction): | ||
self.fused_load_store(instr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接在预处理字节码的时候拆一下吧
def expand_super_instrs(instructions: list[Instruction]) -> list[Instruction]:
expanded_instrs = []
def replace_jump_target(instrs, old_target, new_target):
for instr in instrs:
if instr.jump_to == old_target:
instr.jump_to = new_target
for instr in instructions:
if instr.opname == "LOAD_FAST_LOAD_FAST":
instr1 = Instruction(
opcode=dis.opmap["LOAD_FAST"],
opname="LOAD_FAST",
arg=instr.arg >> 4,
argval=instr.argval[0],
offset=instr.offset,
starts_line=instr.starts_line,
is_jump_target=instr.is_jump_target,
jump_to=instr.jump_to,
is_generated=True,
)
instr2 = Instruction(
opcode=dis.opmap["LOAD_FAST"],
opname="LOAD_FAST",
arg=instr.arg & 15,
argval=instr.argval[1],
offset=instr.offset,
starts_line=instr.starts_line,
is_jump_target=instr.is_jump_target,
jump_to=instr.jump_to,
is_generated=True,
)
replace_jump_target(instructions, instr, instr1)
expanded_instrs.append(instr1)
expanded_instrs.append(instr2)
else:
expanded_instrs.append(instr)
return expanded_instrs
LOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests filesLOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests files
@@ -91,6 +91,98 @@ def convert_instruction(instr: dis.Instruction) -> Instruction: | |||
) | |||
|
|||
|
|||
def expand_super_instrs(instructions: list[Instruction]) -> list[Instruction]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if instr.jump_to == old_target: | ||
instr.jump_to = new_target | ||
|
||
def _gen_instr(instr, opname, argval, arg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _gen_instr(instr, opname, argval, arg): | |
def copy_instruction(instr, opname, argval, arg): |
if instr.opname == "LOAD_FAST_LOAD_FAST": | ||
instr1 = _gen_instr( | ||
instr, "LOAD_FAST", instr.argval[0], instr.arg >> 4 | ||
) | ||
instr2 = _gen_instr( | ||
instr, "LOAD_FAST", instr.argval[1], instr.arg & 15 | ||
) | ||
replace_jump_target(instructions, instr, instr1) | ||
expanded_instrs.append(instr1) | ||
expanded_instrs.append(instr2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块不用写三次吧?写一个 map 就可以了
arg=arg, | ||
argval=argval, | ||
is_jump_target=instr.is_jump_target, | ||
is_generated=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_generated=True, | |
is_generated=False, |
False 吧?
opname=opname, | ||
arg=arg, | ||
argval=argval, | ||
is_jump_target=instr.is_jump_target, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
第一个是 instr.is_jump_target
,第二个是 False
,不能直接 copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests filesLOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests files
LOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests filesLOAD_FAST_LOAD_FAST
、 STORE_FAST_STORE_FAST
、 STORE_FAST_LOAD_FAST
and add skip tests files
PR Category
Execute Infrastructure
PR Types
Performance
Description
LOAD_FAST_LOAD_FAST
、STORE_FAST_STORE_FAST
、STORE_FAST_LOAD_FAST
三个字节码