Mercury Bugs - mercury
View Issue Details
0000028mercuryBugpublic2007-11-15 12:282007-11-19 17:37
Reporterobo 
Assigned Tozs 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000028: Unexpected: adjust_livevals
DescriptionHi,

I've come across a bug in tail recursion optimization (my guess) if foreign code is involved.

Typing 'make' in the testcase provided, mmc dies with this message:

Uncaught Mercury exception:
Software Error: jumpopt.m: Unexpected: adjust_livevals: BetweenLivevals and PrevLivevals differ
Stack dump not available in this grade.

If you explicitly prevent tail recursion by uncommenting the line:

    % io.write_string("", !IO), % prevent tail recursion

at the end of testxmlreader.m, the code compiles, runs (and wastes quite some time, performance is 10x worse than same xmlreader demo implemented in C). I'm not sure if I can attribute all the performance loss to stack management and the extra boxing and unboxing.

If I fake all the calls to xmlreader, as in:

testxmlreader.m-no-C-code (to replace testxmlreader.m)

the jumpopt exception goes away.

Thanks, Ondrej.
TagsNo tags attached.
Attached Filestgz bug.tgz (1,939) 2007-11-15 12:28
https://bugs.mercurylang.org/file_download.php?file_id=20&type=bug

Notes
(0000059)
zs   
2007-11-19 17:37   
fix posted nov 19

Issue History
2007-11-15 12:28oboNew Issue
2007-11-15 12:28oboFile Added: bug.tgz
2007-11-15 14:20zsStatusnew => assigned
2007-11-15 14:20zsAssigned To => zs
2007-11-19 17:37zsStatusassigned => resolved
2007-11-19 17:37zsResolutionopen => fixed
2007-11-19 17:37zsNote Added: 0000059