diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m index 32819bf4d..5c687807d 100644 --- a/compiler/compile_target_code.m +++ b/compiler/compile_target_code.m @@ -599,15 +599,6 @@ gather_grade_defines(Globals, GradeDefines) :- HighLevelCode = no, HighLevelCodeOpt = "" ), - globals.lookup_bool_option(Globals, gcc_nested_functions, - GCC_NestedFunctions), - ( - GCC_NestedFunctions = yes, - NestedFunctionsOpt = "-DMR_USE_GCC_NESTED_FUNCTIONS " - ; - GCC_NestedFunctions = no, - NestedFunctionsOpt = "" - ), globals.lookup_bool_option(Globals, highlevel_data, HighLevelData), ( HighLevelData = yes, @@ -904,7 +895,6 @@ gather_grade_defines(Globals, GradeDefines) :- ), string.append_list([ HighLevelCodeOpt, - NestedFunctionsOpt, HighLevelDataOpt, RegOpt, GotoOpt, AsmOpt, ParallelOpt, diff --git a/compiler/compute_grade.m b/compiler/compute_grade.m index 604e8929a..96dc4af08 100644 --- a/compiler/compute_grade.m +++ b/compiler/compute_grade.m @@ -536,7 +536,6 @@ grade_component_table("none", comp_gcc_ext, [ gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("reg", comp_gcc_ext, [ @@ -544,7 +543,6 @@ grade_component_table("reg", comp_gcc_ext, [ gcc_non_local_gotos - bool(no), gcc_global_registers - bool(yes), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("jump", comp_gcc_ext, [ @@ -552,7 +550,6 @@ grade_component_table("jump", comp_gcc_ext, [ gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(no), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("asm_jump", comp_gcc_ext, [ @@ -560,7 +557,6 @@ grade_component_table("asm_jump", comp_gcc_ext, [ gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(no), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("fast", comp_gcc_ext, [ @@ -568,7 +564,6 @@ grade_component_table("fast", comp_gcc_ext, [ gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(yes), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("asm_fast", comp_gcc_ext, [ @@ -576,7 +571,6 @@ grade_component_table("asm_fast", comp_gcc_ext, [ gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(yes), highlevel_code - bool(no), - gcc_nested_functions - bool(no), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("hl", comp_gcc_ext, [ @@ -584,7 +578,6 @@ grade_component_table("hl", comp_gcc_ext, [ gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), highlevel_code - bool(yes), - gcc_nested_functions - bool(no), highlevel_data - bool(yes)], yes([string("c")]), yes). grade_component_table("hlc", comp_gcc_ext, [ @@ -592,30 +585,12 @@ grade_component_table("hlc", comp_gcc_ext, [ gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), highlevel_code - bool(yes), - gcc_nested_functions - bool(no), - highlevel_data - bool(no)], - yes([string("c")]), yes). -grade_component_table("hl_nest", comp_gcc_ext, [ - asm_labels - bool(no), - gcc_non_local_gotos - bool(no), - gcc_global_registers - bool(no), - highlevel_code - bool(yes), - gcc_nested_functions - bool(yes), - highlevel_data - bool(yes)], - yes([string("c")]), yes). -grade_component_table("hlc_nest", comp_gcc_ext, [ - asm_labels - bool(no), - gcc_non_local_gotos - bool(no), - gcc_global_registers - bool(no), - highlevel_code - bool(yes), - gcc_nested_functions - bool(yes), highlevel_data - bool(no)], yes([string("c")]), yes). grade_component_table("java", comp_gcc_ext, [ asm_labels - bool(no), gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), - gcc_nested_functions - bool(no), highlevel_code - bool(yes), highlevel_data - bool(yes)], yes([string("java")]), yes). @@ -623,7 +598,6 @@ grade_component_table("csharp", comp_gcc_ext, [ asm_labels - bool(no), gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), - gcc_nested_functions - bool(no), highlevel_code - bool(yes), highlevel_data - bool(yes)], yes([string("csharp")]), yes). @@ -631,7 +605,6 @@ grade_component_table("erlang", comp_gcc_ext, [ asm_labels - bool(no), gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no), - gcc_nested_functions - bool(no), highlevel_code - bool(no), highlevel_data - bool(no)], yes([string("erlang")]), yes). @@ -773,7 +746,6 @@ grade_start_values(gcc_non_local_gotos - bool(no)). grade_start_values(gcc_global_registers - bool(no)). grade_start_values(highlevel_code - bool(no)). grade_start_values(highlevel_data - bool(no)). -grade_start_values(gcc_nested_functions - bool(no)). grade_start_values(parallel - bool(no)). grade_start_values(threadscope - bool(no)). grade_start_values(gc - string("none")). diff --git a/compiler/handle_options.m b/compiler/handle_options.m index bf401d7ac..a9b14d680 100644 --- a/compiler/handle_options.m +++ b/compiler/handle_options.m @@ -866,8 +866,6 @@ convert_options_to_globals(OptionTable0, OpMode, Target, % (In theory --low-level-data should work too, but there is % no reason to bother supporting it.) % - unboxed floats - % - turning off nested functions - % Because Java doesn't support nested functions. % - using copy-out for both det and nondet output arguments % Because Java doesn't support pass-by-reference. % - using no tags @@ -894,7 +892,6 @@ convert_options_to_globals(OptionTable0, OpMode, Target, globals.set_option(highlevel_code, bool(yes), !Globals), globals.set_option(highlevel_data, bool(yes), !Globals), globals.set_option(unboxed_float, bool(yes), !Globals), - globals.set_option(gcc_nested_functions, bool(no), !Globals), globals.set_option(nondet_copy_out, bool(yes), !Globals), globals.set_option(det_copy_out, bool(yes), !Globals), globals.set_option(num_tag_bits, int(0), !Globals), @@ -978,10 +975,6 @@ convert_options_to_globals(OptionTable0, OpMode, Target, option_implies(highlevel_code, gcc_global_registers, bool(no), !Globals), option_implies(highlevel_code, asm_labels, bool(no), !Globals), - % --no-gcc-nested-functions implies --no-gcc-local-labels. - option_neg_implies(gcc_nested_functions, gcc_local_labels, bool(no), - !Globals), - % --no-mlds-optimize implies --no-optimize-tailcalls. option_neg_implies(optimize, optimize_tailcalls, bool(no), !Globals), diff --git a/compiler/mercury_compile_mlds_back_end.m b/compiler/mercury_compile_mlds_back_end.m index 0ca93910d..e8f0af361 100644 --- a/compiler/mercury_compile_mlds_back_end.m +++ b/compiler/mercury_compile_mlds_back_end.m @@ -210,15 +210,9 @@ mlds_backend(!HLDS, !:MLDS, !:Specs, !DumpInfo, !IO) :- maybe_report_stats(Stats, !IO), maybe_dump_mlds(Globals, !.MLDS, 30, "gc_frames", !IO), - globals.lookup_bool_option(Globals, gcc_nested_functions, NestedFuncs), - ( - NestedFuncs = no, - maybe_write_string(Verbose, "% Flattening nested functions...\n", !IO), - ml_elim_nested(hoist_nested_funcs, Globals, MLDS_Target, !MLDS), - maybe_write_string(Verbose, "% done.\n", !IO) - ; - NestedFuncs = yes - ), + maybe_write_string(Verbose, "% Flattening nested functions...\n", !IO), + ml_elim_nested(hoist_nested_funcs, Globals, MLDS_Target, !MLDS), + maybe_write_string(Verbose, "% done.\n", !IO), maybe_report_stats(Stats, !IO), maybe_dump_mlds(Globals, !.MLDS, 35, "nested_funcs", !IO), diff --git a/compiler/ml_accurate_gc.m b/compiler/ml_accurate_gc.m index 1b93c386d..0d6ea1400 100644 --- a/compiler/ml_accurate_gc.m +++ b/compiler/ml_accurate_gc.m @@ -192,15 +192,8 @@ ml_do_gen_gc_statement(VarName, DeclType, HowToGetTypeInfo, Context, GCStmt, % get boxed in some circumstances, because if they are boxed then they will % be represented as mlds_generic_type. % - % Note that with --gcc-nested-functions, cont_type will be a function - % pointer that may point to a trampoline function, which might in fact - % contain pointers. But the pointers will only be pointers to code and - % pointers to the stack, not pointers to the heap, so we don't need to - % trace them for accurate GC. Hence we can return `no' here for - % mlds_cont_type. - % - % Similarly, the only pointers in type_ctor_infos and base_typeclass_infos - % are to static code and/or static data, which do not need to be traced. + % The only pointers in type_ctor_infos and base_typeclass_infos are + % to static code and/or static data, which do not need to be traced. % :- func ml_type_might_contain_pointers_for_gc(mlds_type) = bool. diff --git a/compiler/ml_args_util.m b/compiler/ml_args_util.m index eca9a72fb..10dfd8330 100644 --- a/compiler/ml_args_util.m +++ b/compiler/ml_args_util.m @@ -425,15 +425,7 @@ ml_gen_params_base(ModuleInfo, HeadVarNames, HeadTypes, HeadModes, PredOrFunc, ContEnvGCStmt = gc_no_stmt, ContEnvArg = mlds_argument(ContEnvVarName, ContEnvType, ContEnvGCStmt), - globals.lookup_bool_option(Globals, gcc_nested_functions, - NestedFunctions), - ( - NestedFunctions = yes, - FuncArgs = FuncArgs0 ++ [ContArg] - ; - NestedFunctions = no, - FuncArgs = FuncArgs0 ++ [ContArg, ContEnvArg] - ) + FuncArgs = FuncArgs0 ++ [ContArg, ContEnvArg] ), FuncParams = mlds_func_params(FuncArgs, RetTypes). diff --git a/compiler/ml_call_gen.m b/compiler/ml_call_gen.m index d4fd82071..82753f0dc 100644 --- a/compiler/ml_call_gen.m +++ b/compiler/ml_call_gen.m @@ -618,14 +618,7 @@ ml_gen_mlds_call(Signature, FuncRval, ArgRvals0, RetLvals0, Cont, FuncDefns, !Info), % Append the success continuation to the ordinary arguments. Cont = success_cont(FuncPtrRval, EnvPtrRval, _, _), - ml_gen_info_use_gcc_nested_functions(!.Info, UseNestedFuncs), - ( - UseNestedFuncs = yes, - ArgRvals = ArgRvals0 ++ [FuncPtrRval] - ; - UseNestedFuncs = no, - ArgRvals = ArgRvals0 ++ [FuncPtrRval, EnvPtrRval] - ), + ArgRvals = ArgRvals0 ++ [FuncPtrRval, EnvPtrRval], % For --nondet-copy-out, the output arguments will be passed to the % continuation rather than being returned. ml_gen_info_get_nondet_copy_out(!.Info, NondetCopyOut), @@ -733,15 +726,8 @@ ml_gen_success_cont(OutputArgTypes, OutputArgLvals, Context, ml_gen_cont_params(OutputArgTypes, Params, !Info) :- ml_gen_cont_params_loop(OutputArgTypes, 1, Args0), - ml_gen_info_use_gcc_nested_functions(!.Info, UseNestedFuncs), - ( - UseNestedFuncs = yes, - Args = Args0 - ; - UseNestedFuncs = no, - ml_declare_env_ptr_arg(EnvPtrArg), - Args = Args0 ++ [EnvPtrArg] - ), + ml_declare_env_ptr_arg(EnvPtrArg), + Args = Args0 ++ [EnvPtrArg], Params = mlds_func_params(Args, []). :- pred ml_gen_cont_params_loop(list(mlds_type)::in, int::in, diff --git a/compiler/ml_code_gen.m b/compiler/ml_code_gen.m index 6c0382626..c22be5831 100644 --- a/compiler/ml_code_gen.m +++ b/compiler/ml_code_gen.m @@ -393,28 +393,6 @@ % % This back-end is still not yet 100% complete. % -% Done: -% - function prototypes -% - code generation for det, semidet, and nondet predicates/functions: -% - conjunctions -% - disjunctions -% - negation -% - if-then-else -% - predicate/function calls -% - higher-order calls -% - unifications -% - assignment -% - simple tests -% - constructions -% - deconstructions -% - switches -% - commits -% - `pragma foreign_proc' -% - RTTI -% - high level data representation -% (i.e. generate MLDS type declarations for user-defined types) -% - support trailing -% % TODO: % - XXX define compare & unify preds for RTTI types % - XXX need to generate correct layout information for closures @@ -422,22 +400,9 @@ % - XXX fix ANSI/ISO C conformance of the generated code % % UNIMPLEMENTED FEATURES: -% - test --det-copy-out -% - fix --gcc-nested-functions (need forward declarations for -% nested functions) -% - support debugging (with mdb) % - support genuine parallel conjunction -% - support fact tables -% - support accurate GC % % POTENTIAL EFFICIENCY IMPROVEMENTS: -% - optimize unboxed float on DEC Alphas. -% - generate better code for switches: -% - optimize switches so that the recursive case comes first -% (see switch_gen.m). -% - apply the reverse tag test optimization -% for types with two functors (see unify_gen.m) -% - binary search switches % - generate local declarations for the `succeeded' variable; % this would help in nondet code, because it would avoid % the need to access the outermost function's `succeeded' diff --git a/compiler/ml_code_util.m b/compiler/ml_code_util.m index 78cec0c55..ba44682e3 100644 --- a/compiler/ml_code_util.m +++ b/compiler/ml_code_util.m @@ -618,15 +618,8 @@ ml_combine_conj(FirstCodeModel, Context, DoGenFirst, DoGenRest, ). ml_gen_nondet_label_func(Info, MaybeAux, Context, Stmt, Func) :- - ml_gen_info_use_gcc_nested_functions(Info, UseNested), - ( - UseNested = yes, - FuncParams = mlds_func_params([], []) - ; - UseNested = no, - ml_declare_env_ptr_arg(EnvPtrArg), - FuncParams = mlds_func_params([EnvPtrArg], []) - ), + ml_declare_env_ptr_arg(EnvPtrArg), + FuncParams = mlds_func_params([EnvPtrArg], []), ml_gen_label_func(Info, MaybeAux, FuncParams, Context, Stmt, Func). ml_gen_label_func(Info, MaybeAux, FuncParams, Context, Stmt, Func) :- @@ -813,19 +806,12 @@ ml_gen_new_func_label(MaybeParams, MaybeAux, FuncLabelRval, !Info) :- ml_gen_info_get_module_info(!.Info, ModuleInfo), ml_gen_info_get_pred_proc_id(!.Info, PredProcId), ml_gen_pred_label(ModuleInfo, PredProcId, PredLabel, PredModule), - ml_gen_info_use_gcc_nested_functions(!.Info, UseNestedFuncs), ( MaybeParams = yes(Params), Signature = mlds_get_func_signature(Params) ; MaybeParams = no, - ( - UseNestedFuncs = yes, - ArgTypes = [] - ; - UseNestedFuncs = no, - ArgTypes = [mlds_generic_env_ptr_type] - ), + ArgTypes = [mlds_generic_env_ptr_type], Signature = mlds_func_signature(ArgTypes, []) ), PredProcId = proc(_PredId, ProcId), @@ -1528,17 +1514,9 @@ ml_skip_dummy_argument_types([], [_ | _], _, _, _) :- ml_gen_call_current_success_cont(Context, Stmt, !Info) :- ml_gen_info_current_success_cont(!.Info, SuccCont), SuccCont = success_cont(FuncRval, EnvPtrRval, ArgTypes0, ArgLvals0), + ArgTypes = ArgTypes0 ++ [mlds_generic_env_ptr_type], ArgRvals0 = list.map(func(Lval) = ml_lval(Lval), ArgLvals0), - ml_gen_info_use_gcc_nested_functions(!.Info, UseNestedFuncs), - ( - UseNestedFuncs = yes, - ArgTypes = ArgTypes0, - ArgRvals = ArgRvals0 - ; - UseNestedFuncs = no, - ArgTypes = ArgTypes0 ++ [mlds_generic_env_ptr_type], - ArgRvals =ArgRvals0 ++ [EnvPtrRval] - ), + ArgRvals =ArgRvals0 ++ [EnvPtrRval], RetTypes = [], Signature = mlds_func_signature(ArgTypes, RetTypes), RetLvals = [], diff --git a/compiler/ml_commit_gen.m b/compiler/ml_commit_gen.m index 0ef64436c..e13fe7b2d 100644 --- a/compiler/ml_commit_gen.m +++ b/compiler/ml_commit_gen.m @@ -409,17 +409,9 @@ maybe_put_commit_in_own_func(LocalVarDefn0, FuncDefn0, TryCommitStmts, CommitFuncBody, CommitFuncDefn), % Generate the call to `commit_func();' - ml_gen_info_use_gcc_nested_functions(!.Info, UseNestedFuncs), - ( - UseNestedFuncs = yes, - ArgRvals = [], - ArgTypes = [] - ; - UseNestedFuncs = no, - ml_get_env_ptr(EnvPtrRval), - ArgRvals = [EnvPtrRval], - ArgTypes = [mlds_generic_env_ptr_type] - ), + ml_get_env_ptr(EnvPtrRval), + ArgRvals = [EnvPtrRval], + ArgTypes = [mlds_generic_env_ptr_type], RetTypes = [], Signature = mlds_func_signature(ArgTypes, RetTypes), CallKind = ordinary_call, diff --git a/compiler/ml_gen_info.m b/compiler/ml_gen_info.m index 625c14e26..86501ec50 100644 --- a/compiler/ml_gen_info.m +++ b/compiler/ml_gen_info.m @@ -56,11 +56,6 @@ :- pred ml_gen_info_get_module_name(ml_gen_info::in, mercury_module_name::out) is det. - % Look up the --gcc-nested-functions option. - % -:- pred ml_gen_info_use_gcc_nested_functions(ml_gen_info::in, bool::out) - is det. - % Look up the --put-commit-in-nested-func option. % :- pred ml_gen_info_put_commit_in_own_func(ml_gen_info::in, bool::out) is det. @@ -462,11 +457,6 @@ ml_gen_info_get_module_name(Info, ModuleName) :- ml_gen_info_get_module_info(Info, ModuleInfo), module_info_get_name(ModuleInfo, ModuleName). -ml_gen_info_use_gcc_nested_functions(Info, UseNestedFuncs) :- - ml_gen_info_get_globals(Info, Globals), - globals.lookup_bool_option(Globals, gcc_nested_functions, - UseNestedFuncs). - ml_gen_info_put_commit_in_own_func(Info, PutCommitInNestedFunc) :- ml_gen_info_get_globals(Info, Globals), globals.lookup_bool_option(Globals, put_commit_in_own_func, diff --git a/compiler/mlds_to_c.m b/compiler/mlds_to_c.m index 8698be834..c6cbefb07 100644 --- a/compiler/mlds_to_c.m +++ b/compiler/mlds_to_c.m @@ -146,8 +146,6 @@ m2co_line_numbers :: bool, m2co_foreign_line_numbers :: bool, m2co_auto_comments :: bool, - m2co_gcc_local_labels :: bool, - m2co_gcc_nested_functions :: bool, m2co_highlevel_data :: bool, m2co_profile_calls :: bool, m2co_profile_memory :: bool, @@ -170,8 +168,6 @@ init_mlds_to_c_opts(Globals, SourceFileName) = Opts :- globals.lookup_bool_option(Globals, line_numbers_around_foreign_code, ForeignLineNumbers), globals.lookup_bool_option(Globals, auto_comments, Comments), - globals.lookup_bool_option(Globals, gcc_local_labels, GccLabels), - globals.lookup_bool_option(Globals, gcc_nested_functions, GccNested), globals.lookup_bool_option(Globals, highlevel_data, HighLevelData), globals.lookup_bool_option(Globals, profile_calls, ProfileCalls), globals.lookup_bool_option(Globals, profile_memory, ProfileMemory), @@ -190,8 +186,8 @@ init_mlds_to_c_opts(Globals, SourceFileName) = Opts :- globals.get_gc_method(Globals, GCMethod), StdFuncDecls = no, Opts = mlds_to_c_opts(SourceFileName, - LineNumbers, ForeignLineNumbers, Comments, GccLabels, GccNested, - HighLevelData, ProfileCalls, ProfileMemory, ProfileTime, ProfileAny, + LineNumbers, ForeignLineNumbers, Comments, HighLevelData, + ProfileCalls, ProfileMemory, ProfileTime, ProfileAny, Target, GCMethod, StdFuncDecls, Globals). %---------------------------------------------------------------------------% @@ -3046,14 +3042,7 @@ mlds_output_type_prefix(Opts, MLDS_Type, !IO) :- MLDS_Type = mlds_cont_type(ArgTypes), ( ArgTypes = [], - GCC_NestedFuncs = Opts ^ m2co_gcc_nested_functions, - ( - GCC_NestedFuncs = yes, - io.write_string("MR_NestedCont", !IO) - ; - GCC_NestedFuncs = no, - io.write_string("MR_Cont", !IO) - ) + io.write_string("MR_Cont", !IO) ; ArgTypes = [_ | _], % This case only happens for --nondet-copy-out. @@ -3061,14 +3050,7 @@ mlds_output_type_prefix(Opts, MLDS_Type, !IO) :- ) ; MLDS_Type = mlds_commit_type, - GCC_LocalLabels = Opts ^ m2co_gcc_local_labels, - ( - GCC_LocalLabels = yes, - io.write_string("__label__", !IO) - ; - GCC_LocalLabels = no, - io.write_string("jmp_buf", !IO) - ) + io.write_string("jmp_buf", !IO) ; MLDS_Type = mlds_rtti_type(RttiIdMaybeElement), rtti_id_maybe_element_c_type(RttiIdMaybeElement, CType, _IsArray), @@ -3215,14 +3197,7 @@ mlds_output_type_suffix(Opts, MLDS_Type, ArraySize, !IO) :- io.write_string(")(", !IO), io.write_list(ArgTypes, ", ", mlds_output_type(Opts), !IO), % add the type for the environment parameter, if needed - GCC_NestedFuncs = Opts ^ m2co_gcc_nested_functions, - ( - GCC_NestedFuncs = no, - io.write_string(", void *", !IO) - ; - GCC_NestedFuncs = yes - ), - io.write_string(")", !IO) + io.write_string(", void *)", !IO) ) ; MLDS_Type = mlds_rtti_type(RttiIdMaybeElement), @@ -3577,22 +3552,7 @@ mlds_output_stmt_block(Opts, Indent, FuncInfo, Stmt, !IO) :- ), ( LocalVarDefns = [_ | _], - GCC_LocalLabels = Opts ^ m2co_gcc_local_labels, - ( - GCC_LocalLabels = yes, - % GNU C __label__ declarations must precede ordinary variable - % declarations. - list.filter(local_var_defn_is_commit_type, LocalVarDefns, - LabelDefns, NonLabelDefns), - mlds_output_local_var_defns(Opts, BlockIndent, no, - LabelDefns, !IO), - mlds_output_local_var_defns(Opts, BlockIndent, no, - NonLabelDefns, !IO) - ; - GCC_LocalLabels = no, - mlds_output_local_var_defns(Opts, BlockIndent, no, - LocalVarDefns, !IO) - ), + mlds_output_local_var_defns(Opts, BlockIndent, no, LocalVarDefns, !IO), io.write_string("\n", !IO) ; LocalVarDefns = [] @@ -4114,23 +4074,13 @@ mlds_output_stmt_return(Opts, Indent, Stmt, !IO) :- mlds_output_stmt_do_commit(Opts, Indent, Stmt, !IO) :- Stmt = ml_stmt_do_commit(Ref, _Context), output_n_indents(Indent, !IO), - GCC_LocalLabels = Opts ^ m2co_gcc_local_labels, - ( - GCC_LocalLabels = yes, - % Output "goto ". - io.write_string("goto ", !IO), - mlds_output_rval(Opts, Ref, !IO) - ; - GCC_LocalLabels = no, - % Output "MR_builtin_longjmp(, 1)". This is a macro that - % expands to either the standard longjmp() or the GNU C's - % __builtin_longjmp(). Note that the second argument to GNU - % C's __builtin_longjmp() *must* be `1'. - io.write_string("MR_builtin_longjmp(", !IO), - mlds_output_rval(Opts, Ref, !IO), - io.write_string(", 1)", !IO) - ), - io.write_string(";\n", !IO). + % Output "MR_builtin_longjmp(, 1)". This is a macro that expands + % to either the standard longjmp() or the GNU C's __builtin_longjmp(). + % Note that the second argument to GNU C's __builtin_longjmp() + % *must* be `1'. + io.write_string("MR_builtin_longjmp(", !IO), + mlds_output_rval(Opts, Ref, !IO), + io.write_string(", 1);\n", !IO). %---------------------------------------------------------------------------% % @@ -4144,87 +4094,47 @@ mlds_output_stmt_do_commit(Opts, Indent, Stmt, !IO) :- mlds_output_stmt_try_commit(Opts, Indent, FuncInfo, Stmt, !IO) :- Stmt = ml_stmt_try_commit(Ref, BodyStmt0, HandlerStmt, Context), - GCC_LocalLabels = Opts ^ m2co_gcc_local_labels, - ( - GCC_LocalLabels = yes, + % Output the following: + % + % if (MR_builtin_setjmp() == 0) + % + % else + % + % + % MR_builtin_setjmp() expands to either the standard setjmp() + % or GNU C's __builtin_setjmp(). + % + % Note that ISO C says that any non-volatile variables that are local + % to the function containing the setjmp() and which are modified between + % the setjmp() and the longjmp() become indeterminate after the longjmp(). + % The MLDS code generator handles that by generating each commit + % in its own nested function, with the local variables remaining + % in the containing function. This ensures that none of the variables + % which get modified between the setjmp() and the longjmp() and which get + % referenced after the longjmp() are local variables in the function + % containing the setjmp(), so we don't need to mark them as volatile. + % XXX Soon there won't be any nested functions. - % Output the following: - % - % - % goto _done; - % : - % - % _done: - % ; + % We need to take care to avoid problems caused by the + % dangling else ambiguity. + ( if BodyStmt0 = ml_stmt_if_then_else(_, _, no, Context) then + BodyStmt = ml_stmt_block([], [], [BodyStmt0], Context) + else + BodyStmt = BodyStmt0 + ), - % Note that should be just variable name, not a complicated - % expression. If not, the C compiler will catch it. + output_n_indents(Indent, !IO), + io.write_string("if (MR_builtin_setjmp(", !IO), + mlds_output_lval(Opts, Ref, !IO), + io.write_string(") == 0)\n", !IO), - mlds_output_statement(Opts, Indent, FuncInfo, BodyStmt0, !IO), + mlds_output_statement(Opts, Indent + 1, FuncInfo, BodyStmt, !IO), - c_output_context(Opts ^ m2co_line_numbers, Context, !IO), - output_n_indents(Indent, !IO), - io.write_string("goto ", !IO), - mlds_output_lval(Opts, Ref, !IO), - io.write_string("_done;\n", !IO), + c_output_context(Opts ^ m2co_line_numbers, Context, !IO), + output_n_indents(Indent, !IO), + io.write_string("else\n", !IO), - c_output_context(Opts ^ m2co_line_numbers, Context, !IO), - output_n_indents(Indent - 1, !IO), - mlds_output_lval(Opts, Ref, !IO), - io.write_string(":\n", !IO), - - mlds_output_statement(Opts, Indent, FuncInfo, HandlerStmt, !IO), - - c_output_context(Opts ^ m2co_line_numbers, Context, !IO), - output_n_indents(Indent - 1, !IO), - mlds_output_lval(Opts, Ref, !IO), - io.write_string("_done:\t;\n", !IO) - ; - GCC_LocalLabels = no, - - % Output the following: - % - % if (MR_builtin_setjmp() == 0) - % - % else - % - % - % MR_builtin_setjmp() expands to either the standard setjmp() - % or GNU C's __builtin_setjmp(). - % - % Note that ISO C says that any non-volatile variables that are - % local to the function containing the setjmp() and which are - % modified between the setjmp() and the longjmp() become - % indeterminate after the longjmp(). The MLDS code generator - % handles that by generating each commit in its own nested - % function, with the local variables remaining in the containing - % function. This ensures that none of the variables which get - % modified between the setjmp() and the longjmp() and which get - % referenced after the longjmp() are local variables in the - % function containing the setjmp(), so we don't need to mark them - % as volatile. - - % We need to take care to avoid problems caused by the - % dangling else ambiguity. - ( if BodyStmt0 = ml_stmt_if_then_else(_, _, no, Context) then - BodyStmt = ml_stmt_block([], [], [BodyStmt0], Context) - else - BodyStmt = BodyStmt0 - ), - - output_n_indents(Indent, !IO), - io.write_string("if (MR_builtin_setjmp(", !IO), - mlds_output_lval(Opts, Ref, !IO), - io.write_string(") == 0)\n", !IO), - - mlds_output_statement(Opts, Indent + 1, FuncInfo, BodyStmt, !IO), - - c_output_context(Opts ^ m2co_line_numbers, Context, !IO), - output_n_indents(Indent, !IO), - io.write_string("else\n", !IO), - - mlds_output_statement(Opts, Indent + 1, FuncInfo, HandlerStmt, !IO) - ). + mlds_output_statement(Opts, Indent + 1, FuncInfo, HandlerStmt, !IO). %---------------------------------------------------------------------------% % diff --git a/compiler/notes/grade_library.html b/compiler/notes/grade_library.html index ed7b48219..f3c5ddeef 100644 --- a/compiler/notes/grade_library.html +++ b/compiler/notes/grade_library.html @@ -94,8 +94,7 @@ Each grade component specifies either the value of one compiler option (for example, "tr" specifies use_trail=yes), or the values of two or more compiler options -(for example, "hlc" specifies target=c, -highlevel_data=no and gcc_nested_functions=no). +(for example, "hlc" specifies target=c and highlevel_data=no).

A typical grade string does not specify a value diff --git a/compiler/options.m b/compiler/options.m index 70141485e..4fb6daf72 100644 --- a/compiler/options.m +++ b/compiler/options.m @@ -494,7 +494,6 @@ % MLDS back-end compilation model options ; highlevel_code ; highlevel_data - ; gcc_nested_functions ; det_copy_out ; nondet_copy_out ; put_commit_in_own_func @@ -660,7 +659,6 @@ % How full the fact table hash tables should be allowed to get, % given as an integer percentage. - ; gcc_local_labels ; prefer_switch ; prefer_while_loop_over_jump_self ; prefer_while_loop_over_jump_mutual @@ -1453,7 +1451,6 @@ option_defaults_2(compilation_model_option, [ % MLDS back-end compilation model options highlevel_code - bool(no), highlevel_data - bool(no), - gcc_nested_functions - bool(no), det_copy_out - bool(no), nondet_copy_out - bool(no), put_commit_in_own_func - bool(no), @@ -1545,7 +1542,6 @@ option_defaults_2(code_gen_option, [ should_pretest_equality - bool(yes), fact_table_max_array_size - int(1024), fact_table_hash_percent_full - int(90), - gcc_local_labels - bool(no), prefer_switch - bool(yes), prefer_while_loop_over_jump_self - bool(yes), prefer_while_loop_over_jump_mutual - bool(no), @@ -2400,7 +2396,6 @@ long_option("highlevel-C", highlevel_code). long_option("highlevel-c", highlevel_code). long_option("high-level-C", highlevel_code). long_option("high-level-c", highlevel_code). -long_option("gcc-nested-functions", gcc_nested_functions). long_option("det-copy-out", det_copy_out). long_option("nondet-copy-out", nondet_copy_out). long_option("put-commit-in-own-func", put_commit_in_own_func). @@ -2468,7 +2463,6 @@ long_option("should-pretest-equality", should_pretest_equality). long_option("fact-table-max-array-size",fact_table_max_array_size). long_option("fact-table-hash-percent-full", fact_table_hash_percent_full). -long_option("gcc-local-labels", gcc_local_labels). long_option("prefer-switch", prefer_switch). long_option("prefer-while-loop-over-jump-self", prefer_while_loop_over_jump_self). @@ -4840,28 +4834,15 @@ options_help_compilation_model --> io.write_string("\n MLDS back-end compilation model options:\n"), write_tabbed_lines([ -% These grades (hl_nest, and hlc_nest) are not yet documented, -% because the --gcc-nested-functions option is not yet documented. -% "-H, --high-level-code\t\t\t(grades: hl_nest, hlc_nest)", "-H, --high-level-code\t\t\t(grades: hlc, csharp, java)", "\tUse an alternative back-end that generates high-level code", "\trather than the very low-level code that is generated by our", "\toriginal back-end.", -% The hl_nest grade is not yet documented, -% because the --gcc-nested-functions option is not yet documented. -% because it is not yet supported -% "--high-level-data\t\t\t(grades: hl, hl_nest, csharp, java)", "--high-level-data\t\t\t(grades: csharp, java)", "\tUse an alternative higher-level data representation.", % "--high-level\t\t\t(grades: hl, hl_nest, il, csharp, java)", "--high-level\t\t\t(grades: csharp, java)", "\tAn abbreviation for `--high-level-code --high-level-data'." -% The --gcc-nested-functions option is not yet documented, -% because it doesn't pass our test suite, and it is -% probably not very useful. -% "--gcc-nested-functions\t\t(grades: hl_nest, hlc_nest)", -% "\tSpecify whether or not to use GNU C's nested functions extension.", -% "\tThis option is ignored if the `--high-level-code' option is not enabled.", % The --det-copy-out option is not yet documented, % because it is not yet tested much and probably not very useful, % except for Java, where it is the default. @@ -5135,18 +5116,6 @@ options_help_code_generation --> "\tshould be allowed to get. Given as an integer percentage", "\t(valid range: 1 to 100, default: 90)." -% This option is not yet documented because the `--gcc-nested-functions' option -% is not documented. -% "--gcc-local-labels", -% "\tThis option has no effect unless both the `--high-level-code' option", -% "\tand the `--gcc-nested-functions' options are enabled.", -% "\tIf this option is enabled, the Mercury compiler will generate", -% "\tC code that uses GNU C's local labels extension to allow", -% "\tGNU C nested functions to exit into their containing function", -% "\tvia a `goto'.", -% "\tIf this option is not enabled, the default behaviour is to", -% "\tuse the standard ANSI/ISO C setjmp() and longjmp() functions." - % This option is not yet documented because it is not yet useful -- currently % we don't take advantage of GNU C's computed gotos extension. % "--no-prefer-switch", diff --git a/configure.ac b/configure.ac index 37e03ac3f..4e470bc38 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ esac # versions of Darwin needs to use the C compiler to make that distinction. # In particular, if we wish to build a 32-bit Mercury installation on # x86_64 machine, then we need to tell configure that we are using the -# 32-bit C compiler. If we didn't call the AC_PROG_CC macro at this point +# 32-bit C compiler. If we didn't call the AC_PROG_CC macro at this point # then configure's --with-cc option would not do that. AC_PROG_CC @@ -149,7 +149,7 @@ AC_SUBST([CC]) export CC # NOTE: AC_PROG_CC will set the variable GCC if it thinks the C compiler is -# GCC. However, it also sets it if the C compiler is clang -- because they +# GCC. However, it also sets it if the C compiler is clang -- because they # both define __GNUC__ -- do *NOT* use the GCC variable to check the C compiler # type, instead use the value of C_COMPILER_TYPE (defined below). # @@ -165,13 +165,13 @@ case "$mercury_cv_cc_type" in MERCURY_CLANG_VERSION C_COMPILER_TYPE="clang_${mercury_cv_clang_version}" ;; - + gcc) MERCURY_HAVE_GCC=yes MERCURY_GCC_VERSION C_COMPILER_TYPE="gcc_${mercury_cv_gcc_version}" ;; - + msvc) MERCURY_HAVE_MSVC=yes MERCURY_MSVC_VERSION @@ -251,7 +251,7 @@ then exit 1 fi ;; - esac + esac fi #-----------------------------------------------------------------------------# @@ -281,7 +281,7 @@ AC_SUBST(DEFAULT_MERCURY_DEBUGGER_DOC) # MMC_INVOKE_CMD is the command used to invoke mercury_compile in scripts/mmc. # On MSYS (MinGW) we cannot use exec, since exec will not find the file because # it will expect a path relative to the MSYS home directory and will not work -# with a full Windows path. A full Windows path, however must be used for the +# with a full Windows path. A full Windows path, however must be used for the # prefix so that mercury_compile will find the standard library. # case "$host" in @@ -615,8 +615,8 @@ fi if test "$BOOTSTRAP_MC" = "" then # If we do not have a working bootstrap Mercury compiler, then work out - # whether any .c files we do have were compiled with --highlevel code or - # not. At this point we only check a single file -- this is enough to + # whether any .c files we do have were compiled with high level code or + # not. At this point we only check a single file -- this is enough to # allow us to determine a value for BOOTSTRAP_GRADE below -- we check # any other pre-generated .c files as part of the call to # mercury_check_c_files() later on. @@ -653,7 +653,7 @@ then "") # This corresponds to the case where we compile using - # $PREFIX/bin/mercury_compile. Since we can (hopefully) + # $PREFIX/bin/mercury_compile. Since we can (hopefully) # regenerate any .c files, it is irrelevant whether we used # --highlevel-code or not when compiling any existing ones. ;; @@ -912,8 +912,8 @@ AC_SUBST(EXEEXT) # We need to ensure that CFLAGS does not contain `-g', because # on some (broken) distributions of Linux (specifically Debian 0.93R6), # the `-lc' and `-lg' libraries have different contents; specifically, -# only the latter contains memalign(). We need to make sure that the -# test for memalign() doesn't use `-g', since `ml' doesn't use `-g'. +# only the latter contains memalign(). We need to make sure that the test +# for memalign() doesn't use `-g', since `ml' doesn't use `-g'. CFLAGS="-O" # We need to define _XOPEN_SOURCE when building boehm on Darwin 10 @@ -945,14 +945,14 @@ esac # Test whether specific command line options are supported by the C compiler. # We do this by attempting to compile a program with the option whose presence -# we are testing for. This will not work for MSVC since it prints a warning -# about any unknown options and then proceeds as normal. There is no way to +# we are testing for. This will not work for MSVC since it prints a warning +# about any unknown options and then proceeds as normal. There is no way to # tell it to treat that warning as an error (in particular, this warning is not # affected by the -WX option). if test "$MERCURY_HAVE_MSVC" = "yes" then - + CFLAGS_FOR_ERRMSG_FILTER="" CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS= CFLAGS_FOR_NO_REORDER_FUNCTIONS="" @@ -1040,7 +1040,7 @@ AC_SUBST(CFLAGS_FOR_ERRMSG_FILTER) #-----------------------------------------------------------------------------# # Make sure we search /usr/local/include and /usr/local/lib for -# header files and libraries. GNU C normally searches /usr/local/include +# header files and libraries. GNU C normally searches /usr/local/include # by default, but (inconsistently) on some systems, such as Solaris, # it does _not_ search /usr/local/lib. # The user might also be using a different C compiler that @@ -1076,9 +1076,8 @@ else AC_MSG_RESULT([no]) fi -# Determine if we are on a system which has a restricted -# command line length. This is true if we are building -# under mingw or using the MS C compiler +# Determine if we are on a system which has a restricted command line length. +# This is true if we are building under mingw or using the MS C compiler. RESTRICTED_COMMAND_LINE_OPT= case "$host" in *mingw*) @@ -1164,11 +1163,10 @@ else LD_LIBFLAGS_FOR_DEBUG="-g" # On Linux ELF, the linker option `-export-dynamic' is needed to make - # symbols exported for use in code linked in with dlopen(), - # which is used for interactive queries in the - # Mercury debugger. For gcc, this linker option can be enabled by - # passing either `-rdynamic' or `-Wl,-export-dynamic' to gcc; - # we use the former. + # symbols exported for use in code linked in with dlopen(), which is used + # for interactive queries in the Mercury debugger. For gcc, this + # linker option can be enabled by passing either `-rdynamic' or + # `-Wl,-export-dynamic' to gcc; we use the former. # case $FULLARCH in *-linux*) @@ -1187,7 +1185,7 @@ else # we need to pass the `-c' option to ranlib. # Otherwise, "common" symbols, i.e. "int foo;" without an initializer, # do not get included in the archive table of contents, and so - # don't get found during linking. Whose !@#$ing idea was it to make + # don't get found during linking. Whose !@#$ing idea was it to make # that brain-damaged and non-standard-conforming mode the default? case "$host" in *apple*darwin*) @@ -1236,8 +1234,8 @@ AC_CHECK_LIB(m, sin, [MATH_LIB=-lm], [MATH_LIB=]) enable_symlinks_opt=no AC_ARG_ENABLE(symlinks, AC_HELP_STRING([--enable-symlinks], - [enable symbolic links. This is the default on all - systems except Windows. On Windows you can force + [enable symbolic links. This is the default on all + systems except Windows. On Windows you can force symbolic links to be used by giving this option. Note that symbolic links will only work on Windows if you are using the Cygwin version of GCC.]), @@ -2507,8 +2505,8 @@ AC_SUBST(MR_CAN_DO_PENDING_IO) #-----------------------------------------------------------------------------# # There is a problem on some BSD based systems that FD_ZERO is defined # defined in terms of bzero() but the appropriate header file for bzero() -# is not automatically included. The following deals with this situation -# on MacOS 10.3. (It appears to be fixed in MacOS 10.4.) +# is not automatically included. The following deals with this situation +# on MacOS 10.3. (It appears to be fixed in MacOS 10.4.) AC_MSG_CHECKING(to see if strings.h is needed for bzero) AC_CACHE_VAL(mercury_cv_bzero_needs_strings_header, [ @@ -2584,7 +2582,7 @@ AC_SUBST(MR_DARWIN_SETJMP_WORKAROUND) # prologue and expects them to be valid later on, which doesn't work with # non-local gotos, since we jump directly into the middle of a function. # (Actually I don't know if `-fno-functions-cse' is really needed. -# Maybe you can get away without it. But better to err on the safe side...) +# Maybe you can get away without it. But better to err on the safe side...) # # For x86, x86-64 and possibly other architectures, when using non-local # gotos with gcc 4.x we need `-fno-move-loop-invariants'. @@ -2630,12 +2628,11 @@ case "$ac_cv_prog_gcc" in yes) CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS" CFLAGS_FOR_REGS="-fno-builtin -fno-omit-frame-pointer" ;; - # We need a special-case hack here, because the auto-config - # gets it wrong on the Alpha: the little example program - # works fine in fast.gc mode, but big programs don't, - # due to problems with the `gp' register. Ideally we - # ought to write a big enough example program to trigger - # the problem, but that would be too much work. + # We need a special-case hack here, because the auto-config gets it + # wrong on the Alpha: the little example program works fine + # in fast.gc mode, but big programs don't, due to problems with + # the `gp' register. Ideally we ought to write a big enough example + # program to trigger the problem, but that would be too much work. alpha*-dec-*) MERCURY_MSG( "asm labels work on the Alpha but plain gcc labels do not") @@ -2643,7 +2640,7 @@ case "$ac_cv_prog_gcc" in yes) mercury_cv_gcc_labels=no CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer" ;; - # Similarly for rs6000 + # Similarly for rs6000. rs6000-*) MERCURY_MSG("gcc labels do not work on the RS/6000") mercury_cv_asm_labels=no @@ -2691,9 +2688,8 @@ case "$C_COMPILER_TYPE" in ;; *) # XXX Pass -fno-reorder-functions when using GCC 4.6 onwards with - # the global register or non-local goto extensions. This works - # around problems in *.par* grades. (See bug #294 for further - # details.) + # the global register or non-local goto extensions. This works around + # problems in *.par* grades. (See bug #294 for further details.) CFLAGS_FOR_REGS="$CFLAGS_FOR_REGS $CFLAGS_FOR_NO_REORDER_FUNCTIONS" CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_REORDER_FUNCTIONS" ;; @@ -2708,7 +2704,7 @@ esac # processes those references just fine, but some other part of gcc seems # to forget that fact when it generates the warnings. We therefore filter # out those warnings with util/mfiltercc. -# +# # Versions of gcc from 4.8 onward generate this warning not on a single line, # which is what mfiltercc looks for, but as a very long multiline message, # tracing the several macros involved, and putting arrow (carets) under their @@ -3204,7 +3200,7 @@ case "$host" in if test "$MR_HAVE_PTHREAD_H" = 1 then # By default the MinGW port of GCC targets the i386 - # architecture. We need to tell it to target a later + # architecture. We need to tell it to target a later # architecture for the GCC built-in atomic ops to be # available. CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -march=i686" @@ -3325,8 +3321,8 @@ fi #-----------------------------------------------------------------------------# -# On some systems a prefix is attached to exported symbols. We need to -# account for this when checking object files for namespace cleanliness. +# On some systems a prefix is attached to exported symbols. We need to account +# for this when checking object files for namespace cleanliness. SYMPREFIX= @@ -3345,7 +3341,7 @@ AC_SUBST([SYMPREFIX]) # # BEST_LLDS_BASE_GRADE is the most efficient of the LLDS->C base grades -# that can be supported. If the user explicitly chooses a base grade +# that can be supported. If the user explicitly chooses a base grade # using --with-llds-base-grade then we use that instead. # # NOTE: the base grade can also be one of asm_jump, fast and jump. @@ -3406,7 +3402,7 @@ case "$mercury_cv_user_base_grade" in esac # Force the use of the none grade on Apple x86_64 systems when using -# GCC 4.1 or 4.2. The asm_fast and reg grades do not work with those versions. +# GCC 4.1 or 4.2. The asm_fast and reg grades do not work with those versions. # They do work properly on x86_64 systems with GCC version 4.3 onwards. # case "$C_COMPILER_TYPE" in @@ -3495,8 +3491,8 @@ esac # BOOTSTRAP_GRADE is the most efficient grade which we can use to bootstrap the # compiler from the source distribution, if there is no installed Mercury -# compiler. This grade needs to be one for which the C files are compatible -# with the C files that we ship in the source distribution. The C files in the +# compiler. This grade needs to be one for which the C files are compatible +# with the C files that we ship in the source distribution. The C files in the # source distribution are generated in hlc.gc.pregen or asm_fast.gc.pregen. # In the former case, we _must_ use the grade hlc.gc.pregen, in the latter case # we can, in principle, use any of the base LLDS grades (it's the same C code). @@ -3534,7 +3530,7 @@ if test "$BOOTSTRAP_MC" = ""; then **** after installation is complete you may reinstall **** from scratch to have a faster compiler. **** NOTE: before reinstalling from scratch, ensure that the -**** source tree is clean by running \`make realclean'. Not doing +**** source tree is clean by running \`make realclean'. Not doing **** this may result in a broken Mercury installation.]) else GRADE=$BEST_GRADE_FOR_COMPILER @@ -3743,13 +3739,10 @@ else LIBGRADES="$GC_LIBGRADES" fi -# Add `hlc' (--high-level-code, i.e. MLDS back-end) grades +# Add `hlc' (--high-level-code, i.e. MLDS back-end) grades. LIBGRADES="$LIBGRADES hlc.gc" -if test "$enable_inefficient_grades" = yes -a "$GCC" = yes ; then - LIBGRADES="$LIBGRADES hlc_nest.gc" -fi -# Add `.agc' (--gc accurate) grades +# Add `.agc' (--gc accurate) grades. # Currently only hlc.agc is supported. if test "$enable_agc_grades" = yes; then LIBGRADES="$LIBGRADES hlc.agc" @@ -4232,7 +4225,7 @@ int main() { #if __GNUC__ >= 3 /* gcc 3.1 seems to have problems with structure assignment and global registers, but which this simple test case - does not trigger. So just force the test to fail for gcc 3.x. */ + does not trigger. So just force the test to fail for gcc 3.x. */ exit(1); #else exit(0); @@ -4277,9 +4270,9 @@ DEPLOYMENT_TARGET="no" case "$host" in *apple*darwin*) case "$mercury_cv_macosx_deployment_target" in - # NOTE: the sw_vers utility tells us which version of Mac OS X we are - # using as opposed to which version of Darwin we are using. uname - # only reports the latter. + # NOTE: the sw_vers utility tells us which version of Mac OS X + # we are using as opposed to which version of Darwin we are using. + # uname only reports the latter. auto) DEPLOYMENT_TARGET=`sw_vers -productVersion | cut -d \. -f 1 -f 2` ;; @@ -4452,26 +4445,23 @@ case "$host" in # (well, at least they are shared on disk -- although the code is # not shared at runtime), and using `-fpic' would reduce efficiency. # - # It works because the Solaris dynamic linker will - # actually do the fixups at runtime for non-PIC code. - # (The code is mapped copy-on-write, and when the linker - # does the fixups, it gets copied. Hence the lack of - # runtime sharing.) - # We need to link with `gcc -shared -mimpure-text' - # rather than `gcc -shared', because `gcc -shared' - # passes `-z text' to the linker, which causes it to + # It works because the Solaris dynamic linker will actually do + # the fixups at runtime for non-PIC code. (The code is mapped + # copy-on-write, and when the linker does the fixups, it gets copied. + # Hence the lack of runtime sharing.) We need to link with + # `gcc -shared -mimpure-text' rather than `gcc -shared', because + # `gcc -shared' passes `-z text' to the linker, which causes it to # report an error if any runtime fixups would be needed. # # If you *do* use `-fpic', you must also use `-DMR_PIC'. # - # See runtime/mercury_goto.h for the code that handles PIC - # on SPARCs. + # See runtime/mercury_goto.h for the code that handles PIC on SPARCs. # Note that mixing PIC and non-PIC code is fine on SPARCs. EXT_FOR_SHARED_LIB=so ;; *-cygwin*) - # disabled for now, since it hasn't been tested + # Disabled for now, since it hasn't been tested. # xxx_MSG_RESULT(yes) # EXT_FOR_SHARED_LIB=dll # USE_DLLS=yes @@ -4494,7 +4484,7 @@ case "$host" in ;; *apple*darwin*) # If the compiler is gcc or clang then use Darwin style dynamic - # linking. Otherwise use static linking. + # linking. Otherwise use static linking. case "$C_COMPILER_TYPE" in gcc*|clang*) AC_MSG_RESULT(yes) @@ -4558,24 +4548,24 @@ case "$mercury_cv_cc_type" in gcc*) # We no longer pass -ansi to GCC on any system for the following # reasons: + # # * It restricts the dialect of C used to C90 and that prevents us - # from using various C99 library features. Every version of GCC we - # support provides those features so there is no point in doing - # this. + # from using various C99 library features. Every version of GCC we + # support provides those features so there is no point in doing this. # * It causes complications with the header files on some systems. - # Notably with the definitions of the types off_t and off64_t on MinGW - # systems. + # Notably with the definitions of the types off_t and off64_t + # on MinGW systems. # * This setting also affects the compilation of user written C code in # foreign_proc and foreign code pragmas. # - # NOTE: the --no-ansi option supported by the mgnuc script does more than - # simply pass the value of CFLAGS_FOR_ANSI to the C compiler. + # NOTE: the --no-ansi option supported by the mgnuc script does + # more than simply pass the value of CFLAGS_FOR_ANSI to the C compiler. # (See that script for details.) - # + # CFLAGS_FOR_ANSI= - # For a full list of the other gcc warnings that we don't - # enable, and why, see scripts/mgnuc.in. + # For a full list of the other gcc warnings that we don't enable, + # and why, see scripts/mgnuc.in. CFLAGS_FOR_WARNINGS="-Wall -Wwrite-strings -Wshadow -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Wstrict-prototypes" # Enabling -fomit-frame-pointer causes setjmp/longjmp to misbehave @@ -4611,9 +4601,9 @@ case "$mercury_cv_cc_type" in # XXX we need go through the warning and optimization options for clang # more carefully. CFLAGS_FOR_WARNINGS="-w" - + # Disable C compiler optimizations for old versions of clang. - # (See above for details.) + # (See above for details.) case "$C_COMPILER_TYPE" in clang_0_*|clang_1_*|clang_2_*) CFLAGS_FOR_OPT="-O0 -fomit-frame-pointer" @@ -4703,8 +4693,8 @@ case "$FULLARCH" in esac # We can't put the call to MSG_CHECKING at the start of the case statement -# above, because of the nested check in the lcc case. So we just put it -# here immediately before the MSG_RESULT call. +# above, because of the nested check in the lcc case. So we just put it here +# immediately before the MSG_RESULT call. AC_MSG_CHECKING([options for static linking]) AC_MSG_RESULT($LD_STATIC_FLAGS) case "$LD_STATIC_FLAGS" in @@ -5102,13 +5092,13 @@ LIBS="$save_LIBS" #-----------------------------------------------------------------------------# # # Add an option that enables the external debugger support. -# By default, external debugger support is enabled if and only if -# sockets work. But it is also possible to explicitly disable this -# by passing the `--disable-extern-debug' option. This is needed on -# some platforms because the test for sockets working sometimes gets -# some false positives (e.g. if they work with dynamic linking but -# not static linking, then the test will pass, but it will cause -# problems later on when we try to link things statically). +# By default, external debugger support is enabled if and only if sockets work. +# But it is also possible to explicitly disable this by passing the +# `--disable-extern-debug' option. This is needed on some platforms because +# the test for sockets working sometimes gets some false positives +# (e.g. if they work with dynamic linking but not static linking, +# then the test will pass, but it will cause problems later on +# when we try to link things statically). # AC_ARG_ENABLE(extern-debug, @@ -5276,8 +5266,8 @@ AC_SUBST(HWLOC_STATIC_LIBS) # # We only require flex and bison if we are going to compile the trace -# directory. We don't need them if we are reconfiguring an existing -# installation. We omit these tests in that case because otherwise users +# directory. We don't need them if we are reconfiguring an existing +# installation. We omit these tests in that case because otherwise users # would have to flex and bison available in order to install the binary # distribution. # @@ -5463,10 +5453,10 @@ AC_SUBST(CSHPATH) #-----------------------------------------------------------------------------# -# When running the debugger tests we want to use the local mdbrc -# file, not the installed one, so that we can test changes -# to this file without having to install first. We therefore create -# a copy of the mdbrc.in for use with the test suite. +# When running the debugger tests we want to use the local mdbrc file, +# not the installed one, so that we can test changes to this file +# without having to install first. We therefore create a copy of the mdbrc.in +# for use with the test suite. test_mdbrc=tests/mdbrc @@ -5587,10 +5577,10 @@ case $reconfiguring in no) rm -f conftest.junk # The --prefix is hard-coded in the scripts, which are regenerated - # every time you run configure, and also (unfortunately) in the .so - # files. The following rm commands are here to ensure that things - # will work correctly if you rerun configure with a new --prefix and - # then don't do a `make clean' before running `make'. + # every time you run configure, and also (unfortunately) in the .so files. + # The following rm commands are here to ensure that things will work + # correctly if you rerun configure with a new --prefix and then + # don't do a `make clean' before running `make'. rm -f runtime/libmer_rt.so library/libmer_std.so bytecode/libmbi.so rm -f trace/libmer_trace.so browser/libmer_browser.so rm -f mdbcomp/libmer_mdbcomp.so diff --git a/doc/user_guide.texi b/doc/user_guide.texi index 631ebf851..bc3090b49 100644 --- a/doc/user_guide.texi +++ b/doc/user_guide.texi @@ -7054,8 +7054,8 @@ Write the unqualified version of the short interface to @itemx --make-private-interface @findex --make-priv-int @findex --make-private-interface -Write the module's private interface (used for compiling -nested sub-modules) to @file{@var{module}.int0}. +Write the module's private interface (used for compiling nested sub-modules) +to @file{@var{module}.int0}. @sp 1 @item --make-opt-int diff --git a/library/backjump.m b/library/backjump.m index eac4a459e..4b19ff6f8 100644 --- a/library/backjump.m +++ b/library/backjump.m @@ -132,17 +132,10 @@ backjump(Id) :- #include -#ifdef MR_USE_GCC_NESTED_FUNCTIONS - #define MR_CONT_PARAMS MR_NestedCont cont - #define MR_CONT_PARAM_TYPES MR_NestedCont - #define MR_CONT_ARGS cont - #define MR_CONT_CALL() (*cont)() -#else - #define MR_CONT_PARAMS MR_Cont cont, void *cont_env - #define MR_CONT_PARAM_TYPES MR_Cont, void * - #define MR_CONT_ARGS cont, cont_env - #define MR_CONT_CALL() cont(cont_env) -#endif +#define MR_CONT_PARAMS MR_Cont cont, void *cont_env +#define MR_CONT_PARAM_TYPES MR_Cont, void * +#define MR_CONT_ARGS cont, cont_env +#define MR_CONT_CALL() cont(cont_env) void MR_CALL mercury__backjump__builtin_choice_id_1_p_0(MR_BackJumpChoiceId *id, MR_CONT_PARAMS); diff --git a/library/exception.m b/library/exception.m index a1d6580d5..33830703a 100644 --- a/library/exception.m +++ b/library/exception.m @@ -711,15 +711,9 @@ catch_impl(Pred, Handler, T) :- #ifdef MR_HIGHLEVEL_CODE - #ifdef MR_USE_GCC_NESTED_FUNCTIONS - #define MR_CONT_PARAMS MR_NestedCont cont - #define MR_CONT_PARAM_TYPES MR_NestedCont - #define MR_CONT_ARGS cont - #else #define MR_CONT_PARAMS MR_Cont cont, void *cont_env #define MR_CONT_PARAM_TYPES MR_Cont, void * #define MR_CONT_ARGS cont, cont_env - #endif /* det */ void MR_CALL @@ -1103,66 +1097,6 @@ mercury__exception__builtin_catch_model_semi(MR_Mercury_Type_Info type_info, } } - #ifdef MR_USE_GCC_NESTED_FUNCTIONS - -void MR_CALL -mercury__exception__builtin_catch_model_non(MR_Mercury_Type_Info type_info, - MR_Pred pred, MR_Pred handler_pred, MR_Box *output, - MR_NestedCont cont) -{ - ML_ExceptionHandler this_handler; - ML_DECLARE_AGC_HANDLER - - auto void MR_CALL success_cont(void); - void MR_CALL success_cont(void) { - /* - ** If we reach here, it means that - ** the nondet goal has succeeded, so we - ** need to restore the previous exception - ** handler before calling its continuation - */ - ML_SET_EXCEPTION_HANDLER(this_handler.prev); - (*cont)(); - - /* - ** If we get here, it means that the continuation - ** has failed, and so we are about to redo the - ** nondet goal. Thus we need to re-establish - ** its exception handler. - */ - ML_SET_EXCEPTION_HANDLER(&this_handler); - } - - this_handler.prev = ML_GET_EXCEPTION_HANDLER(); - ML_SET_EXCEPTION_HANDLER(&this_handler); - - ML_INSTALL_AGC_HANDLER(type_info, handler_pred); - - #ifdef MR_DEBUG_JMPBUFS - fprintf(stderr, ""noncatch setjmp %p\\n"", this_handler.handler); - #endif - - if (setjmp(this_handler.handler) == 0) { - ML_call_goal_non_handcoded(type_info, pred, output, - success_cont); - ML_SET_EXCEPTION_HANDLER(this_handler.prev); - ML_UNINSTALL_AGC_HANDLER(); - } else { - #ifdef MR_DEBUG_JMPBUFS - fprintf(stderr, ""noncatch caught jmp %p\\n"", this_handler.handler); - #endif - - ML_SET_EXCEPTION_HANDLER(this_handler.prev); - ML_UNINSTALL_AGC_HANDLER(); - ML_call_handler_det_handcoded( - ML_AGC_LOCAL(type_info), ML_AGC_LOCAL(handler_pred), - this_handler.exception, output); - (*cont)(); - } -} - - #else /* ! MR_USE_GCC_NESTED_FUNCTIONS */ - struct ML_catch_env { ML_ExceptionHandler this_handler; MR_Cont cont; @@ -1239,8 +1173,6 @@ mercury__exception__builtin_catch_model_non(MR_Mercury_Type_Info type_info, } } - #endif /* ! MR_USE_GCC_NESTED_FUNCTIONS */ - #endif /* MR_HIGHLEVEL_CODE */ "). diff --git a/runtime/mercury_conf_param.h b/runtime/mercury_conf_param.h index 33c73d1e0..20e4394d8 100644 --- a/runtime/mercury_conf_param.h +++ b/runtime/mercury_conf_param.h @@ -132,7 +132,6 @@ // // MR_HIGHLEVEL_CODE // MR_HIGHLEVEL_DATA -// MR_USE_GCC_NESTED_FUNCTIONS // MR_USE_GCC_GLOBAL_REGISTERS // MR_USE_GCC_NONLOCAL_GOTOS // MR_USE_ASM_LABELS @@ -160,7 +159,6 @@ // See the documentation for // --high-level-code // --high-level-data -// --gcc-nested-functions // --gcc-global-registers // --gcc-non-local-gotos // --gcc-asm-labels diff --git a/runtime/mercury_grade.h b/runtime/mercury_grade.h index 28473aaa2..501d5fdd8 100644 --- a/runtime/mercury_grade.h +++ b/runtime/mercury_grade.h @@ -91,22 +91,15 @@ #define MR_GRADE_OPT_PART_1 "hlc" #endif - #ifdef MR_USE_GCC_NESTED_FUNCTIONS - #define MR_GRADE_PART_2 MR_PASTE2(MR_GRADE_PART_1, _nest) - #define MR_GRADE_OPT_PART_2 MR_GRADE_OPT_PART_1 "_nest" - #else - #define MR_GRADE_PART_2 MR_GRADE_PART_1 - #define MR_GRADE_OPT_PART_2 MR_GRADE_OPT_PART_1 - #endif + // Grade component 2 used to specify the use/nonuse of gcc nested functions. // This grade component is repeated below version information. - #ifdef MR_THREAD_SAFE - #define MR_GRADE_PART_3 MR_PASTE2(MR_GRADE_PART_2, _par) - #define MR_GRADE_OPT_PART_3 MR_GRADE_OPT_PART_2 ".par" + #define MR_GRADE_PART_3 MR_PASTE2(MR_GRADE_PART_1, _par) + #define MR_GRADE_OPT_PART_3 MR_GRADE_OPT_PART_1 ".par" #else - #define MR_GRADE_PART_3 MR_GRADE_PART_2 - #define MR_GRADE_OPT_PART_3 MR_GRADE_OPT_PART_2 + #define MR_GRADE_PART_3 MR_GRADE_PART_1 + #define MR_GRADE_OPT_PART_3 MR_GRADE_OPT_PART_1 #endif #else // ! MR_HIGHLEVEL_CODE diff --git a/runtime/mercury_hlc_types.h b/runtime/mercury_hlc_types.h index 73596e992..f6bdf8283 100644 --- a/runtime/mercury_hlc_types.h +++ b/runtime/mercury_hlc_types.h @@ -18,8 +18,7 @@ // The continuation function types used for implementing // nondeterministic procedures. -typedef void MR_CALL (*MR_NestedCont) (void); // for --gcc-nested-functions -typedef void MR_CALL (*MR_Cont) (void *); // for --no-gcc-nested-functions +typedef void MR_CALL (*MR_Cont) (void *); // The types uses to represent the Mercury builtin types, // MR_Char, MR_Float, MR_Integer, MR_String, and MR_ConstString, diff --git a/runtime/mercury_tabling.c b/runtime/mercury_tabling.c index 358c8d55d..5175a3661 100644 --- a/runtime/mercury_tabling.c +++ b/runtime/mercury_tabling.c @@ -1285,116 +1285,59 @@ MR_print_answerblock(FILE *fp, const MR_ProcLayout *proc, } #ifdef MR_HIGHLEVEL_CODE - #ifdef MR_USE_GCC_NESTED_FUNCTIONS + static void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_2_p_0( + MR_AnswerList answer_list0, MR_Box *boxed_answer_block, + MR_Cont cont, void *cont_env_ptr); - static void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_2_p_0( - MR_AnswerList answer_list0, MR_Box *boxed_answer_block, - MR_NestedCont cont); + static void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_2_p_0( + MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr, + MR_Cont cont, void *cont_env_ptr) + { + MR_AnswerList answer_list; - static void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_2_p_0( - MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr, - MR_NestedCont cont) - { - MR_AnswerList answer_list; - while (answer_list0 != NULL) { - answer_list = answer_list0->MR_aln_next_answer; - *boxed_answer_block_ptr = - (MR_Box) answer_list0->MR_aln_answer_block; - cont(); - answer_list0 = answer_list; - } + while (answer_list0 != NULL) { + answer_list = answer_list0->MR_aln_next_answer; + *boxed_answer_block_ptr = + (MR_Box) answer_list0->MR_aln_answer_block; + cont(cont_env_ptr); + answer_list0 = answer_list; } + } - void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( - MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, - MR_NestedCont cont) - { - MR_MemoNonRecordPtr record; - MR_AnswerList list; + void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( + MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, + MR_Cont cont, void *cont_env_ptr) + { + MR_MemoNonRecordPtr record; + MR_AnswerList list; - record = (MR_MemoNonRecordPtr) boxed_record; - list = record->MR_mn_answer_list; - if (list == NULL) { - MR_fatal_error( - "table_memo_return_all_answers_multi: no answers"); - } - mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, - boxed_answer_block_ptr, cont); + record = (MR_MemoNonRecordPtr) boxed_record; + list = record->MR_mn_answer_list; + if (list == NULL) { + MR_fatal_error( + "table_memo_return_all_answers_multi: no answers"); } + mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, + boxed_answer_block_ptr, cont, cont_env_ptr); + } - void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( - MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, - MR_NestedCont cont) - { - MR_MemoNonRecordPtr record; - MR_AnswerList list; + void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( + MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, + MR_Cont cont, void *cont_env_ptr) + { + MR_MemoNonRecordPtr record; + MR_AnswerList list; - record = (MR_MemoNonRecordPtr) boxed_record; - list = record->MR_mn_answer_list; - mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, - boxed_answer_block_ptr, cont); - } + record = (MR_MemoNonRecordPtr) boxed_record; + list = record->MR_mn_answer_list; + mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, + boxed_answer_block_ptr, cont, cont_env_ptr); + } - #else // ! MR_USE_GCC_NESTED_FUNCTIONS - - static void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_2_p_0( - MR_AnswerList answer_list0, MR_Box *boxed_answer_block, - MR_Cont cont, void *cont_env_ptr); - - static void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_2_p_0( - MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr, - MR_Cont cont, void *cont_env_ptr) - { - MR_AnswerList answer_list; - - while (answer_list0 != NULL) { - answer_list = answer_list0->MR_aln_next_answer; - *boxed_answer_block_ptr = - (MR_Box) answer_list0->MR_aln_answer_block; - cont(cont_env_ptr); - answer_list0 = answer_list; - } - } - - void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( - MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, - MR_Cont cont, void *cont_env_ptr) - { - MR_MemoNonRecordPtr record; - MR_AnswerList list; - - record = (MR_MemoNonRecordPtr) boxed_record; - list = record->MR_mn_answer_list; - if (list == NULL) { - MR_fatal_error( - "table_memo_return_all_answers_multi: no answers"); - } - mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, - boxed_answer_block_ptr, cont, cont_env_ptr); - } - - void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( - MR_Box boxed_record, MR_Box *boxed_answer_block_ptr, - MR_Cont cont, void *cont_env_ptr) - { - MR_MemoNonRecordPtr record; - MR_AnswerList list; - - record = (MR_MemoNonRecordPtr) boxed_record; - list = record->MR_mn_answer_list; - mercury__table_builtin__table_memo_return_all_answers_2_p_0(list, - boxed_answer_block_ptr, cont, cont_env_ptr); - } - - #endif // MR_USE_GCC_NESTED_FUNCTIONS #else // MR_HIGHLEVEL_CODE MR_define_extern_entry(MR_MEMO_NON_RET_ALL_NONDET_ENTRY); diff --git a/runtime/mercury_tabling.h b/runtime/mercury_tabling.h index a13506b74..32fb11076 100644 --- a/runtime/mercury_tabling.h +++ b/runtime/mercury_tabling.h @@ -597,28 +597,15 @@ extern void MR_print_answerblock(FILE *fp, //////////////////////////////////////////////////////////////////////////// #ifdef MR_HIGHLEVEL_CODE - #ifdef MR_USE_GCC_NESTED_FUNCTIONS - extern void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( - MR_Box record, MR_Box *answer_block_ptr, - MR_NestedCont cont); - - extern void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( - MR_Box record, MR_Box *answer_block_ptr, - MR_NestedCont cont); - #else // ! MR_USE_GCC_NESTED_FUNCTIONS - extern void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( - MR_Box record, MR_Box *answer_block_ptr, - MR_Cont cont, void *cont_env_ptr); - - extern void MR_CALL - mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( - MR_Box record, MR_Box *answer_block_ptr, - MR_Cont cont, void *cont_env_ptr); - #endif // MR_USE_GCC_NESTED_FUNCTIONS + extern void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0( + MR_Box record, MR_Box *answer_block_ptr, + MR_Cont cont, void *cont_env_ptr); + extern void MR_CALL + mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0( + MR_Box record, MR_Box *answer_block_ptr, + MR_Cont cont, void *cont_env_ptr); #else // ! MR_HIGHLEVEL_CODE #define MR_MEMO_NON_RET_ALL_NONDET_ENTRY \ MR_proc_entry_user_name(table_builtin, \ diff --git a/scripts/canonical_grade.sh-subr b/scripts/canonical_grade.sh-subr index 351c8e213..ae058c99d 100644 --- a/scripts/canonical_grade.sh-subr +++ b/scripts/canonical_grade.sh-subr @@ -38,7 +38,7 @@ case $asm_labels in esac case $highlevel_code,$highlevel_data,$GRADE,$target in - true,true,none,*) + true,true,none,*) case $target in c|asm) GRADE="hl" ;; csharp) GRADE="csharp" ;; @@ -51,7 +51,7 @@ case $highlevel_code,$highlevel_data,$GRADE,$target in ;; esac ;; - true,false,none,*) + true,false,none,*) case $target in c|asm) GRADE="hlc" ;; *) @@ -76,11 +76,6 @@ case $highlevel_code,$highlevel_data,$GRADE,$target in ;; esac -case $gcc_nested_functions,$highlevel_code in - true,true) GRADE="${GRADE}_nest" ;; - *) ;; -esac - case $thread_safe,$threadscope in true,false) GRADE="$GRADE.par" ;; true,true) GRADE="$GRADE.par.threadscope" ;; diff --git a/scripts/init_grade_options.sh-subr b/scripts/init_grade_options.sh-subr index 242fe27e7..0f4a478a9 100644 --- a/scripts/init_grade_options.sh-subr +++ b/scripts/init_grade_options.sh-subr @@ -56,7 +56,6 @@ Grade options: See the documentation in the \"Invocation\" section of the Mercury User's Guide." -# --gcc-nested-functions is not yet documented because it is not yet stable # --high-level-data is not yet documented because it is not yet implemented # --high-level is not yet documented because --high-level-data is # not yet implemented @@ -66,7 +65,6 @@ Grade options: target=c highlevel_code=false highlevel_data=false -gcc_nested_functions=false asm_labels=true non_local_gotos=true global_regs=true diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in index 2ee7f03a1..cc4b8cdd2 100644 --- a/scripts/mgnuc.in +++ b/scripts/mgnuc.in @@ -275,11 +275,6 @@ case $highlevel_data in false) HLD_OPTS="" ;; esac -case $gcc_nested_functions in - true) NEST_OPTS="-DMR_USE_GCC_NESTED_FUNCTIONS" ;; - false) NEST_OPTS="" ;; -esac - case $asm_labels in true) ASM_OPTS="-DMR_USE_ASM_LABELS" ;; false) ASM_OPTS="" ;; diff --git a/scripts/parse_grade_options.sh-subr b/scripts/parse_grade_options.sh-subr index 152aeb090..87d375aad 100644 --- a/scripts/parse_grade_options.sh-subr +++ b/scripts/parse_grade_options.sh-subr @@ -58,11 +58,6 @@ --no-high-level-data) highlevel_data=false ;; - --gcc-nested-functions) - gcc_nested_functions=true ;; - --no-gcc-nested-functions) - gcc_nested_functions=false ;; - --asm-labels) asm_labels=true ;; --no-asm-labels) @@ -235,7 +230,6 @@ target=c highlevel_code=false - gcc_nested_functions=false highlevel_data=false asm_labels=false non_local_gotos=false @@ -275,7 +269,6 @@ non_local_gotos=false global_regs=false highlevel_code=true - gcc_nested_functions=false highlevel_data=true ;; java) @@ -284,7 +277,6 @@ non_local_gotos=false global_regs=false highlevel_code=true - gcc_nested_functions=false highlevel_data=true ;; erlang) @@ -293,7 +285,6 @@ non_local_gotos=false global_regs=false highlevel_code=true - gcc_nested_functions=false highlevel_data=true ;; hl) @@ -301,7 +292,6 @@ non_local_gotos=false global_regs=false highlevel_code=true - gcc_nested_functions=false highlevel_data=true ;; hlc) @@ -309,23 +299,6 @@ non_local_gotos=false global_regs=false highlevel_code=true - gcc_nested_functions=false - highlevel_data=false - ;; - hl_nest) - asm_labels=false - non_local_gotos=false - global_regs=false - highlevel_code=true - gcc_nested_functions=true - highlevel_data=true - ;; - hlc_nest) - asm_labels=false - non_local_gotos=false - global_regs=false - highlevel_code=true - gcc_nested_functions=true highlevel_data=false ;; asm_fast) @@ -334,7 +307,6 @@ non_local_gotos=true global_regs=true highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;; asm_jump) @@ -343,7 +315,6 @@ non_local_gotos=true global_regs=false highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;; fast) @@ -352,7 +323,6 @@ non_local_gotos=true global_regs=true highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;; jump) @@ -361,7 +331,6 @@ non_local_gotos=true global_regs=false highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;; reg) @@ -370,7 +339,6 @@ non_local_gotos=false global_regs=true highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;; none) @@ -379,7 +347,6 @@ non_local_gotos=false global_regs=false highlevel_code=false - gcc_nested_functions=false highlevel_data=false ;;