From d442a01de4901a06a491cdb94284bbbd813730a3 Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Thu, 23 Jun 2022 20:51:01 +0100 Subject: [PATCH] Fix for Jira bug I7-2164 --- docs/assertions-module/3-nuor.html | 2 + docs/core-module/1-cs.html | 2 + docs/core-module/1-htc.html | 1 + docs/runtime-module/2-ea.html | 6 +- docs/runtime-module/2-ec.html | 14 +- docs/runtime-module/2-emt.html | 4 +- docs/runtime-module/2-gpr.html | 8 +- docs/runtime-module/2-hrr.html | 20 +-- docs/runtime-module/5-act2.html | 4 +- docs/runtime-module/7-cg.html | 141 ++++++++++-------- docs/runtime-module/7-cgl.html | 4 +- docs/runtime-module/7-cgt.html | 6 +- docs/runtime-module/7-kg.html | 8 +- docs/runtime-module/7-pnp.html | 4 +- inform7/Figures/memory-diagnostics.txt | 60 ++++---- inform7/Figures/timings-diagnostics.txt | 58 +++---- .../Chapter 3/New Use Option Requests.w | 2 + .../Chapter 1/Compilation Settings.w | 2 + .../core-module/Chapter 1/How To Compile.w | 1 + .../Chapter 7/Command Grammars.w | 16 +- 20 files changed, 199 insertions(+), 164 deletions(-) diff --git a/docs/assertions-module/3-nuor.html b/docs/assertions-module/3-nuor.html index d7dba8f435..51cf351e23 100644 --- a/docs/assertions-module/3-nuor.html +++ b/docs/assertions-module/3-nuor.html @@ -256,6 +256,8 @@

LOOP_OVER(ms, i6_memory_setting) if (Str::eq(identifier, ms->ICL_identifier)) { if (ms->number < n) ms->number = n; + if (Str::eq(identifier, I"DICT_WORD_SIZE")) + global_compilation_settings.dict_word_size = n; return; } ms = CREATE(i6_memory_setting); diff --git a/docs/core-module/1-cs.html b/docs/core-module/1-cs.html index e582ad061d..35471f8f38 100644 --- a/docs/core-module/1-cs.html +++ b/docs/core-module/1-cs.html @@ -144,6 +144,7 @@

int serial_comma; int undo_prevention; int use_exact_parsing_option; + int dict_word_size; } compilation_settings; compilation_settings global_compilation_settings; @@ -170,6 +171,7 @@

global_compilation_settings.serial_comma = FALSE; global_compilation_settings.undo_prevention = FALSE; global_compilation_settings.use_exact_parsing_option = FALSE; + global_compilation_settings.dict_word_size = -1; }

§5. And when (for example) a "Use..." sentence triggers one of these, the diff --git a/docs/core-module/1-htc.html b/docs/core-module/1-htc.html index eb06605abf..c983da8ea4 100644 --- a/docs/core-module/1-htc.html +++ b/docs/core-module/1-htc.html @@ -299,6 +299,7 @@

Task::advance_stage_to(INTER1_CSEQ, I"Generating inter (1)", 4, debugging, sequence_timer); BENCH(RTUseOptions::compile) + BENCH(RTCommandGrammars::compile_non_generic_constants) BENCH(Interventions::make_all) BENCH(RTKindConstructors::compile) BENCH(RTLiteralPatterns::compile) diff --git a/docs/runtime-module/2-ea.html b/docs/runtime-module/2-ea.html index db944ff51f..2f30dc6aee 100644 --- a/docs/runtime-module/2-ea.html +++ b/docs/runtime-module/2-ea.html @@ -115,7 +115,7 @@

return save; } -packaging_state EmitArrays::begin_verb(inter_name *name, kind *K) { +packaging_state EmitArrays::begin_verb(inter_name *name, kind *K) { packaging_state save = Packaging::enter_home_of(name); EmitArrays::begin_inner(name, K, FALSE, CONST_LIST_FORMAT_GRAMMAR); return save; @@ -171,7 +171,7 @@

EmitArrays::entry_inner(val); } -void EmitArrays::dword_entry(text_stream *content) { +void EmitArrays::dword_entry(text_stream *content) { inter_pair val = InterValuePairs::from_singular_dword(Emit::at(), content); EmitArrays::entry_inner(val); } @@ -189,7 +189,7 @@

-void EmitArrays::end(packaging_state save) {
+void EmitArrays::end(packaging_state save) {
     EmitArrays::end_inner();
     Packaging::exit(Emit::tree(), save);
 }
diff --git a/docs/runtime-module/2-ec.html b/docs/runtime-module/2-ec.html
index fcf90f6a80..29181f4d54 100644
--- a/docs/runtime-module/2-ec.html
+++ b/docs/runtime-module/2-ec.html
@@ -95,10 +95,10 @@ 

  • EmitCode::up then returns us back to where we were.
  • -void EmitCode::up(void) {
    +void EmitCode::up(void) {
         Produce::up(Emit::tree());
     }
    -void EmitCode::down(void) {
    +void EmitCode::down(void) {
         Produce::down(Emit::tree());
     }
     
    @@ -150,7 +150,7 @@

    Produce::val(Emit::tree(), K_truth_state, InterValuePairs::number(0)); } -void EmitCode::val_iname(kind *K, inter_name *iname) { +void EmitCode::val_iname(kind *K, inter_name *iname) { Produce::val_iname(Emit::tree(), K, iname); } @@ -170,7 +170,7 @@

    Produce::val_nothing(Emit::tree()); } -void EmitCode::val_symbol(kind *K, inter_symbol *S) { +void EmitCode::val_symbol(kind *K, inter_symbol *S) { Produce::val_symbol(Emit::tree(), K, S); }

    @@ -265,11 +265,11 @@

    -void EmitCode::ref_iname(kind *K, inter_name *iname) {
    +void EmitCode::ref_iname(kind *K, inter_name *iname) {
         Produce::ref_iname(Emit::tree(), K, iname);
     }
     
    -void EmitCode::ref_symbol(kind *K, inter_symbol *S) {
    +void EmitCode::ref_symbol(kind *K, inter_symbol *S) {
         Produce::ref_symbol(Emit::tree(), K, S);
     }
     
    @@ -277,7 +277,7 @@

    -void EmitCode::inv(inter_ti bip) {
    +void EmitCode::inv(inter_ti bip) {
         Produce::inv_primitive(Emit::tree(), bip);
     }
     
    diff --git a/docs/runtime-module/2-emt.html b/docs/runtime-module/2-emt.html
    index c1e64ec8e5..10edc9e983 100644
    --- a/docs/runtime-module/2-emt.html
    +++ b/docs/runtime-module/2-emt.html
    @@ -79,7 +79,7 @@ 

    LargeScale::begin_new_tree(main_emission_tree); return main_emission_tree; } -inter_tree *Emit::tree(void) { +inter_tree *Emit::tree(void) { return main_emission_tree; } @@ -193,7 +193,7 @@

    -inter_name *Emit::numeric_constant(inter_name *con_iname, inter_ti val) {
    +inter_name *Emit::numeric_constant(inter_name *con_iname, inter_ti val) {
         return Emit::numeric_constant_inner(con_iname,
             InterValuePairs::number_in_base(val, 10), INT32_ITCONC);
     }
    diff --git a/docs/runtime-module/2-gpr.html b/docs/runtime-module/2-gpr.html
    index 6edc389d9c..280b052f34 100644
    --- a/docs/runtime-module/2-gpr.html
    +++ b/docs/runtime-module/2-gpr.html
    @@ -145,7 +145,7 @@ 

    -gpr_kit GPRs::new_kit(void) {
    +gpr_kit GPRs::new_kit(void) {
         gpr_kit kit;
         kit.cur_addr_s = NULL;
         kit.cur_len_s = NULL;
    @@ -188,7 +188,7 @@ 

    -void GPRs::add_standard_vars(gpr_kit *kit) {
    +void GPRs::add_standard_vars(gpr_kit *kit) {
         kit->group_wn_s = LocalVariables::new_internal_as_symbol(I"group_wn");
         kit->v_s = LocalVariables::new_internal_as_symbol(I"v");
         kit->w_s = LocalVariables::new_internal_as_symbol(I"w");
    @@ -200,14 +200,14 @@ 

    kit->instance_s = LocalVariables::new_other_as_symbol(I"instance"); } -void GPRs::add_range_vars(gpr_kit *kit) { +void GPRs::add_range_vars(gpr_kit *kit) { kit->range_from_s = LocalVariables::new_internal_commented_as_symbol(I"range_from", I"call parameter: word number of snippet start"); kit->range_words_s = LocalVariables::new_internal_commented_as_symbol(I"range_words", I"call parameter: snippet length"); } -void GPRs::add_original_var(gpr_kit *kit) { +void GPRs::add_original_var(gpr_kit *kit) { kit->original_wn_s = LocalVariables::new_internal_as_symbol(I"original_wn"); } diff --git a/docs/runtime-module/2-hrr.html b/docs/runtime-module/2-hrr.html index 3989e42e59..fcb129954d 100644 --- a/docs/runtime-module/2-hrr.html +++ b/docs/runtime-module/2-hrr.html @@ -2234,7 +2234,7 @@

    -inter_name *Hierarchy::find(int id) {
    +inter_name *Hierarchy::find(int id) {
         return HierarchyLocations::iname(Emit::tree(), id);
     }
     
    @@ -2257,7 +2257,7 @@

    -inter_name *Hierarchy::make_iname_in(int id, package_request *P) {
    +inter_name *Hierarchy::make_iname_in(int id, package_request *P) {
         return HierarchyLocations::make_iname_in(Emit::tree(), id, P);
     }
     
    @@ -2319,7 +2319,7 @@

    -void Hierarchy::make_available(inter_name *iname) {
    +void Hierarchy::make_available(inter_name *iname) {
         text_stream *ma_as = InterNames::get_translation(iname);
         if (Str::len(ma_as) == 0) ma_as = InterNames::to_text(iname);
         LargeScale::package_type(Emit::tree(), I"_linkage");
    @@ -2385,7 +2385,7 @@ 

    return HierarchyLocations::attach_new_package(Emit::tree(), NULL, NULL, hap_id); } -package_request *Hierarchy::completion_package(int hap_id) { +package_request *Hierarchy::completion_package(int hap_id) { return HierarchyLocations::attach_new_package(Emit::tree(), NULL, NULL, hap_id); }

    @@ -2408,7 +2408,7 @@

    -package_request *Hierarchy::package_within(int hap_id, package_request *super) {
    +package_request *Hierarchy::package_within(int hap_id, package_request *super) {
         return HierarchyLocations::attach_new_package(Emit::tree(), NULL, super, hap_id);
     }
     
    @@ -2425,29 +2425,29 @@

    -void Hierarchy::apply_metadata(package_request *P, int id, text_stream *value) {
    +void Hierarchy::apply_metadata(package_request *P, int id, text_stream *value) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::text_constant(iname, value);
     }
     
    -void Hierarchy::apply_metadata_from_number(package_request *P, int id, inter_ti N) {
    +void Hierarchy::apply_metadata_from_number(package_request *P, int id, inter_ti N) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::numeric_constant(iname, N);
     }
     
    -void Hierarchy::apply_metadata_from_iname(package_request *P, int id, inter_name *val) {
    +void Hierarchy::apply_metadata_from_iname(package_request *P, int id, inter_name *val) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::iname_constant(iname, K_value, val);
     }
     
    -void Hierarchy::apply_metadata_from_wording(package_request *P, int id, wording W) {
    +void Hierarchy::apply_metadata_from_wording(package_request *P, int id, wording W) {
         TEMPORARY_TEXT(ANT)
         WRITE_TO(ANT, "%W", W);
         Hierarchy::apply_metadata(P, id, ANT);
         DISCARD_TEXT(ANT)
     }
     
    -void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
    +void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
         TEMPORARY_TEXT(ANT)
         WRITE_TO(ANT, "%+W", W);
         Hierarchy::apply_metadata(P, id, ANT);
    diff --git a/docs/runtime-module/5-act2.html b/docs/runtime-module/5-act2.html
    index 40fbccb790..40b630e8b0 100644
    --- a/docs/runtime-module/5-act2.html
    +++ b/docs/runtime-module/5-act2.html
    @@ -100,7 +100,7 @@ 

    -package_request *RTActions::package(action_name *an) {
    +package_request *RTActions::package(action_name *an) {
         if (an->compilation_data.an_package == NULL)
             an->compilation_data.an_package =
                 Hierarchy::local_package_to(ACTIONS_HAP, an->compilation_data.where_created);
    @@ -171,7 +171,7 @@ 

    -inter_name *RTActions::double_sharp(action_name *an) {
    +inter_name *RTActions::double_sharp(action_name *an) {
         if (an->compilation_data.an_double_sharp_iname == NULL)
             an->compilation_data.an_double_sharp_iname =
                 Hierarchy::derive_iname_in(DOUBLE_SHARP_NAME_HL,
    diff --git a/docs/runtime-module/7-cg.html b/docs/runtime-module/7-cg.html
    index a97037cf89..8f88bb3eb5 100644
    --- a/docs/runtime-module/7-cg.html
    +++ b/docs/runtime-module/7-cg.html
    @@ -59,7 +59,7 @@ 

    Runtime support for CGs.

    -
    +

    §1. Generic constants. Here, REPARSE_CODE is a magic value used in CommandParserKit to signal that some code which ought to have been parsing a command has in @@ -70,32 +70,45 @@

    void RTCommandGrammars::compile_generic_constants(void) { target_vm *VM = Task::vm(); if (TargetVMs::is_16_bit(VM)) { - RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 10000); - RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, 6); + RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 10000); } else { - RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 0x40000000); - RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, 9); + RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 0x40000000); } - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_META_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NOUN_FILTER_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SCOPE_FILTER_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_REVERSE_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SLASH_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_DIVIDER_HL, 1); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_RESULT_HL, 2); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SPECIAL_HL, 3); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NUMBER_HL, 4); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NOUN_HL, 5); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTI_HL, 6); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIINSIDE_HL, 7); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIHELD_HL, 8); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_HELD_HL, 9); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_CREATURE_HL, 10); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_TOPIC_HL, 11); - RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIEXCEPT_HL, 12); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_META_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NOUN_FILTER_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SCOPE_FILTER_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_REVERSE_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SLASH_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_DIVIDER_HL, 1); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_RESULT_HL, 2); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_SPECIAL_HL, 3); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NUMBER_HL, 4); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NOUN_HL, 5); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTI_HL, 6); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIINSIDE_HL, 7); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIHELD_HL, 8); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_HELD_HL, 9); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_CREATURE_HL, 10); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_TOPIC_HL, 11); + RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIEXCEPT_HL, 12); }

    -

    §2.

    +

    §2. This one is compiled later, since it depends (potentially) on a use option: +

    + +
    +void RTCommandGrammars::compile_non_generic_constants(void) {
    +    target_vm *VM = Task::vm();
    +    int N = global_compilation_settings.dict_word_size;
    +    if (TargetVMs::is_16_bit(VM)) {
    +        if (N <= 0) N = 6;
    +    } else {
    +        if (N <= 0) N = 9;
    +    }
    +    RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, N);
    +}
    +
    +

    §3.

     inter_name *RTCommandGrammars::iname_for_I6_parser_token(cg_token *cgt) {
    @@ -113,14 +126,14 @@ 

    return NULL; to prevent a compiler error: never reached } -inter_name *RTCommandGrammars::grammar_constant(int N, int V) { +inter_name *RTCommandGrammars::grammar_constant(int N, int V) { inter_name *iname = Hierarchy::find(N); Emit::numeric_constant(iname, (inter_ti) V); Hierarchy::make_available(iname); return iname; }

    -

    §3. Compilation data. Each command_grammar object contains this data: +

    §4. Compilation data. Each command_grammar object contains this data:

    @@ -146,39 +159,39 @@ 

    }

    • The structure cg_compilation_data is private to this section.
    -

    §4. In fact, however, only four of the six CG types live in their own packages, +

    §5. In fact, however, only four of the six CG types live in their own packages, so the following is not used for CG_IS_VALUE or CG_IS_SUBJECT grammars.

    -package_request *RTCommandGrammars::package(command_grammar *cg) {
    +package_request *RTCommandGrammars::package(command_grammar *cg) {
         if (cg->compilation_data.cg_package == NULL)
             cg->compilation_data.cg_package =
                 Hierarchy::completion_package(COMMAND_GRAMMARS_HAP);
         return cg->compilation_data.cg_package;
     }
     
    -

    §5. CG_IS_PROPERTY_NAME packages contain a function to match the value of +

    §6. CG_IS_PROPERTY_NAME packages contain a function to match the value of that property:

    -inter_name *RTCommandGrammars::get_property_GPR_fn_iname(command_grammar *cg) {
    +inter_name *RTCommandGrammars::get_property_GPR_fn_iname(command_grammar *cg) {
         if ((cg == NULL) || (cg->cg_is != CG_IS_PROPERTY_NAME))
             internal_error("prn_iname unavailable");
         if (cg->compilation_data.property_GPR_fn_iname == NULL)
             cg->compilation_data.property_GPR_fn_iname =
                 Hierarchy::make_iname_in(PROPERTY_GPR_FN_HL,
    -                RTCommandGrammars::package(cg));
    +                RTCommandGrammars::package(cg));
         return cg->compilation_data.property_GPR_fn_iname;
     }
     
    -

    §6. CG_IS_TOKEN packages contain a function to match that token. Note that these +

    §7. CG_IS_TOKEN packages contain a function to match that token. Note that these can be translated in order to have a particular identifier.

    -inter_name *RTCommandGrammars::get_cg_token_iname(command_grammar *cg) {
    +inter_name *RTCommandGrammars::get_cg_token_iname(command_grammar *cg) {
         if ((cg == NULL) || (cg->cg_is != CG_IS_TOKEN))
             internal_error("cg_token_iname unavailable");
         if (cg->compilation_data.cg_token_iname == NULL) {
    @@ -189,7 +202,7 @@ 

    else cg->compilation_data.cg_token_iname = Hierarchy::make_iname_in(PARSE_LINE_FN_HL, - RTCommandGrammars::package(cg)); + RTCommandGrammars::package(cg)); } return cg->compilation_data.cg_token_iname; } @@ -199,20 +212,20 @@

    WRITE_TO(cg->compilation_data.CG_IS_TOKEN_identifier, "%N", Wordings::first_wn(W)); }

    -

    §7. CG_IS_CONSULT packages contain a function which matches a snippet: +

    §8. CG_IS_CONSULT packages contain a function which matches a snippet:

    -inter_name *RTCommandGrammars::get_consult_fn_iname(command_grammar *cg) {
    +inter_name *RTCommandGrammars::get_consult_fn_iname(command_grammar *cg) {
         if ((cg == NULL) || (cg->cg_is != CG_IS_CONSULT))
             internal_error("cg_token_iname unavailable");
         if (cg->compilation_data.consult_fn_iname == NULL)
             cg->compilation_data.consult_fn_iname =
    -            Hierarchy::make_iname_in(CONSULT_FN_HL, RTCommandGrammars::package(cg));
    +            Hierarchy::make_iname_in(CONSULT_FN_HL, RTCommandGrammars::package(cg));
         return cg->compilation_data.consult_fn_iname;
     }
     
    -

    §8. Queued compilation. As noted above, not all types of command grammar have their own packages. For +

    §9. Queued compilation. As noted above, not all types of command grammar have their own packages. For those which do, we queue compilation requests with suitable agents.

    @@ -224,7 +237,7 @@

    if (cg->cg_is == CG_IS_TOKEN) { text_stream *desc = Str::new(); WRITE_TO(desc, "command grammar for token"); - Sequence::queue_at(&RTCommandGrammars::token_agent, + Sequence::queue_at(&RTCommandGrammars::token_agent, STORE_POINTER_command_grammar(cg), desc, cg->where_cg_created); } @@ -232,7 +245,7 @@

    if (cg->cg_is == CG_IS_COMMAND) { text_stream *desc = Str::new(); WRITE_TO(desc, "command grammar for command '%W'", cg->command); - Sequence::queue_at(&RTCommandGrammars::command_agent, + Sequence::queue_at(&RTCommandGrammars::command_agent, STORE_POINTER_command_grammar(cg), desc, cg->where_cg_created); } @@ -241,7 +254,7 @@

    text_stream *desc = Str::new(); WRITE_TO(desc, "command grammar for consult at '%W'", Node::get_text(cg->where_cg_created)); - Sequence::queue_at(&RTCommandGrammars::consult_agent, + Sequence::queue_at(&RTCommandGrammars::consult_agent, STORE_POINTER_command_grammar(cg), desc, cg->where_cg_created); } @@ -250,21 +263,21 @@

    text_stream *desc = Str::new(); WRITE_TO(desc, "command grammar for property '%W'", cg->prn_understood->name); - Sequence::queue_at(&RTCommandGrammars::property_agent, + Sequence::queue_at(&RTCommandGrammars::property_agent, STORE_POINTER_command_grammar(cg), desc, cg->where_cg_created); } }

    -

    §9. Compiling CG_IS_TOKEN grammars.

    +

    §10. Compiling CG_IS_TOKEN grammars.

    -void RTCommandGrammars::token_agent(compilation_subtask *t) {
    +void RTCommandGrammars::token_agent(compilation_subtask *t) {
         command_grammar *cg = RETRIEVE_POINTER_command_grammar(t->data);
         if (CGLines::list_length(cg) == 0) return;
         LOGIF(GRAMMAR, "Compiling command grammar $G\n", cg);
     
         gpr_kit kit = GPRs::new_kit();
    -    inter_name *iname = RTCommandGrammars::get_cg_token_iname(cg);
    +    inter_name *iname = RTCommandGrammars::get_cg_token_iname(cg);
         packaging_state save = Functions::begin(iname);
         GPRs::add_original_var(&kit);
         GPRs::add_standard_vars(&kit);
    @@ -278,7 +291,7 @@ 

    EmitCode::ref_symbol(K_value, kit.rv_s); EmitCode::val_iname(K_value, Hierarchy::find(GPR_PREPOSITION_HL)); EmitCode::up(); - RTCommandGrammars::compile_general(&kit, cg); + RTCommandGrammars::compile_general(&kit, cg); EmitCode::inv(RETURN_BIP); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_FAIL_HL)); @@ -286,10 +299,10 @@

    Functions::end(save); }

    -

    §10. Compiling CG_IS_COMMAND grammars.

    +

    §11. Compiling CG_IS_COMMAND grammars.

    -void RTCommandGrammars::command_agent(compilation_subtask *t) {
    +void RTCommandGrammars::command_agent(compilation_subtask *t) {
         command_grammar *cg = RETRIEVE_POINTER_command_grammar(t->data);
         if (CGLines::list_length(cg) == 0) return;
         LOGIF(GRAMMAR, "Compiling command grammar $G\n", cg);
    @@ -311,7 +324,7 @@ 

    DISCARD_TEXT(WD) } } - RTCommandGrammars::compile_general(NULL, cg); + RTCommandGrammars::compile_general(NULL, cg); EmitArrays::end(save); if (Wordings::empty(cg->command)) { @@ -320,16 +333,16 @@

    } }

    -

    §11. Compiling CG_IS_CONSULT grammars.

    +

    §12. Compiling CG_IS_CONSULT grammars.

    -void RTCommandGrammars::consult_agent(compilation_subtask *t) {
    +void RTCommandGrammars::consult_agent(compilation_subtask *t) {
         command_grammar *cg = RETRIEVE_POINTER_command_grammar(t->data);
         if (CGLines::list_length(cg) == 0) return;
         LOGIF(GRAMMAR, "Compiling command grammar $G\n", cg);
     
         gpr_kit kit = GPRs::new_kit();
    -    inter_name *iname = RTCommandGrammars::get_consult_fn_iname(cg);
    +    inter_name *iname = RTCommandGrammars::get_consult_fn_iname(cg);
         packaging_state save = Functions::begin(iname);
         GPRs::add_range_vars(&kit);
         GPRs::add_original_var(&kit);
    @@ -349,7 +362,7 @@ 

    EmitCode::ref_symbol(K_value, kit.rv_s); EmitCode::val_iname(K_value, Hierarchy::find(GPR_PREPOSITION_HL)); EmitCode::up(); - RTCommandGrammars::compile_general(&kit, cg); + RTCommandGrammars::compile_general(&kit, cg); EmitCode::inv(RETURN_BIP); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_FAIL_HL)); @@ -357,16 +370,16 @@

    Functions::end(save); }

    -

    §12. Compiling CG_IS_PROPERTY grammars.

    +

    §13. Compiling CG_IS_PROPERTY grammars.

    -void RTCommandGrammars::property_agent(compilation_subtask *t) {
    +void RTCommandGrammars::property_agent(compilation_subtask *t) {
         command_grammar *cg = RETRIEVE_POINTER_command_grammar(t->data);
         if (CGLines::list_length(cg) == 0) return;
         LOGIF(GRAMMAR, "Compiling command grammar $G\n", cg);
     
         gpr_kit kit = GPRs::new_kit();
    -    inter_name *iname = RTCommandGrammars::get_property_GPR_fn_iname(cg);
    +    inter_name *iname = RTCommandGrammars::get_property_GPR_fn_iname(cg);
         packaging_state save = Functions::begin(iname);
         GPRs::add_original_var(&kit);
         GPRs::add_standard_vars(&kit);
    @@ -380,7 +393,7 @@ 

    EmitCode::ref_symbol(K_value, kit.rv_s); EmitCode::val_iname(K_value, Hierarchy::find(GPR_PREPOSITION_HL)); EmitCode::up(); - RTCommandGrammars::compile_general(&kit, cg); + RTCommandGrammars::compile_general(&kit, cg); EmitCode::inv(RETURN_BIP); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_FAIL_HL)); @@ -388,7 +401,7 @@

    Functions::end(save); }

    -

    §13. Compiling CG_IS_VALUE grammars. These are not compiled into their own packages, but into the body of GPRs +

    §14. Compiling CG_IS_VALUE grammars. These are not compiled into their own packages, but into the body of GPRs to parse values of given kinds. So the following assumes that we are already in the middle of a GPR being compiled.

    @@ -400,11 +413,11 @@

    if (CGLines::list_length(cg) > 0) { LOGIF(GRAMMAR, "Compiling command grammar $G\n", cg); current_sentence = cg->where_cg_created; - RTCommandGrammars::compile_general(kit, cg); + RTCommandGrammars::compile_general(kit, cg); } }

    -

    §14. Compiling CG_IS_SUBJECT grammars. Again, these are not compiled into their own packages, but into the body of +

    §15. Compiling CG_IS_SUBJECT grammars. Again, these are not compiled into their own packages, but into the body of GPRs: in fact, they will be functions used as parse_name property values.

    @@ -428,7 +441,7 @@

    internal_error("link between subject and CG broken"); LOGIF(GRAMMAR, "Parse_name content for $j:\n", subj); - RTCommandGrammars::compile_general(kit, + RTCommandGrammars::compile_general(kit, PARSING_DATA_FOR_SUBJ(subj)->understand_as_this_subject); inference_subject *infs; @@ -437,13 +450,13 @@

    if (PARSING_DATA_FOR_SUBJ(infs)) if (PARSING_DATA_FOR_SUBJ(infs)->understand_as_this_subject) { LOGIF(GRAMMAR, "And parse_name content inherited from $j:\n", infs); - RTCommandGrammars::compile_general(kit, + RTCommandGrammars::compile_general(kit, PARSING_DATA_FOR_SUBJ(infs)->understand_as_this_subject); } } }

    -

    §15. Compiling all grammars. And so all of the above functions ultimately funnel down to this one. +

    §16. Compiling all grammars. And so all of the above functions ultimately funnel down to this one.

    At this level we compile the list of CGLs in sorted order: this is what the @@ -461,7 +474,7 @@

    -void RTCommandGrammars::compile_general(gpr_kit *kit, command_grammar *cg) {
    +void RTCommandGrammars::compile_general(gpr_kit *kit, command_grammar *cg) {
         RTCommandGrammarLines::list_assert_ownership(cg);
         CommandGrammars::sort_command_grammar(cg);
     
    @@ -472,7 +485,7 @@ 

    CommandGrammars::cg_is_genuinely_verbal(cg)); LOG_OUTDENT; - package_request *pack = RTCommandGrammars::package(cg); + package_request *pack = RTCommandGrammars::package(cg); int hl = -1; if (cg->cg_is == CG_IS_COMMAND) hl = CG_IS_COMMAND_MD_HL; if (cg->cg_is == CG_IS_TOKEN) hl = CG_IS_TOKEN_MD_HL; diff --git a/docs/runtime-module/7-cgl.html b/docs/runtime-module/7-cgl.html index 915249e52f..88455d91bd 100644 --- a/docs/runtime-module/7-cgl.html +++ b/docs/runtime-module/7-cgl.html @@ -157,7 +157,7 @@

    -void RTCommandGrammarLines::list_assert_ownership(command_grammar *cg) {
    +void RTCommandGrammarLines::list_assert_ownership(command_grammar *cg) {
         LOOP_THROUGH_UNSORTED_CG_LINES(cgl, cg)
             cgl->compilation_data.belongs_to_cg = cg;
     }
    @@ -182,7 +182,7 @@ 

    -void RTCommandGrammarLines::compile_cg_line(gpr_kit *kit, cg_line *cgl, int cg_is,
    +void RTCommandGrammarLines::compile_cg_line(gpr_kit *kit, cg_line *cgl, int cg_is,
         int genuinely_verbal) {
         LOGIF(GRAMMAR, "Compiling grammar line: $g\n", cgl);
     
    diff --git a/docs/runtime-module/7-cgt.html b/docs/runtime-module/7-cgt.html
    index a338df0dad..3e9f4b91b6 100644
    --- a/docs/runtime-module/7-cgt.html
    +++ b/docs/runtime-module/7-cgt.html
    @@ -884,7 +884,7 @@ 

    -    inter_name *i6_token_iname = RTCommandGrammars::iname_for_I6_parser_token(cgt);
    +    inter_name *i6_token_iname = RTCommandGrammars::iname_for_I6_parser_token(cgt);
         if (code_mode) {
             EmitCode::inv(STORE_BIP);
             EmitCode::down();
    @@ -1056,7 +1056,7 @@ 

    EmitCode::call(Hierarchy::find(PARSETOKENSTOPPED_HL)); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_TT_HL)); - EmitCode::val_iname(K_value, RTCommandGrammars::get_cg_token_iname(cg)); + EmitCode::val_iname(K_value, RTCommandGrammars::get_cg_token_iname(cg)); EmitCode::up(); EmitCode::up(); EmitCode::inv(IF_BIP); @@ -1086,7 +1086,7 @@

    EmitCode::up(); EmitCode::up(); } else { - EmitArrays::iname_entry(RTCommandGrammars::get_cg_token_iname(cg)); + EmitArrays::iname_entry(RTCommandGrammars::get_cg_token_iname(cg)); } return;

    diff --git a/docs/runtime-module/7-kg.html b/docs/runtime-module/7-kg.html index 5cf5b73d5a..56a7a291ab 100644 --- a/docs/runtime-module/7-kg.html +++ b/docs/runtime-module/7-kg.html @@ -71,7 +71,7 @@

    gpr_kit kit = GPRs::new_kit(); GPRs::add_original_var(&kit); command_grammar *cg = CommandGrammars::get_parsing_grammar(K_number); - if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); + if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); EmitCode::inv(RETURN_BIP); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_FAIL_HL)); @@ -92,7 +92,7 @@

    kind *K = TimesOfDay::kind(); if (K) { command_grammar *cg = CommandGrammars::get_parsing_grammar(K); - if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); + if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); } EmitCode::inv(RETURN_BIP); EmitCode::down(); @@ -112,7 +112,7 @@

    gpr_kit kit = GPRs::new_kit(); GPRs::add_original_var(&kit); command_grammar *cg = CommandGrammars::get_parsing_grammar(K_truth_state); - if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); + if (cg) RTCommandGrammars::compile_for_value_GPR(&kit, cg); EmitCode::inv(RETURN_BIP); EmitCode::down(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_FAIL_HL)); @@ -191,7 +191,7 @@

         command_grammar *cg = CommandGrammars::get_parsing_grammar(K);
         if (cg) {
    -        RTCommandGrammars::compile_for_value_GPR(&kit, cg);
    +        RTCommandGrammars::compile_for_value_GPR(&kit, cg);
             Reset word number4.3;
         }
     
    diff --git a/docs/runtime-module/7-pnp.html b/docs/runtime-module/7-pnp.html index e231a3f26c..0061b306c1 100644 --- a/docs/runtime-module/7-pnp.html +++ b/docs/runtime-module/7-pnp.html @@ -134,7 +134,7 @@

    gpr_kit kit = GPRs::new_kit(); packaging_state save = Functions::begin(Name::get_parse_name_fn_iname(subj)); ParseName::compile_head(&kit, subj, TRUE); - RTCommandGrammars::compile_for_subject_GPR(&kit, cg); + RTCommandGrammars::compile_for_subject_GPR(&kit, cg); ParseName::compile_tail(&kit); Functions::end(save); } @@ -1215,7 +1215,7 @@

    EmitCode::test_if_iname_has_property(K_value, Hierarchy::find(SELF_HL), prn); EmitCode::inv(EQ_BIP); EmitCode::down(); - EmitCode::call(RTCommandGrammars::get_property_GPR_fn_iname(cg)); + EmitCode::call(RTCommandGrammars::get_property_GPR_fn_iname(cg)); EmitCode::val_iname(K_value, Hierarchy::find(GPR_PREPOSITION_HL)); EmitCode::up(); EmitCode::up(); diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index 9efa7a3dba..fd58589770 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -1,35 +1,35 @@ -Total memory consumption was 123094K = 120 MB +Total memory consumption was 120910K = 118 MB - ---- was used for 2046598 objects, in 363729 frames in 0 x 800K = 0K = 0 MB: + ---- was used for 2046600 objects, in 363731 frames in 0 x 800K = 0K = 0 MB: - 33.1% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes - 20.6% text_stream_array 4613 x 100 = 461300 objects, 25980416 bytes - 19.3% linked_list 43625 objects, 24430000 bytes - 11.1% inter_symbol_array 132 x 1024 = 135168 objects, 14061696 bytes - 10.5% inter_error_stash_array 101 x 1024 = 103424 objects, 13241504 bytes - 8.2% parse_node 129706 objects, 10376480 bytes - 5.8% verb_conjugation 160 objects, 7425280 bytes + 33.7% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes + 20.9% text_stream_array 4613 x 100 = 461300 objects, 25980416 bytes + 19.7% linked_list 43626 objects, 24430560 bytes + 11.3% inter_symbol_array 132 x 1024 = 135168 objects, 14061696 bytes + 10.6% inter_error_stash_array 101 x 1024 = 103424 objects, 13241504 bytes + 8.3% parse_node 129706 objects, 10376480 bytes + 5.9% verb_conjugation 160 objects, 7425280 bytes 4.4% parse_node_annotation_array 346 x 500 = 173000 objects, 5547072 bytes - 2.6% pcalc_prop_array 25 x 1000 = 25000 objects, 3400800 bytes + 2.7% pcalc_prop_array 25 x 1000 = 25000 objects, 3400800 bytes 2.5% inter_name_array 67 x 1000 = 67000 objects, 3218144 bytes - 2.0% kind_array 66 x 1000 = 66000 objects, 2642112 bytes + 2.1% kind_array 66 x 1000 = 66000 objects, 2642112 bytes 1.6% inter_name_generator_array 51 x 1000 = 51000 objects, 2041632 bytes - 1.5% inter_schema_token 13964 objects, 2010816 bytes + 1.6% inter_schema_token 13964 objects, 2010816 bytes 1.5% scan_directory 466 objects, 1923648 bytes - 1.4% package_request 21153 objects, 1861464 bytes + 1.5% package_request 21153 objects, 1861464 bytes 1.4% vocabulary_entry_array 161 x 100 = 16100 objects, 1808352 bytes 1.2% dict_entry_array 470 x 100 = 47000 objects, 1519040 bytes - 1.1% match_trie_array 11 x 1000 = 11000 objects, 1496352 bytes - 1.1% inter_symbols_table 26592 objects, 1489152 bytes - 1.0% i6_schema_array 23 x 100 = 2300 objects, 1380736 bytes + 1.2% match_trie_array 11 x 1000 = 11000 objects, 1496352 bytes + 1.2% inter_symbols_table 26592 objects, 1489152 bytes + 1.1% i6_schema_array 23 x 100 = 2300 objects, 1380736 bytes 1.0% inter_package 26592 objects, 1276416 bytes - 0.8% map_data 671 objects, 1127280 bytes + 0.9% map_data 671 objects, 1127280 bytes 0.8% id_body 942 objects, 1077648 bytes - 0.7% adjective_meaning 202 objects, 1000304 bytes + 0.8% adjective_meaning 202 objects, 1000304 bytes 0.7% excerpt_meaning 3102 objects, 967824 bytes 0.7% production 3878 objects, 899696 bytes - 0.6% ptoken 8404 objects, 874016 bytes - 0.6% grammatical_usage 3613 objects, 867120 bytes + 0.7% ptoken 8404 objects, 874016 bytes + 0.7% grammatical_usage 3613 objects, 867120 bytes 0.6% individual_form 2563 objects, 861168 bytes 0.6% inter_schema_node 8917 objects, 856032 bytes 0.5% unary_predicate_array 16 x 1000 = 16000 objects, 640512 bytes @@ -117,7 +117,7 @@ Total memory consumption was 123094K = 120 MB ---- adjective_iname_holder 320 objects, 12800 bytes ---- uniqueness_count 453 objects, 10872 bytes ---- inter_construct 30 objects, 10320 bytes - ---- stopwatch_timer 113 objects, 9040 bytes + ---- stopwatch_timer 114 objects, 9120 bytes ---- equation_node 68 objects, 7616 bytes ---- understanding_item_array 3 x 100 = 300 objects, 7296 bytes ---- shared_variable_array 1 x 100 objects, 7232 bytes @@ -242,17 +242,17 @@ Total memory consumption was 123094K = 120 MB 100.0% was used for memory not allocated for objects: - 57.6% text stream storage 72611676 bytes in 478774 claims - 4.1% dictionary storage 5263360 bytes in 7587 claims - ---- sorting 1512 bytes in 159 claims - 5.7% source text 7200000 bytes in 3 claims - 8.5% source text details 10800000 bytes in 2 claims + 56.8% text stream storage 70375168 bytes in 478447 claims + 4.2% dictionary storage 5263360 bytes in 7587 claims + ---- sorting 1520 bytes in 159 claims + 5.8% source text 7200000 bytes in 3 claims + 8.7% source text details 10800000 bytes in 2 claims 0.2% documentation fragments 262144 bytes in 1 claim ---- linguistic stock array 81920 bytes in 2 claims ---- small word set array 105600 bytes in 22 claims - 3.5% inter symbols storage 4520768 bytes in 27950 claims - 13.3% inter bytecode storage 16767568 bytes in 14 claims - 4.9% inter links storage 6222976 bytes in 11 claims + 3.6% inter symbols storage 4520768 bytes in 27950 claims + 13.5% inter bytecode storage 16767568 bytes in 14 claims + 5.0% inter links storage 6222976 bytes in 11 claims 0.1% inter tree location list storage 191232 bytes in 32 claims 1.3% instance-of-kind counting 1700416 bytes in 1 claim ---- compilation workspace for objects 21896 bytes in 25 claims @@ -260,5 +260,5 @@ Total memory consumption was 123094K = 120 MB ---- code generation workspace for objects 1336 bytes in 4 claims 0.2% emitter array storage 280288 bytes in 1999 claims --147.-1% was overhead - -185451240 bytes = -181104K = -176 MB +-149.-7% was overhead - -185451880 bytes = -181105K = -176 MB diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 6c30704dbd..ede1a8f035 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,33 +1,33 @@ 100.0% in inform7 run - 71.0% in compilation to Inter - 50.5% in //Sequence::undertake_queued_tasks// - 4.6% in //MajorNodes::pre_pass// - 3.4% in //MajorNodes::pass_1// - 2.0% in //RTPhrasebook::compile_entries// - 1.8% in //ImperativeDefinitions::assess_all// - 1.4% in //RTKindConstructors::compile// - 1.0% in //Sequence::lint_inter// - 0.6% in //MajorNodes::pass_2// - 0.6% in //Sequence::undertake_queued_tasks// - 0.6% in //World::stage_V// - 0.4% in //ImperativeDefinitions::compile_first_block// - 0.4% in //Sequence::undertake_queued_tasks// - 0.2% in //CompletionModule::compile// - 0.2% in //InferenceSubjects::emit_all// - 0.2% in //RTKindConstructors::compile_permissions// - 0.2% in //Task::make_built_in_kind_constructors// - 0.2% in //World::stages_II_and_III// + 71.3% in compilation to Inter + 51.0% in //Sequence::undertake_queued_tasks// + 4.5% in //MajorNodes::pre_pass// + 3.5% in //MajorNodes::pass_1// + 1.7% in //ImperativeDefinitions::assess_all// + 1.5% in //RTKindConstructors::compile// + 1.5% in //RTPhrasebook::compile_entries// + 1.1% in //Sequence::lint_inter// + 0.5% in //MajorNodes::pass_2// + 0.5% in //Sequence::undertake_queued_tasks// + 0.5% in //World::stage_V// + 0.3% in //ImperativeDefinitions::compile_first_block// + 0.3% in //Sequence::undertake_queued_tasks// + 0.1% in //CompletionModule::compile// + 0.1% in //InferenceSubjects::emit_all// + 0.1% in //RTKindConstructors::compile_permissions// + 0.1% in //Task::make_built_in_kind_constructors// + 0.1% in //World::stages_II_and_III// 2.6% not specifically accounted for - 26.1% in running Inter pipeline - 10.6% in step 14/15: generate inform6 -> auto.inf + 25.9% in running Inter pipeline + 10.0% in step 14/15: generate inform6 -> auto.inf 5.6% in step 5/15: load-binary-kits - 5.4% in step 6/15: make-synoptic-module - 1.4% in step 9/15: make-identifiers-unique - 0.4% in step 12/15: eliminate-redundant-operations - 0.4% in step 4/15: compile-splats - 0.4% in step 7/15: shorten-wiring - 0.4% in step 8/15: detect-indirect-calls - 0.2% in step 11/15: eliminate-redundant-labels + 5.6% in step 6/15: make-synoptic-module + 1.5% in step 9/15: make-identifiers-unique + 0.3% in step 12/15: eliminate-redundant-operations + 0.3% in step 4/15: compile-splats + 0.3% in step 7/15: shorten-wiring + 0.3% in step 8/15: detect-indirect-calls + 0.1% in step 11/15: eliminate-redundant-labels 1.2% not specifically accounted for - 2.4% in supervisor - 0.5% not specifically accounted for + 2.3% in supervisor + 0.4% not specifically accounted for diff --git a/inform7/assertions-module/Chapter 3/New Use Option Requests.w b/inform7/assertions-module/Chapter 3/New Use Option Requests.w index ca3b4483b1..df841f43f2 100644 --- a/inform7/assertions-module/Chapter 3/New Use Option Requests.w +++ b/inform7/assertions-module/Chapter 3/New Use Option Requests.w @@ -168,6 +168,8 @@ void NewUseOptions::memory_setting(text_stream *identifier, int n) { LOOP_OVER(ms, i6_memory_setting) if (Str::eq(identifier, ms->ICL_identifier)) { if (ms->number < n) ms->number = n; + if (Str::eq(identifier, I"DICT_WORD_SIZE")) + global_compilation_settings.dict_word_size = n; return; } ms = CREATE(i6_memory_setting); diff --git a/inform7/core-module/Chapter 1/Compilation Settings.w b/inform7/core-module/Chapter 1/Compilation Settings.w index 531a2b7aa5..b147d41146 100644 --- a/inform7/core-module/Chapter 1/Compilation Settings.w +++ b/inform7/core-module/Chapter 1/Compilation Settings.w @@ -81,6 +81,7 @@ typedef struct compilation_settings { int serial_comma; int undo_prevention; int use_exact_parsing_option; + int dict_word_size; } compilation_settings; compilation_settings global_compilation_settings; @@ -105,6 +106,7 @@ void CompilationSettings::initialise_gcs(void) { global_compilation_settings.serial_comma = FALSE; global_compilation_settings.undo_prevention = FALSE; global_compilation_settings.use_exact_parsing_option = FALSE; + global_compilation_settings.dict_word_size = -1; } @ And when (for example) a "Use..." sentence triggers one of these, the diff --git a/inform7/core-module/Chapter 1/How To Compile.w b/inform7/core-module/Chapter 1/How To Compile.w index 339595822e..fd7ff91914 100644 --- a/inform7/core-module/Chapter 1/How To Compile.w +++ b/inform7/core-module/Chapter 1/How To Compile.w @@ -192,6 +192,7 @@ here, which only happens when special runs are made for compiler testing. Task::advance_stage_to(INTER1_CSEQ, I"Generating inter (1)", 4, debugging, sequence_timer); BENCH(RTUseOptions::compile) + BENCH(RTCommandGrammars::compile_non_generic_constants) BENCH(Interventions::make_all) BENCH(RTKindConstructors::compile) BENCH(RTLiteralPatterns::compile) diff --git a/inform7/runtime-module/Chapter 7/Command Grammars.w b/inform7/runtime-module/Chapter 7/Command Grammars.w index cea456a450..80c8e41ee7 100644 --- a/inform7/runtime-module/Chapter 7/Command Grammars.w +++ b/inform7/runtime-module/Chapter 7/Command Grammars.w @@ -12,10 +12,8 @@ void RTCommandGrammars::compile_generic_constants(void) { target_vm *VM = Task::vm(); if (TargetVMs::is_16_bit(VM)) { RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 10000); - RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, 6); } else { RTCommandGrammars::grammar_constant(REPARSE_CODE_HL, 0x40000000); - RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, 9); } RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_META_HL, 1); RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_NOUN_FILTER_HL, 1); @@ -36,6 +34,20 @@ void RTCommandGrammars::compile_generic_constants(void) { RTCommandGrammars::grammar_constant(VERB_DIRECTIVE_MULTIEXCEPT_HL, 12); } +@ This one is compiled later, since it depends (potentially) on a use option: + += +void RTCommandGrammars::compile_non_generic_constants(void) { + target_vm *VM = Task::vm(); + int N = global_compilation_settings.dict_word_size; + if (TargetVMs::is_16_bit(VM)) { + if (N <= 0) N = 6; + } else { + if (N <= 0) N = 9; + } + RTCommandGrammars::grammar_constant(DICT_WORD_SIZE_HL, N); +} + @ =