From 0edd9b9fc60440213e4df926ea511419ee291f1e Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 15 Jun 2018 22:12:03 -0700 Subject: 4257 - abortive attempt at safe fat pointers I've been working on this slowly over several weeks, but it's too hard to support 0 as the null value for addresses. I constantly have to add exceptions for scalar value corresponding to an address type (now occupying 2 locations). The final straw is the test for 'reload': x:num <- reload text 'reload' returns an address. But there's no way to know that for arbitrary instructions. New plan: let's put this off for a bit and first create support for literals. Then use 'null' instead of '0' for addresses everywhere. Then it'll be easy to just change what 'null' means. --- 053recipe_header.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to '053recipe_header.cc') diff --git a/053recipe_header.cc b/053recipe_header.cc index 057234f9..b948ce61 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -207,6 +207,9 @@ case NEXT_INGREDIENT_WITHOUT_TYPECHECKING: { if (current_call().next_ingredient_to_process < SIZE(current_call().ingredient_atoms)) { products.push_back( current_call().ingredient_atoms.at(current_call().next_ingredient_to_process)); + if (is_mu_scalar(current_call().ingredients.at(current_call().next_ingredient_to_process)) + && is_mu_address(current_instruction().products.at(0))) + products.at(0).insert(products.at(0).begin(), /*alloc id*/0); assert(SIZE(products) == 1); products.resize(2); // push a new vector products.at(1).push_back(1); ++current_call().next_ingredient_to_process; -- cgit 1.4.1-2-gfad0