New issue 2926: pypy6.0 AssertionError if added --objspace-std-withprebuiltint
option
https://bitbucket.org/pypy/pypy/issues/2926/pypy60-assertionerror-if-added-objspace
zhang yao:
Hello, We are using pypy6.0 for our project, But when we turn on the
withprebuiltin translation-option, there is a certain probability that a crash
will occur.
```
#!python
RPython traceback:
File "rpython_jit_metainterp_10.c", line 43844, in send_bridge_to_backend
File "rpython_jit_backend_x86_3.c", line 28386, in
Assembler386_assemble_bridge
File "rpython_jit_backend_x86.c", line 5467, in Assembler386__assemble
File "rpython_jit_backend_x86.c", line 11251, in RegAlloc_walk_operations
File "rpython_jit_backend_x86.c", line 36521, in RegAlloc_consider_jump
File "rpython_jit_backend_x86_1.c", line 9786, in remap_frame_layout_mixed
File "rpython_jit_backend_x86_1.c", line 30440, in remap_frame_layout
File "rpython_jit_backend_x86_1.c", line 23989, in
MachineCodeBlockWrapper_INSN_MOVSD
File "rpython_jit_backend_x86.c", line 14167, in _missing_binary_insn
Fatal RPython error: AssertionError
```
Aborted (core dumped)
Then I have tried to summarize a simple piece of code, which is
reproducible, running it will definitely crash immediately:
```
#!python
######################################
data = [
{"a": 0, "b": 1, "c": 2},
{"a": 0, "b": 1.0, "c": 2},
]
def GetTotalScore(score_map):
totalScore = 0
for score in score_map.itervalues():
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
######################################
```
PS:
1.My test enviroment and tools :
OS : Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64
GNU/Linux
C compiler: gcc 4.9.2
2.The versions of pypy I tested:
1)pypy 6.0.0 statble released
2)the official default branch src (hg updated to: changeset:
95388:c8b8ee6787e9, date:Fri Nov 30 16:20:08 2018 +0100)
both of them cause the same crash.
3.My translation script:
python ../../rpython/bin/rpython --opt=jit --verbose --make-jobs=16
targetpypystandalone --objspace-std-withprebuiltint
4.There is no problem without option: --objspace-std-withprebuiltint
We only open this option for testing.
5.Following are similar examples, which are only a little different from the
code above, but run well all, no crash occured, these maybe have some
reference values for delevlop-team to find the problem.
#non-crash-example1:
```
#!python
data = [
{"a": 0, "b": 1, "c": 2.0}, #"c" value type modified as float
{"a": 0, "b": 1.0, "c": 2.0}, #"c" value type modified as float
]
def GetTotalScore(score_map):
totalScore = 0
for score in score_map.itervalues():
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
```
#non-crash-example2:
```
#!python
data = [
{"a": 0, "b": 1.0, "c": 2.0}, #"b" value type modified as float
{"a": 0, "b": 1, "c": 2.0}, #"b" value type modified as int
]
def GetTotalScore(score_map):
totalScore = 0
for score in score_map.itervalues():
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
```
#non-crash-example3:
```
#!python
[data = [
{"a": 0, "b": 1.0}, #item count modified
{"a": 0, "b": 1}, #item count modified
]
def GetTotalScore(score_map):
totalScore = 0
for score in score_map.itervalues():
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
```
#non-crash-example4:
```
#!python
data = [
{"a": 0, "b": 1.0, "c": 2.0},
{"a": 0, "b": 1, "c": 2.0},
]
def GetTotalScore(score_map):
totalScore = 0.0 #modify init value type as float
for score in score_map.itervalues():
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
```
#non-crash-example5:
```
#!python
data = [
{"a": 0, "b": 1.0, "c": 2.0},
{"a": 0, "b": 1, "c": 2.0},
]
def GetTotalScore(score_map):
totalScore = 0
for score in score_map.values():# modify walking target as list
totalScore += score
return totalScore
def foo():
for d in data:
GetTotalScore(d)
while True:
foo()
```
Think you.
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue