[m-dev.] for review: add MR_virtual_hp, MR_virtual_sp, etc.
zs at cs.mu.OZ.AU
Wed Apr 15 18:27:30 AEST 1998
> +#ifdef USE_CONSERVATIVE_GC
> + #define incr_saved_hp(A, B) incr_hp(A, B)
> + #define incr_saved_hp_atomic(A, B) incr_hp_atomic(A, B)
Make the macro bodies line up, and add a comment saying that the
reason why the "saved" part has no effect is that there is in fact
no hp registers.
> + /* same as tag_incr_hp except we use MR_virtual_hp instead of MR_hp */
> + #define incr_saved_hp(dest, count) \
> + ( \
> + (dest) = (Word) mkword(0, (Word) MR_virtual_hp),\
> + debugincrhp(count, MR_virtual_hp), \
> + MR_virtual_hp += (count), \
> + saved_heap_overflow_check(), \
> + (void)0 \
> + )
> + #define incr_saved_hp_atomic(A, B) incr_saved_hp(A, B)
Add a comment that atomicity is meaningful only with the Boehm collector.
> ** The registers of the Mercury virtual machine are built up using
> ** three levels of abstraction.
> -** The first level defines the first NUM_REAL_REGS register variables
> -** mr0, mr1, etc. as the physical machine registers, and defines an
> -** array fake_regs[n] of pseudo registers.
> +** The bottom level is the hardware description layer.
> +** This layer is defined seperately for each architecture, in machdeps/*.h.
I have seen you make this mistake often enough that I suggest that you
put it (and variations with endings such as "ly") into a vim abbreviation.
> ** Since the set of most frequently used Mercury virtual machine
> -** registers can be different for each program, we want to make
> +** registers can be different for each program or grade, we want to make
> ** this mapping as easy to change as possible. This is why the
> ** map is in a minimal header file, mercury_regorder.h.
Making the mapping different for each program is an idea whose time
has passed, so you may want to delete that part of the comment.
There is a subtle problem with your diff. The purpose of these changes
is to fix the XXX problem in mercury_trace_util.c, but defining MR_virtual*
to refer to fake_reg is not what is wanted there. Instead that code wants to
refer to MR_saved_regs, because this has the values from the event, and
fake_reg will not, except when displaying the value of the first variable
(since fake_reg will be overwritten by the display routine itself).
More information about the developers