diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-03-17 11:23:29 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-03-17 13:19:20 -0700 |
commit | 3ba6357924e1098a28e43c94a4573a3d2978b5e9 (patch) | |
tree | 9a5a4b181a82a77646b1c9d796bdd8b4159dc337 /cpp/018record | |
parent | 5f0e4762468c412d57fb54236a0ee90e23a2cb14 (diff) | |
download | mu-3ba6357924e1098a28e43c94a4573a3d2978b5e9.tar.gz |
949 - paving the way for jumps to labels
Addresses for reagents are now computed after all transforms.
Diffstat (limited to 'cpp/018record')
-rw-r--r-- | cpp/018record | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/018record b/cpp/018record index f42531be..b6ca40dc 100644 --- a/cpp/018record +++ b/cpp/018record @@ -31,15 +31,16 @@ Recipe_number["get"] = GET; assert(Next_recipe_number == GET); Next_recipe_number++; :(before "End Primitive Recipe Implementations") +//: beware: overridden in later layers case GET: { trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name; - int base_address = to_int(instructions[pc].ingredients[0].name); + int base_address = instructions[pc].ingredients[0].value; int base_type = instructions[pc].ingredients[0].types[0]; assert(Type[base_type].is_record); trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name; assert(instructions[pc].ingredients[1].types.size() == 1); assert(instructions[pc].ingredients[1].types[0] == 0); // must be literal - size_t offset = to_int(instructions[pc].ingredients[1].name); + size_t offset = instructions[pc].ingredients[1].value; int src = base_address; for (size_t i = 0; i < offset; ++i) { src += size_of(reagent(Type[base_type].elements[i][0])); @@ -110,13 +111,13 @@ Next_recipe_number++; :(before "End Primitive Recipe Implementations") case GET_ADDRESS: { trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name; - int base_address = to_int(instructions[pc].ingredients[0].name); + int base_address = instructions[pc].ingredients[0].value; int base_type = instructions[pc].ingredients[0].types[0]; assert(Type[base_type].is_record); trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name; assert(instructions[pc].ingredients[1].types.size() == 1); assert(instructions[pc].ingredients[1].types[0] == 0); // must be literal - size_t offset = to_int(instructions[pc].ingredients[1].name); + size_t offset = instructions[pc].ingredients[1].value; int src = base_address; for (size_t i = 0; i < offset; ++i) { src += size_of(reagent(Type[base_type].elements[i][0])); |