| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java | 159 | ||||
| -rw-r--r-- | src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java | 586 | 
2 files changed, 402 insertions, 343 deletions
| diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java index 0936e19..1e475eb 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java @@ -162,7 +162,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        return result;     } - +/*     @Override     public void visit_at_reference     ( @@ -192,7 +192,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              )           );     } - +*/     @Override     public void visit_cast     ( @@ -372,7 +372,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              n.get_value_as_string()           );     } - +/*     @Override     public void visit_count_operator     ( @@ -470,6 +470,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           );        }     } +*/     @Override     public void visit_field_access @@ -611,6 +612,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        }     } +/*     @Override     public void visit_is_member_operator     ( @@ -702,7 +704,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           );        }     } - +*/     @Override     public void visit_newline     ( @@ -712,7 +714,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor     {        result_as_computation = new Newline();     } - +/*     @Override     public void visit_operation     ( @@ -1257,7 +1259,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           System.err.println("[P] Unknown Fate operator '" + fate_op_name+ "'.");        }     } - +*/ +/*     @Override     public void visit_size_operator     ( @@ -1275,7 +1278,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = new Size(cc.get_address());     } - +*/ +/*     @Override     public void visit_text_join     ( @@ -1381,8 +1385,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = accumulator.get_value();     } - - +*/     @Override     public void visit_extra_computation     ( @@ -1419,7 +1422,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              parameters           );     } - +/*     @Override     public void visit_is_empty     ( @@ -1438,7 +1441,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation =           Operation.equals(new Size(cc.get_address()), Constant.ZERO);     } - +*/ +/*     @Override     public void visit_index_of_operator     ( @@ -1478,7 +1482,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/     @Override     public void visit_default     ( @@ -1496,7 +1500,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = r.get_value();     } - +/*     @Override     public void visit_access_pointer     ( @@ -1530,7 +1534,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              )           );     } - +*/ +/*     @Override     public void visit_access_as_reference     ( @@ -1564,7 +1569,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              )           );     } - +*/ +/*     @Override     public void visit_access     ( @@ -1600,7 +1606,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              )           );     } - +*/     @Override     public void visit_switch_value     ( @@ -1790,7 +1796,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = new Text(content);     } - +/*     @Override     public void visit_address_operator     ( @@ -1808,7 +1814,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = n_cc.get_address();     } - +*/     @Override     public void visit_text_with_effect     ( @@ -1999,7 +2005,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_computation = compiler.assembler().get_label_constant(in_label);     } - +/*     @Override     public void visit_lambda_evaluation     ( @@ -2051,6 +2057,16 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } +*/ +   @Override +   public void visit_generic_computation +   ( +      final tonkadur.fate.v1.lang.computation.GenericComputation n +   ) +   throws Throwable +   { +      // TODO: implement. +   }     @Override     public void visit_let @@ -2126,7 +2142,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        result_as_address = register.get_address();        result_as_computation = register.get_value();     } - +/*     @Override     public void visit_car_cdr     ( @@ -2154,7 +2170,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor              TypeCompiler.compile(compiler, n.get_type())           );     } - +*/ +/*     @Override     public void visit_cons     ( @@ -2202,7 +2219,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        car_compiler.release_registers(init_instructions);        cdr_compiler.release_registers(init_instructions);     } - +*/ +/*     @Override     public void visit_add_element     ( @@ -2253,7 +2271,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_add_element_at     ( @@ -2347,7 +2366,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_remove_elements_of     ( @@ -2400,7 +2420,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_add_elements_of     ( @@ -2453,7 +2474,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_fold     ( @@ -2484,7 +2506,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -2534,7 +2556,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_map     ( @@ -2565,7 +2588,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -2602,7 +2625,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_range     ( @@ -2719,7 +2743,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_remove_all_of_element     ( @@ -2768,7 +2793,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_remove_element_at     ( @@ -2819,7 +2845,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_remove_element     ( @@ -2872,7 +2899,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_reverse_list     ( @@ -2914,7 +2942,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_shuffle     ( @@ -2955,7 +2984,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     private void visit_merge_with_defaults     (        final tonkadur.fate.v1.lang.computation.MergeComputation n @@ -2986,7 +3016,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3045,7 +3075,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_merge     ( @@ -3084,7 +3115,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3125,7 +3156,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     private void visit_indexed_merge_with_defaults     (        final tonkadur.fate.v1.lang.computation.IndexedMergeComputation n @@ -3156,7 +3188,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3215,7 +3247,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_indexed_merge     ( @@ -3254,7 +3287,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3295,7 +3328,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_sublist     ( @@ -3352,7 +3386,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        end_compiler.release_registers(init_instructions);        address_compiler.release_registers(init_instructions);     } - +*/ +/*     @Override     public void visit_partition     ( @@ -3384,7 +3419,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3453,7 +3488,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_indexed_partition     ( @@ -3485,7 +3521,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3554,7 +3590,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_sort     ( @@ -3585,7 +3622,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3623,7 +3660,9 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        in_collection_cc.release_registers(init_instructions);     } +*/ +/*     @Override     public void visit_filter     ( @@ -3654,7 +3693,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3696,7 +3735,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_indexed_filter     ( @@ -3727,7 +3767,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3769,7 +3809,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_indexed_map     ( @@ -3800,7 +3841,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           assimilate(param_cc); @@ -3837,7 +3878,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/ +/*     @Override     public void visit_push_element     ( @@ -3912,7 +3954,8 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor        element_compiler.release_registers(init_instructions);     } - +*/ +/*     @Override     public void visit_pop_element     ( @@ -3990,7 +4033,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor           )        );     } - +*/     @Override     public void visit_set_fields     ( diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java index b186682..1880fbe 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java @@ -107,7 +107,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        compiler.registers().bind(n.get_variable().get_name(), r);     } - +/*     @Override     public void visit_remove_elements_of     ( @@ -153,7 +153,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        collection_cc.release_registers(result);        collection_in_cc.release_registers(result);     } - +*/ +/*     @Override     public void visit_add_elements_of     ( @@ -199,7 +200,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        collection_cc.release_registers(result);        collection_in_cc.release_registers(result);     } - +*/ +/*     @Override     public void visit_add_element_at     ( @@ -287,7 +289,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        element_compiler.release_registers(result);        collection_compiler.release_registers(result);     } - +*/ +/*     @Override     public void visit_add_element     ( @@ -332,6 +335,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        element_compiler.release_registers(result);        address_compiler.release_registers(result);     } +*/     @Override     public void visit_assert (final tonkadur.fate.v1.lang.instruction.Assert a) @@ -369,15 +373,11 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        msg_cc.release_registers(result);     } +/*     @Override     public void visit_clear (final tonkadur.fate.v1.lang.instruction.Clear c)     throws Throwable     { -      /* -       * Fate: (clear collection) -       * -       * Wyrd: <clear collection> -       */        final ComputationCompiler address_compiler;        final Address collection_address; @@ -404,18 +404,14 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        address_compiler.release_registers(result);     } - +*/ +/*     public void visit_reverse_list     (        final tonkadur.fate.v1.lang.instruction.ReverseList n     )     throws Throwable     { -      /* -       * Fate: (reverse_list collection) -       * -       * Wyrd: <reverse_list collection> -       */        final ComputationCompiler address_compiler;        final Address collection_address; @@ -443,7 +439,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        address_compiler.release_registers(result);     } - +*/ +/*     @Override     public void visit_shuffle     ( @@ -451,11 +448,6 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor     )     throws Throwable     { -      /* -       * Fate: (shuffle collection) -       * -       * Wyrd: <shuffle collection> -       */        final ComputationCompiler address_compiler;        final Address collection_address; @@ -482,7 +474,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        address_compiler.release_registers(result);     } - +*/     @Override     public void visit_set_fields     ( @@ -540,7 +532,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        target_cc.release_registers(result);     } - +/*     @Override     public void visit_map     ( @@ -550,7 +542,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor     {        final List<Computation> params;        final List<ComputationCompiler> param_cc_list; -      /* This is one dangerous operation to do in-place, so we don't. */ +      // This is one dangerous operation to do in-place, so we don't.        final Register holder;        final ComputationCompiler lambda_cc, collection_cc; @@ -569,7 +561,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -648,7 +640,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_sort     ( @@ -695,7 +688,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -742,7 +735,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     private void visit_merge_with_defaults     (        final tonkadur.fate.v1.lang.instruction.Merge n @@ -844,7 +838,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -888,7 +882,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_merge     ( @@ -896,7 +891,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor     )     throws Throwable     { -      /* This is one dangerous operation to do in-place, so we don't. */ +      // This is one dangerous operation to do in-place, so we don't.        if (n.get_main_default() != null)        { @@ -978,7 +973,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1018,7 +1013,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     private void visit_indexed_merge_with_defaults     (        final tonkadur.fate.v1.lang.instruction.IndexedMerge n @@ -1120,7 +1116,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1164,7 +1160,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_indexed_merge     ( @@ -1178,7 +1175,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           return;        } -      /* This is one dangerous operation to do in-place, so we don't. */ +      // This is one dangerous operation to do in-place, so we don't.        final Register holder;        final ComputationCompiler lambda_cc;        final List<Computation> params; @@ -1253,7 +1250,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1293,7 +1290,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_partition     ( @@ -1320,7 +1318,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1386,7 +1384,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_indexed_partition     ( @@ -1413,7 +1412,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1479,7 +1478,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_sublist     ( @@ -1550,7 +1550,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        start_compiler.release_registers(result);        end_compiler.release_registers(result);     } - +*/ +/*     @Override     public void visit_push_element     ( @@ -1618,7 +1619,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        compiler.registers().release(collection_size, result);        compiler.registers().release(index, result);     } - +*/ +/*     @Override     public void visit_pop_element     ( @@ -1660,7 +1662,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        address_compiler.release_registers(result);        element_compiler.release_registers(result);     } - +*/ +/*     @Override     public void visit_filter     ( @@ -1687,7 +1690,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1738,7 +1741,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_indexed_filter     ( @@ -1765,7 +1769,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1816,7 +1820,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/ +/*     @Override     public void visit_indexed_map     ( @@ -1826,7 +1831,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor     {        final List<Computation> params;        final List<ComputationCompiler> param_cc_list; -      /* This is one dangerous operation to do in-place, so we don't. */ +      // This is one dangerous operation to do in-place, so we don't.        final Register holder;        final ComputationCompiler lambda_cc, collection_cc; @@ -1845,7 +1850,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           p.get_visited_by(param_cc); -         /* Let's not re-compute the parameters on every iteration. */ +         // Let's not re-compute the parameters on every iteration.           param_cc.generate_address();           if (param_cc.has_init()) @@ -1924,7 +1929,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor           cc.release_registers(result);        }     } - +*/     @Override     public void visit_switch_instruction     ( @@ -2070,7 +2075,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        cc.release_registers(result);     } - +/*     @Override     public void visit_free (final tonkadur.fate.v1.lang.instruction.Free n)     throws Throwable @@ -2103,7 +2108,8 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        cc.release_registers(result);     } - +*/ +/*     @Override     public void visit_allocate     ( @@ -2146,7 +2152,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        cc.release_registers(result);     } - +*/     @Override     public void visit_while (final tonkadur.fate.v1.lang.instruction.While n)     throws Throwable @@ -2479,7 +2485,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        /* Already released by the unbind above. */        /* compiler.registers().release(current_value, result); */     } - +/*     @Override     public void visit_remove_element_at     ( @@ -2535,7 +2541,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        index_cc.release_registers(result);        collection_cc.release_registers(result);     } - +*/     @Override     public void visit_cond_instruction     ( @@ -3269,234 +3275,234 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        );     } -   @Override -   public void visit_remove_all_of_element -   ( -      final tonkadur.fate.v1.lang.instruction.RemoveAllOfElement n -   ) -   throws Throwable -   { -      /* -       * Fate: -       * (remove_all_of element collection) -       * -       * Wyrd: -       * (declare_variable <element_type> .elem) -       * (declare_variable int .collection_size) -       * -       * (set .elem element) -       * (set .collection_size (size collection)) -       * -       * <if collection is a list: -       *    <remove_all (var .elem) (var .collection_size) collection> -       * > -       * <if collection is a set: -       *    (declare_variable bool .found) -       *    (declare_variable int .index) -       * -       *    <binary_search -       *       (var .elem) -       *       (var .collection_size) -       *       collection -       *       .found -       *       .index -       *    > -       *    (ifelse (var .found) -       *       <remove_at (var .index) (var .collection_size) collection> -       *       (nop) -       *    ) -       * > -       */ -      final ComputationCompiler elem_cc, collection_cc; -      final Register collection_size; -      final Address elem, collection; - -      elem_cc = new ComputationCompiler(compiler); -      collection_cc = new ComputationCompiler(compiler); - -      collection_size = compiler.registers().reserve(Type.INT, result); - -      n.get_element().get_visited_by(elem_cc); -      n.get_collection().get_visited_by(collection_cc); - -      elem_cc.generate_address(); - -      if (elem_cc.has_init()) -      { -         result.add(elem_cc.get_init()); -      } - -      if (collection_cc.has_init()) -      { -         result.add(collection_cc.get_init()); -      } - -      collection = collection_cc.get_address(); -      elem = elem_cc.get_address(); - -      result.add -      ( -         new SetValue(collection_size.get_address(), new Size(collection)) -      ); - -      if -      ( -         ( -            (tonkadur.fate.v1.lang.type.CollectionType) -            n.get_collection().get_type() -         ).is_set() -      ) -      { -         final Computation value_of_elem; -         final Register index, found; - -         index = compiler.registers().reserve(Type.INT, result); -         found = compiler.registers().reserve(Type.BOOL, result); - -         value_of_elem = new ValueOf(elem); - -         result.add -         ( -            BinarySearch.generate -            ( -               compiler.registers(), -               compiler.assembler(), -               new ValueOf(elem), -               collection_size.get_value(), -               collection, -               found.get_address(), -               index.get_address() -            ) -         ); - -         elem_cc.release_registers(result); - -         result.add -         ( -            If.generate -            ( -               compiler.registers(), -               compiler.assembler(), -               found.get_value(), -               RemoveAt.generate -               ( -                  compiler.registers(), -                  compiler.assembler(), -                  index.get_address(), -                  collection_size.get_value(), -                  collection -               ) -            ) -         ); - -         compiler.registers().release(index, result); -         compiler.registers().release(found, result); -      } -      else -      { -         result.add -         ( -            RemoveAllOf.generate -            ( -               compiler.registers(), -               compiler.assembler(), -               new ValueOf(elem), -               collection_size.get_value(), -               collection -            ) -         ); - -         elem_cc.release_registers(result); -      } - -      collection_cc.release_registers(result); - -      compiler.registers().release(collection_size, result); -   } - -   @Override -   public void visit_remove_element -   ( -      final tonkadur.fate.v1.lang.instruction.RemoveElement n -   ) -   throws Throwable -   { -      /* -       * Fate: -       * (remove_element element collection) -       * -       * Wyrd: -       * (declare_variable <element_type> .elem) -       * (declare_variable int .collection_size) -       * (declare_variable boolean .found) -       * (declare_variable int .index) -       * -       * (set .elem element) -       * (set .collection_size (size collection)) -       * -       * <if collection is a set: -       *    <BinarySearch -       *       (var .elem) -       *       (var .collection_size) -       *       collection -       *       .found -       *       .index -       *    > -       * > -       * <if collection is a list: -       *    <IterativeSearch -       *       (var .elem) -       *       (var .collection_size) -       *       collection -       *       .found -       *       .index -       *    > -       * > -       * -       * (if (var .found) -       *    <remove_at (var index) (var .collection_size) collection> -       *    (nop) -       * ) -       */ -      final ComputationCompiler elem_cc, collection_cc; - -      elem_cc = new ComputationCompiler(compiler); -      collection_cc = new ComputationCompiler(compiler); - -      n.get_element().get_visited_by(elem_cc); -      n.get_collection().get_visited_by(collection_cc); - -      elem_cc.generate_address(); - -      if (elem_cc.has_init()) -      { -         result.add(elem_cc.get_init()); -      } - -      if (collection_cc.has_init()) -      { -         result.add(collection_cc.get_init()); -      } - -      result.add -      ( -         RemoveOneOf.generate -         ( -            compiler.registers(), -            compiler.assembler(), -            elem_cc.get_computation(), -            collection_cc.get_address(), -            ( -               (tonkadur.fate.v1.lang.type.CollectionType) -               n.get_collection().get_type() -            ).is_set() -         ) -      ); - -      elem_cc.release_registers(result); -      collection_cc.release_registers(result); -   } - +//   @Override +//   public void visit_remove_all_of_element +//   ( +//      final tonkadur.fate.v1.lang.instruction.RemoveAllOfElement n +//   ) +//   throws Throwable +//   { +//      /* +//       * Fate: +//       * (remove_all_of element collection) +//       * +//       * Wyrd: +//       * (declare_variable <element_type> .elem) +//       * (declare_variable int .collection_size) +//       * +//       * (set .elem element) +//       * (set .collection_size (size collection)) +//       * +//       * <if collection is a list: +//       *    <remove_all (var .elem) (var .collection_size) collection> +//       * > +//       * <if collection is a set: +//       *    (declare_variable bool .found) +//       *    (declare_variable int .index) +//       * +//       *    <binary_search +//       *       (var .elem) +//       *       (var .collection_size) +//       *       collection +//       *       .found +//       *       .index +//       *    > +//       *    (ifelse (var .found) +//       *       <remove_at (var .index) (var .collection_size) collection> +//       *       (nop) +//       *    ) +//       * > +//       */ +//      final ComputationCompiler elem_cc, collection_cc; +//      final Register collection_size; +//      final Address elem, collection; +// +//      elem_cc = new ComputationCompiler(compiler); +//      collection_cc = new ComputationCompiler(compiler); +// +//      collection_size = compiler.registers().reserve(Type.INT, result); +// +//      n.get_element().get_visited_by(elem_cc); +//      n.get_collection().get_visited_by(collection_cc); +// +//      elem_cc.generate_address(); +// +//      if (elem_cc.has_init()) +//      { +//         result.add(elem_cc.get_init()); +//      } +// +//      if (collection_cc.has_init()) +//      { +//         result.add(collection_cc.get_init()); +//      } +// +//      collection = collection_cc.get_address(); +//      elem = elem_cc.get_address(); +// +//      result.add +//      ( +//         new SetValue(collection_size.get_address(), new Size(collection)) +//      ); +// +//      if +//      ( +//         ( +//            (tonkadur.fate.v1.lang.type.CollectionType) +//            n.get_collection().get_type() +//         ).is_set() +//      ) +//      { +//         final Computation value_of_elem; +//         final Register index, found; +// +//         index = compiler.registers().reserve(Type.INT, result); +//         found = compiler.registers().reserve(Type.BOOL, result); +// +//         value_of_elem = new ValueOf(elem); +// +//         result.add +//         ( +//            BinarySearch.generate +//            ( +//               compiler.registers(), +//               compiler.assembler(), +//               new ValueOf(elem), +//               collection_size.get_value(), +//               collection, +//               found.get_address(), +//               index.get_address() +//            ) +//         ); +// +//         elem_cc.release_registers(result); +// +//         result.add +//         ( +//            If.generate +//            ( +//               compiler.registers(), +//               compiler.assembler(), +//               found.get_value(), +//               RemoveAt.generate +//               ( +//                  compiler.registers(), +//                  compiler.assembler(), +//                  index.get_address(), +//                  collection_size.get_value(), +//                  collection +//               ) +//            ) +//         ); +// +//         compiler.registers().release(index, result); +//         compiler.registers().release(found, result); +//      } +//      else +//      { +//         result.add +//         ( +//            RemoveAllOf.generate +//            ( +//               compiler.registers(), +//               compiler.assembler(), +//               new ValueOf(elem), +//               collection_size.get_value(), +//               collection +//            ) +//         ); +// +//         elem_cc.release_registers(result); +//      } +// +//      collection_cc.release_registers(result); +// +//      compiler.registers().release(collection_size, result); +//   } + +//   @Override +//   public void visit_remove_element +//   ( +//      final tonkadur.fate.v1.lang.instruction.RemoveElement n +//   ) +//   throws Throwable +//   { +//      /* +//       * Fate: +//       * (remove_element element collection) +//       * +//       * Wyrd: +//       * (declare_variable <element_type> .elem) +//       * (declare_variable int .collection_size) +//       * (declare_variable boolean .found) +//       * (declare_variable int .index) +//       * +//       * (set .elem element) +//       * (set .collection_size (size collection)) +//       * +//       * <if collection is a set: +//       *    <BinarySearch +//       *       (var .elem) +//       *       (var .collection_size) +//       *       collection +//       *       .found +//       *       .index +//       *    > +//       * > +//       * <if collection is a list: +//       *    <IterativeSearch +//       *       (var .elem) +//       *       (var .collection_size) +//       *       collection +//       *       .found +//       *       .index +//       *    > +//       * > +//       * +//       * (if (var .found) +//       *    <remove_at (var index) (var .collection_size) collection> +//       *    (nop) +//       * ) +//       */ +//      final ComputationCompiler elem_cc, collection_cc; +// +//      elem_cc = new ComputationCompiler(compiler); +//      collection_cc = new ComputationCompiler(compiler); +// +//      n.get_element().get_visited_by(elem_cc); +//      n.get_collection().get_visited_by(collection_cc); +// +//      elem_cc.generate_address(); +// +//      if (elem_cc.has_init()) +//      { +//         result.add(elem_cc.get_init()); +//      } +// +//      if (collection_cc.has_init()) +//      { +//         result.add(collection_cc.get_init()); +//      } +// +//      result.add +//      ( +//         RemoveOneOf.generate +//         ( +//            compiler.registers(), +//            compiler.assembler(), +//            elem_cc.get_computation(), +//            collection_cc.get_address(), +//            ( +//               (tonkadur.fate.v1.lang.type.CollectionType) +//               n.get_collection().get_type() +//            ).is_set() +//         ) +//      ); +// +//      elem_cc.release_registers(result); +//      collection_cc.release_registers(result); +//   } +//     @Override     public void visit_sequence_call     ( @@ -3927,4 +3933,14 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor        max_cc.release_registers(result);        label_cc.release_registers(result);     } + +   @Override +   public void visit_generic_instruction +   ( +      final tonkadur.fate.v1.lang.instruction.GenericInstruction n +   ) +   throws Throwable +   { +      // TODO: implement. +   }  } | 


