Mercury Bugs - mercury
View Issue Details
0000352mercuryBugpublic2014-08-18 17:412014-09-01 18:14
Assigned Tozs 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000352: tabled_for_io with Mercury descendants
DescriptionIn the example, p has attributes may_call_mercury and tabled_for_io. At the end of p, table_io stats prints that the I/O counter = 2. If you retry over p, then at the end, table_io stats prints that counter = 1. Obviously this leads to problems later.

I see that there is an undocumented attribute tabled_for_io_unitize. Perhaps that should be implied if tabled_for_io and may_call_mercury are used together?
TagsNo tags attached.
Attached Files? table_io_callback.m (845) 2014-08-18 17:41

2014-08-18 21:10   
The table_for_io attribute was intended for PRIMITIVE I/O operations, which do not call Mercury. Having it misbehave with may_call_mercury is not a surprise.
There should be a check for the conflict.

I don't remember for sure, but I think the table_for_io_unitize attribute wasn't documented because it was not yet ready for prime time. I don't remember whether there was some situation I knew I still had to code to cover, but I do remember that the testing was only superficial; thorough testing still remained to be done.

Once it HAS been done, then yes, turning tabled_for_io into tabled_for_io_unitize in the presence of may_call_mercury would be a good idea.

I won't have much time to look into this for a few days. If this is not urgent, assign the bug to me, and I will have a look at this, probably sometime next week.
2014-09-01 18:14   
There approximately 76 procedures in the standard library that currently have both tabled_for_io and may_call_mercury enabled. The great majority of those seem to make calls back to Mercury in order
to construct some data structure that describes an error condition (or other such return value).

Issue History
2014-08-18 17:41wangpNew Issue
2014-08-18 17:41wangpFile Added: table_io_callback.m
2014-08-18 21:10zsNote Added: 0000762
2014-08-19 10:49wangpAssigned To => zs
2014-08-19 10:49wangpStatusnew => assigned
2014-09-01 18:14juliensfNote Added: 0000777