[m-rev.] diff: solver type cast fns for non-C backends / fix test failure
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon Jul 4 02:40:17 AEST 2011
Branches: main, 11.07
Fix the failure of hard_coded/solver_default_eq_cmp in deep profiling grades.
The problem was the test didn't fit into any of the existing categories in the
Mmakefile in tests/hard_coded -- specifically, we don't have a separate
category for non-deep profiling, C backend-only test; which was the set of
grades in which this test would work.
The fix is to remove the C backend-only dependency for this test by generating
solver type cast functions for the non-C backends and the shifting the test
into the existing set of tests that should only be run in non-deep profiling
grades.
compiler/add_solver.m:
Generate solver type cast functions in non-C grades.
tests/hard_coded/Mmakefile:
Don't run solver_default_eq_comp in deep profiling grades.
Put a list of tests back into order.
Julien.
Index: compiler/add_solver.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_solver.m,v
retrieving revision 1.24
diff -u -r1.24 add_solver.m
--- compiler/add_solver.m 5 May 2011 03:58:53 -0000 1.24
+++ compiler/add_solver.m 3 Jul 2011 16:18:30 -0000
@@ -27,7 +27,7 @@
% where representation is rt, % type
% initialisation is ip, % pred
% ground is gi, % inst
- % any is ai, ... % inst
+ % any is ai, ... % inst
%
% causes the following to be introduced:
%
@@ -64,6 +64,7 @@
:- import_module bool.
:- import_module map.
+:- import_module require.
:- import_module string.
:- import_module varset.
@@ -182,34 +183,67 @@
add_solver_type_clause_items(TypeSymName, TypeParams, SolverTypeDetails,
Context, !Status, !ModuleInfo, !QualInfo, !Specs) :-
- Arity = length(TypeParams),
+ Arity = length(TypeParams),
- AnyInst = SolverTypeDetails ^ std_any_inst,
- GroundInst = SolverTypeDetails ^ std_ground_inst,
+ AnyInst = SolverTypeDetails ^ std_any_inst,
+ GroundInst = SolverTypeDetails ^ std_ground_inst,
- InAnyMode = in_mode(AnyInst),
- InGroundMode = in_mode(GroundInst),
+ InAnyMode = in_mode(AnyInst),
+ InGroundMode = in_mode(GroundInst),
- OutAnyMode = out_mode(AnyInst),
- OutGroundMode = out_mode(GroundInst),
+ OutAnyMode = out_mode(AnyInst),
+ OutGroundMode = out_mode(GroundInst),
- ProgVarSet0 = varset.init,
+ ProgVarSet0 = varset.init,
varset.new_var(X, ProgVarSet0, ProgVarSet1),
varset.new_var(Y, ProgVarSet1, ProgVarSet),
InstVarSet = varset.init,
- Attrs0 = default_attributes(lang_c),
+ module_info_get_globals(!.ModuleInfo, Globals),
+ globals.get_target(Globals, Target),
+ (
+ Target = target_c,
+ Lang = lang_c
+ ;
+ Target = target_csharp,
+ Lang = lang_csharp
+ ;
+ Target = target_java,
+ Lang = lang_java
+ ;
+ Target = target_erlang,
+ Lang = lang_erlang
+ ;
+ ( Target = target_il
+ ; Target = target_asm
+ ; Target = target_x86_64
+ ),
+ WhatMsg = "solver type conversion functions for this backend",
+ sorry($module, WhatMsg)
+ ),
+
+ Attrs0 = default_attributes(Lang),
some [!Attrs] (
!:Attrs = Attrs0,
set_may_call_mercury(proc_will_not_call_mercury, !Attrs),
set_thread_safe(proc_thread_safe, !Attrs),
set_terminates(proc_terminates, !Attrs),
+ set_may_modify_trail(proc_will_not_modify_trail, !Attrs),
Attrs = !.Attrs
),
- Impl = fc_impl_ordinary("Y = X;", yes(Context)),
-
+ (
+ ( Lang = lang_c
+ ; Lang = lang_csharp
+ ; Lang = lang_java
+ ),
+ Impl = fc_impl_ordinary("Y = X;", yes(Context))
+ ;
+ Lang = lang_erlang,
+ Impl = fc_impl_ordinary("Y = X", yes(Context))
+ ),
+
% The `func(in) = out(<i_ground>) is det' mode.
%
ToGroundRepnSymName = solver_to_ground_repn_symname(TypeSymName, Arity),
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.406
diff -u -r1.406 Mmakefile
--- tests/hard_coded/Mmakefile 16 Jun 2011 06:42:18 -0000 1.406
+++ tests/hard_coded/Mmakefile 3 Jul 2011 16:14:11 -0000
@@ -378,7 +378,6 @@
any_free_unify \
solver_build_call \
solver_construction_init_test \
- solver_default_eq_cmp \
solver_disj_inits \
solver_ite_inits
else
@@ -577,10 +576,11 @@
dir_test \
final_excp \
init_excp \
+ io_globals_deadlock \
map_merge_test \
mutable_excp \
null_char \
- io_globals_deadlock \
+ solver_default_eq_cmp \
test_array2d \
test_injection \
tl_backjump_test \
--------------------------------------------------------------------------
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