[m-rev.] diff: prepare to add domain checking for int__rem/2
Simon Taylor
stayl at cs.mu.OZ.AU
Wed Oct 24 16:51:35 AEST 2001
Estimated hours taken: 0.25
Branches: main
I missed `int__rem/2' in my change to make the arithmetic functions
throw exceptions rather than abort for domain erors.
`int__rem/2' will be made non-builtin. The code for `int__rem/2'
will call `int__unchecked_rem/2' after checking that the right
operand is not zero.
compiler/builtin_ops.m:
Add a translation for `int__unchecked_rem/2'.
compiler/make_hlds.m:
Disable warnings about clauses for builtins. This
is needed to bootstrap the change to make `int__rem/2'
non-builtin.
Index: builtin_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/builtin_ops.m,v
retrieving revision 1.8
diff -u -u -r1.8 builtin_ops.m
--- builtin_ops.m 2 Sep 2001 12:20:11 -0000 1.8
+++ builtin_ops.m 24 Oct 2001 06:11:56 -0000
@@ -193,6 +193,8 @@
assign(Z, binary((/), leaf(X), leaf(Y)))).
builtin_translation("int", "rem", 0, [X, Y, Z],
assign(Z, binary((mod), leaf(X), leaf(Y)))).
+builtin_translation("int", "unchecked_rem", 0, [X, Y, Z],
+ assign(Z, binary((mod), leaf(X), leaf(Y)))).
builtin_translation("int", "unchecked_left_shift", 0, [X, Y, Z],
assign(Z, binary((<<), leaf(X), leaf(Y)))).
builtin_translation("int", "unchecked_right_shift", 0, [X, Y, Z],
Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.385
diff -u -u -r1.385 make_hlds.m
--- make_hlds.m 9 Oct 2001 03:50:18 -0000 1.385
+++ make_hlds.m 24 Oct 2001 06:23:53 -0000
@@ -3662,7 +3662,10 @@
{ code_util__predinfo_is_builtin(PredInfo1) }
->
prog_out__write_context(Context),
- report_warning("Warning: clause for builtin.\n"),
+ % XXX Disabled while a change to add domain checking to
+ % `int__rem/2' is bootstrapped.
+ % report_warning("Warning: clause for builtin.\n"),
+ io__write_string("Warning: clause for builtin.\n"),
{ ModuleInfo = ModuleInfo1 },
{ Info = Info0 }
;
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list