[m-rev.] for review: use MR_Unsigned in trace code

Ian MacLarty maclarty at csse.unimelb.edu.au
Tue Oct 2 14:09:56 AEST 2007


On Tue, Oct 02, 2007 at 01:35:41PM +1000, Julien Fischer wrote:
>
> On Tue, 2 Oct 2007, Ian MacLarty wrote:
>
>> On Tue, Oct 02, 2007 at 11:03:54AM +1000, Julien Fischer wrote:
>>>
>>> For review by Zoltan or Ian.
>>>
>>> Estimated hours taken: 5
>>> Branches: main
>>>
>>> Fix up some places in the trace directory where there were (potential)
>>> mismatches between the sizes of types used to represent natural numbers.
>>> Much of the existing code in the trace directory assumed that sizeof(int)
>>> == sizeof(MR_Unsigned), which is not true on our 64-bit
>>> machines.  Zoltan's recent change to MR_trace_is_natural_number() broke
>>> that assumption in a lot of places.  (I committed a workaround for that
>>> yesterday.)
>>>
>>> This diff addresses the above problem by changing the types of many of
>>> things that represent natural numbers from int to MR_Unsigned.
>>> This should make the trace code more robust on 64-bit machines and
>>> help avoid a recurrence of problems like the above.
>>>
>>> NOTE: this change does not change slot numbers into unsigned values since
>>> they still use negative values as sentinels.  I will address slot numbers
>>> in as part of a separate change.
>>>
>>> trace/mercury_trace.h:
>>> 	Add typedefs for MR_Unsigned for several commonly used quantities
>>> 	within the trace code.  For I/O action numbers we just re-use
>>> 	the type MR_IoActionNum from the runtime, rather than defining
>>> 	a adding a new typedef here.
>>
>> delete "a adding".
>
> Fixed.
>
>>> Index: trace/mercury_trace_cmd_browsing.c
>>> ===================================================================
>> ...
>>> @@ -459,10 +461,10 @@
>>>  MR_trace_cmd_stack(char **words, int word_count, MR_TraceCmdInfo *cmd,
>>>      MR_EventInfo *event_info, MR_Code **jumpaddr)
>>>  {
>>> -    MR_bool     detailed;
>>> -    int         frame_limit = 0;
>>> -    int         line_limit = MR_stack_default_line_limit;
>>> -    int         spec_line_limit;
>>> +    MR_bool             detailed;
>>> +    MR_FrameLimit       frame_limit = 0;
>>> +    int                 line_limit = MR_stack_default_line_limit;
>>
>> I think this should change to MR_Unsigned too (here and elsewhere).
>
> Yes, there are a number of others that can (probably) be changed.
> I didn't do them as part of this change because they weren't
> affect by MR_trace_is_natural_number().  I'll take a look at them
> in a separate change.
>

I just mentioned this one, because it seems to be used the same way as
spec_line_limit which is an MR_Unsigned.

Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list