[m-rev.] diff: remove some now redundant code

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Oct 2 16:53:33 AEST 2009


Eliminate some now-redundant code.

compiler/ml_commit_gen.m:
compiler/ml_elim_nested.m:
compiler/ml_code_util.m:
	Remove all the calls to ml_decl_is_static_const, since static constant
	definitions are no longer included in the list of definitions
	explicitly returned by the predicates of the code generator.

compiler/ml_code_util.m:
	Remove the now obsolete predicate.

compiler/rtti_to_mlds.m:
	Remove a reference to the deleted predicate.

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/ml_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.147
diff -u -b -r1.147 ml_code_util.m
--- compiler/ml_code_util.m	2 Oct 2009 03:55:28 -0000	1.147
+++ compiler/ml_code_util.m	2 Oct 2009 04:10:01 -0000
@@ -295,10 +295,6 @@
     %
 :- func ml_format_reserved_object_name(string, arity) = mlds_var_name.
 
-    % Succeed iff the specified mlds_defn defines a local static constant.
-    %
-:- pred ml_decl_is_static_const(mlds_defn::in) is semidet.
-
 %-----------------------------------------------------------------------------%
 %
 % Routines for dealing with fields.
@@ -703,22 +699,15 @@
         % generate the `succ_func'
         % push nesting level
         DoGenRest(RestDecls, RestStatements, !Info),
-        list.filter(ml_decl_is_static_const, RestDecls,
-            RestStaticDecls, RestOtherDecls),
-        RestStatement = ml_gen_block(RestOtherDecls, RestStatements, Context),
+        RestStatement = ml_gen_block(RestDecls, RestStatements, Context),
         % pop nesting level
         ml_gen_nondet_label_func(!.Info, RestFuncLabel, Context,
             RestStatement, RestFunc),
 
-        Decls = FirstDecls ++ RestStaticDecls ++ [RestFunc],
+        Decls = FirstDecls ++ [RestFunc],
         Statements = FirstStatements
     ).
 
-ml_decl_is_static_const(Defn) :-
-    Defn = mlds_defn(Name, _Context, Flags, _DefnBody),
-    Name = entity_data(_),
-    Flags = ml_static_const_decl_flags.
-
 ml_gen_nondet_label_func(Info, FuncLabel, Context, Statement, Func) :-
     ml_gen_info_use_gcc_nested_functions(Info, UseNested),
     (
Index: compiler/ml_commit_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_commit_gen.m,v
retrieving revision 1.1
diff -u -b -r1.1 ml_commit_gen.m
--- compiler/ml_commit_gen.m	25 Sep 2009 05:13:03 -0000	1.1
+++ compiler/ml_commit_gen.m	2 Oct 2009 04:09:02 -0000
@@ -259,11 +259,7 @@
         SuccessCont = success_cont(SuccessFuncLabelRval, EnvPtrRval, [], []),
         ml_gen_info_push_success_cont(SuccessCont, !Info),
         ml_gen_goal(model_non, Goal, GoalDecls, GoalStatements, !Info),
-        % Hoist any static constant declarations for Goal out to the top level.
-        list.filter(ml_decl_is_static_const, GoalDecls,
-            GoalStaticDecls, GoalOtherDecls),
-        GoalStatement = ml_gen_block(GoalOtherDecls, GoalStatements,
-            GoalContext),
+        GoalStatement = ml_gen_block(GoalDecls, GoalStatements, GoalContext),
         ml_gen_info_pop_success_cont(!Info),
         ml_gen_set_success(!.Info, ml_const(mlconst_false), Context,
             SetSuccessFalse),
@@ -275,7 +271,7 @@
                 Context)
         ),
         TryCommitStatement = statement(TryCommitStmt, MLDS_Context),
-        CommitFuncLocalDecls = [CommitRefDecl, SuccessFunc | GoalStaticDecls],
+        CommitFuncLocalDecls = [CommitRefDecl, SuccessFunc],
         maybe_put_commit_in_own_func(CommitFuncLocalDecls,
             [TryCommitStatement], Context, CommitFuncDecls, Statements, !Info),
         Decls = LocalVarDecls ++ CommitFuncDecls,
@@ -338,16 +334,13 @@
         ml_gen_info_push_success_cont(SuccessCont, !Info),
         ml_gen_goal(model_non, Goal, GoalDecls, GoalStatements, !Info),
         % Hoist any static constant declarations for Goal out to the top level.
-        list.filter(ml_decl_is_static_const, GoalDecls,
-            GoalStaticDecls, GoalOtherDecls),
-        GoalStatement = ml_gen_block(GoalOtherDecls, GoalStatements,
-            GoalContext),
+        GoalStatement = ml_gen_block(GoalDecls, GoalStatements, GoalContext),
         ml_gen_info_pop_success_cont(!Info),
 
         TryCommitStmt = ml_stmt_try_commit(CommitRefLval, GoalStatement,
             ml_gen_block([], CopyLocalsToOutputArgs, Context)),
         TryCommitStatement = statement(TryCommitStmt, MLDS_Context),
-        CommitFuncLocalDecls = [CommitRefDecl, SuccessFunc | GoalStaticDecls],
+        CommitFuncLocalDecls = [CommitRefDecl, SuccessFunc],
         maybe_put_commit_in_own_func(CommitFuncLocalDecls,
             [TryCommitStatement], Context, CommitFuncDecls, Statements, !Info),
         Decls = LocalVarDecls ++ CommitFuncDecls,
Index: compiler/ml_elim_nested.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_elim_nested.m,v
retrieving revision 1.110
diff -u -b -r1.110 ml_elim_nested.m
--- compiler/ml_elim_nested.m	2 Oct 2009 03:55:28 -0000	1.110
+++ compiler/ml_elim_nested.m	2 Oct 2009 03:59:21 -0000
@@ -548,45 +548,31 @@
         fixup_gc_statements(Action, ElimInfo2, ElimInfo),
         elim_info_finish(ElimInfo, NestedFuncs0, Locals),
 
-        % Split the locals that we need to process into local variables
-        % and local static constants. ZZZ
-        list.filter(ml_decl_is_static_const, Locals, LocalStatics, LocalVars),
-
-        % Fix up access flags on the statics that we're going to hoist:
-        % convert "local" to "private".
-        HoistedStatics = list.map(convert_local_to_global, LocalStatics),
         (
+            NestedFuncs0 = [],
             % When hoisting nested functions, if there were no nested
-            % functions, then we just hoist the local static constants.
-            Action = hoist_nested_funcs,
-            NestedFuncs0 = []
-        ->
-            FuncBody = FuncBody1,
-            HoistedDefns = HoistedStatics
-        ;
+            % functions, we have nothing to do.
             % Likewise, when doing accurate GC, if there were no local
             % variables (or arguments) that contained pointers, then we don't
             % need to chain a stack frame for this function.
-            Action = chain_gc_stack_frames,
-            Locals = []
-        ->
             FuncBody = FuncBody1,
-            HoistedDefns = HoistedStatics
+            HoistedDefns = []
         ;
+            NestedFuncs0 = [_ | _],
             % Create a struct to hold the local variables, and initialize
             % the environment pointers for both the containing function
             % and the nested functions. Also generate the GC tracing function,
             % if Action = chain_gc_stack_frames.
             %
-            ml_create_env(Action, EnvName, EnvTypeName, LocalVars, Context,
+            ml_create_env(Action, EnvName, EnvTypeName, Locals, Context,
                 ModuleName, Name, Globals, EnvTypeDefn, EnvDecls, InitEnv,
                 GCTraceFuncDefns),
             list.map_foldl(
                 ml_insert_init_env(Action, EnvTypeName, ModuleName, Globals),
                     NestedFuncs0, NestedFuncs, no, InsertedEnv),
 
-            % Hoist out the local statics and the nested functions.
-            HoistedDefns0 = HoistedStatics ++ GCTraceFuncDefns ++ NestedFuncs,
+            % Hoist out the nested functions.
+            HoistedDefns0 = GCTraceFuncDefns ++ NestedFuncs,
 
             % When hoisting nested functions, it is possible that none of the
             % nested functions reference the arguments or locals of the parent
@@ -598,7 +584,6 @@
             % generated). This means that we don't avoid generating these
             % arguments. This is not really a big problem, since the code
             % that generates these arguments needs them.
-            %
             (
                 Action = hoist_nested_funcs,
                 InsertedEnv = no
@@ -650,8 +635,7 @@
                     Context),
                 % Insert the environment struct type at the start of the list
                 % of hoisted definitions (preceding the previously nested
-                % functions and static constants in HoistedDefns0),
-                %
+                % functions in HoistedDefns0).
                 HoistedDefns = [EnvTypeDefn | HoistedDefns0]
             )
         ),
@@ -2121,8 +2105,7 @@
         IsLocalVar = (pred(VarType::out) is nondet :-
             list.member(Var, Locals),
             Var = mlds_defn(entity_data(mlds_data_var(ThisVarName)), _, _,
-                mlds_data(VarType, _, _)),
-            \+ ml_decl_is_static_const(Var)
+                mlds_data(VarType, _, _))
         ),
         solutions.solutions(IsLocalVar, [FieldType])
     ->
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.92
diff -u -b -r1.92 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	25 Sep 2009 05:13:06 -0000	1.92
+++ compiler/rtti_to_mlds.m	2 Oct 2009 03:59:22 -0000
@@ -134,8 +134,6 @@
     ml_global_data_add_flat_rtti_defn(Defn, !GlobalData).
 
     % Return the declaration flags appropriate for an rtti_data.
-    % Note that this must be the same as ml_static_const_decl_flags,
-    % except for the access, so that ml_decl_is_static_const works.
     %
 :- func rtti_data_decl_flags(bool) = mlds_decl_flags.
 
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/base64
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/fixed
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_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
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/log4m
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/mopenssl
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/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
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/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/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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 ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
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/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
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