diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-29 14:58:16 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-29 14:58:16 -0700 |
commit | d41955c10821fc8f435173efe8cd355cc3693801 (patch) | |
tree | 7deaf70df200b97df0c46e65cc6f2e23495d0997 | |
parent | ceb33ee40f2c210c02d59469f7146cefdb4b6fba (diff) | |
download | mu-d41955c10821fc8f435173efe8cd355cc3693801.tar.gz |
3279
Stop inlining functions because that will complicate separate compilation. It also simplifies the code without impacting performance.
-rw-r--r-- | 010vm.cc | 2 | ||||
-rw-r--r-- | 020run.cc | 16 | ||||
-rw-r--r-- | 026call.cc | 24 | ||||
-rw-r--r-- | 056shape_shifting_recipe.cc | 2 |
4 files changed, 22 insertions, 22 deletions
diff --git a/010vm.cc b/010vm.cc index 6728a0a3..22d9d9ad 100644 --- a/010vm.cc +++ b/010vm.cc @@ -509,7 +509,7 @@ string to_string(const reagent& r) { } // special name for ignoring some products -inline bool is_dummy(const reagent& x) { +bool is_dummy(const reagent& x) { return x.name == "_"; } diff --git a/020run.cc b/020run.cc index e5bde518..51944784 100644 --- a/020run.cc +++ b/020run.cc @@ -111,23 +111,23 @@ bool should_copy_ingredients() { //: We'll need to override these later as we change the definition of routine. //: Important that they return referrences into the routine. -inline int& current_step_index() { +int& current_step_index() { return Current_routine->running_step_index; } -inline const string& current_recipe_name() { +const string& current_recipe_name() { return get(Recipe, Current_routine->running_recipe).name; } -inline const instruction& current_instruction() { +const instruction& current_instruction() { return get(Recipe, Current_routine->running_recipe).steps.at(Current_routine->running_step_index); } -inline bool routine::completed() const { +bool routine::completed() const { return running_step_index >= SIZE(get(Recipe, running_recipe).steps); } -inline const vector<instruction>& routine::steps() const { +const vector<instruction>& routine::steps() const { return get(Recipe, running_recipe).steps; } @@ -325,17 +325,17 @@ bool size_mismatch(const reagent& x, const vector<double>& data) { return size_of(x) != SIZE(data); } -inline bool is_literal(const reagent& r) { +bool is_literal(const reagent& r) { if (!r.type) return false; if (r.type->value == 0) assert(!r.type->left && !r.type->right); return r.type->value == 0; } -inline bool scalar(const vector<int>& x) { +bool scalar(const vector<int>& x) { return SIZE(x) == 1; } -inline bool scalar(const vector<double>& x) { +bool scalar(const vector<double>& x) { return SIZE(x) == 1; } diff --git a/026call.cc b/026call.cc index c313deaf..8a781892 100644 --- a/026call.cc +++ b/026call.cc @@ -68,29 +68,29 @@ routine::routine(recipe_ordinal r) { } :(code) -inline call& current_call() { +call& current_call() { return Current_routine->calls.front(); } //:: now update routine's helpers -:(replace{} "inline int& current_step_index()") -inline int& current_step_index() { +:(replace{} "int& current_step_index()") +int& current_step_index() { assert(!Current_routine->calls.empty()); return current_call().running_step_index; } -:(replace{} "inline const string& current_recipe_name()") -inline const string& current_recipe_name() { +:(replace{} "const string& current_recipe_name()") +const string& current_recipe_name() { assert(!Current_routine->calls.empty()); return get(Recipe, current_call().running_recipe).name; } -:(replace{} "inline const instruction& current_instruction()") -inline const instruction& current_instruction() { +:(replace{} "const instruction& current_instruction()") +const instruction& current_instruction() { assert(!Current_routine->calls.empty()); return to_instruction(current_call()); } :(code) -inline const instruction& to_instruction(const call& call) { +const instruction& to_instruction(const call& call) { return get(Recipe, call.running_recipe).steps.at(call.running_step_index); } @@ -139,13 +139,13 @@ def main [ //:: finally, we need to fix the termination conditions for the run loop -:(replace{} "inline bool routine::completed() const") -inline bool routine::completed() const { +:(replace{} "bool routine::completed() const") +bool routine::completed() const { return calls.empty(); } -:(replace{} "inline const vector<instruction>& routine::steps() const") -inline const vector<instruction>& routine::steps() const { +:(replace{} "const vector<instruction>& routine::steps() const") +const vector<instruction>& routine::steps() const { assert(!calls.empty()); return get(Recipe, calls.front().running_recipe).steps; } diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 042ddb8f..3441829b 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -318,7 +318,7 @@ void compute_type_ingredient_mappings(const recipe& exemplar, const instruction& } } -inline int min(int a, int b) { +int min(int a, int b) { return (a < b) ? a : b; } |