[m-rev.] diff: part 1 of the fix for the trace_goal_* test case failures
Zoltan Somogyi
zs at csse.unimelb.edu.au
Mon Aug 14 13:30:52 AEST 2006
This diff implements step 1 of the fix for a bug I introduced when turning
the primitives involved in implementing trace goals into builtins. The bug
is that that builtin primitives have to be declared, but if they don't have
definitions, then add_pred *creates* a definition for them which assumes
them to be pure. The primitives involved in trace goal implementations
are semipure and impure respectively.
compiler/add_pred.m:
Add special case code for adding the definitions of the
trace_get_io_state and trace_set_io_state primitives. These exploit
the fact that I/O states are dummy values.
compiler/builtin_ops.m:
Fix parentheses in a comment.
compiler/options.m:
Provide a means to test in configure.in whether the installed compiler
contains this bug fix. This will be used by step 2, which can happen
only when this diff has been installed on all our machines.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/add_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
retrieving revision 1.18
diff -u -r1.18 add_pred.m
--- compiler/add_pred.m 27 Jul 2006 05:00:56 -0000 1.18
+++ compiler/add_pred.m 12 Aug 2006 06:13:15 -0000
@@ -226,34 +226,86 @@
Name = pred_info_name(!.PredInfo),
pred_info_context(!.PredInfo, Context),
pred_info_clauses_info(!.PredInfo, ClausesInfo0),
- clauses_info_get_varset(ClausesInfo0, VarSet),
+ clauses_info_get_varset(ClausesInfo0, VarSet0),
clauses_info_get_headvars(ClausesInfo0, HeadVars),
- % Construct the pseudo-recursive call to Module.Name(HeadVars).
- SymName = qualified(Module, Name),
- % Mode checking will figure it the mode.
- ModeId = invalid_proc_id,
- MaybeUnifyContext = no,
+ goal_info_init(Context, GoalInfo0),
+ set.list_to_set(HeadVars, NonLocals),
+ goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
(
Module = mercury_private_builtin_module,
Name = "store_at_ref"
->
- GoalExpr = conj(plain_conj, [])
+ GoalExpr = conj(plain_conj, []),
+ ExtraVars = [],
+ ExtraTypes = [],
+ VarSet = VarSet0
+ ;
+ Module = mercury_private_builtin_module,
+ Name = "trace_get_io_state"
+ ->
+ varset.new_var(VarSet0, ZeroVar, VarSet),
+ ExtraVars = [ZeroVar],
+ ExtraTypes = [int_type],
+
+ Free = free,
+ Ground = ground(shared, none),
+ ConsId = int_const(0),
+ LHS = ZeroVar,
+ RHS = functor(ConsId, no, []),
+ UniMode = ((Free - Ground) -> (Ground - Ground)),
+ Unification = construct(ZeroVar, ConsId, [], [UniMode],
+ construct_dynamically, cell_is_shared, no_construct_sub_info),
+ UnifyMode = ((Free -> Ground) - (Ground -> Ground)),
+ UnifyContext = unify_context(explicit, []),
+ AssignExpr = unify(LHS, RHS, UnifyMode, Unification, UnifyContext),
+ goal_info_set_nonlocals(set.make_singleton_set(ZeroVar),
+ GoalInfo0, GoalInfoWithZero),
+ AssignGoal = AssignExpr - GoalInfoWithZero,
+
+ CastExpr = generic_call(cast(unsafe_type_inst_cast),
+ [ZeroVar] ++ HeadVars, [in_mode, uo_mode], detism_det),
+ goal_info_set_nonlocals(set.list_to_set([ZeroVar] ++ HeadVars),
+ GoalInfo0, GoalInfoWithZeroHeadVars),
+ CastGoal = CastExpr - GoalInfoWithZeroHeadVars,
+
+ ConjExpr = conj(plain_conj, [AssignGoal, CastGoal]),
+ ConjGoal = ConjExpr - GoalInfoWithZeroHeadVars,
+
+ Reason = promise_purity(dont_make_implicit_promises, purity_semipure),
+ GoalExpr = scope(Reason, ConjGoal)
+ ;
+ Module = mercury_private_builtin_module,
+ Name = "trace_set_io_state"
+ ->
+ ConjExpr = conj(plain_conj, []),
+ ConjGoal = ConjExpr - GoalInfo,
+ Reason = promise_purity(dont_make_implicit_promises, purity_impure),
+ GoalExpr = scope(Reason, ConjGoal),
+ ExtraVars = [],
+ ExtraTypes = [],
+ VarSet = VarSet0
;
+ % Construct the pseudo-recursive call to Module.Name(HeadVars).
+ SymName = qualified(Module, Name),
+ % Mode checking will figure out the mode.
+ ModeId = invalid_proc_id,
+ MaybeUnifyContext = no,
GoalExpr = plain_call(PredId, ModeId, HeadVars, inline_builtin,
- MaybeUnifyContext, SymName)
+ MaybeUnifyContext, SymName),
+ ExtraVars = [],
+ ExtraTypes = [],
+ VarSet = VarSet0
),
% Construct a clause containing that pseudo-recursive call.
- goal_info_init(Context, GoalInfo0),
- set.list_to_set(HeadVars, NonLocals),
- goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
Goal = GoalExpr - GoalInfo,
Clause = clause([], Goal, mercury, Context),
% Put the clause we just built into the pred_info,
- % annotateed with the appropriate types.
- map.from_corresponding_lists(HeadVars, Types, VarTypes),
+ % annotated with the appropriate types.
+ map.from_corresponding_lists(ExtraVars ++ HeadVars, ExtraTypes ++ Types,
+ VarTypes),
map.init(TVarNameMap),
rtti_varmaps_init(RttiVarMaps),
HasForeignClauses = no,
Index: compiler/builtin_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/builtin_ops.m,v
retrieving revision 1.25
diff -u -r1.25 builtin_ops.m
--- compiler/builtin_ops.m 1 Aug 2006 00:45:52 -0000 1.25
+++ compiler/builtin_ops.m 12 Aug 2006 05:16:51 -0000
@@ -69,8 +69,8 @@
% Note that the arguments to `unsigned_le' are just ordinary
% (signed) Mercury ints, but it does the comparison as
% if they were first cast to an unsigned type, so e.g.
- % binary(unsigned_le, int_const(1), int_const(-1) returns true,
- % since (MR_Unsigned) 1 <= (MR_Unsigned) -1).
+ % binary(unsigned_le, int_const(1), int_const(-1)) returns true,
+ % since (MR_Unsigned) 1 <= (MR_Unsigned) -1.
; float_plus
; float_minus
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.522
diff -u -r1.522 options.m
--- compiler/options.m 9 Aug 2006 04:56:35 -0000 1.522
+++ compiler/options.m 14 Aug 2006 03:14:48 -0000
@@ -2250,6 +2250,7 @@
long_option("install-opt-files-2002-08-30", compiler_sufficiently_recent).
long_option("read-config-file-2003-03-01", compiler_sufficiently_recent).
long_option("no-noncompact-ho-call-2004-01-15", compiler_sufficiently_recent).
+long_option("trace-io-builtins-2006-08-14", compiler_sufficiently_recent).
long_option("experiment", experiment).
%-----------------------------------------------------------------------------%
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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