From b8a4a4e7fb67c9068b4bdd1b94c53362e16b8255 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Thu, 15 Oct 2020 21:58:15 -0400 Subject: [PATCH] Correct compiler error --- goalc/compiler/compilation/Type.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/goalc/compiler/compilation/Type.cpp b/goalc/compiler/compilation/Type.cpp index 7ea0f9110f..6efb13c252 100644 --- a/goalc/compiler/compilation/Type.cpp +++ b/goalc/compiler/compilation/Type.cpp @@ -168,6 +168,8 @@ Val* Compiler::generate_inspector_for_type(const goos::Object& form, Env* env, T constraint.ireg = input->ireg(); // constrain this register constraint.desired_register = emitter::gRegInfo.get_arg_reg(0); // to the first argument method_env->constrain(constraint); + // Inform the compiler that `input`'s value will be written to `rdi` (first arg register) + method_env->emit(std::make_unique(std::vector{input})); std::string str_template = fmt::format("~T- type: ~T{}~%", type->get_name()); std::vector format_args = {}; @@ -183,7 +185,7 @@ Val* Compiler::generate_inspector_for_type(const goos::Object& form, Env* env, T } compile_format_string(form, method_env.get(), str_template, format_args); - method_env->emit(std::make_unique(method_env->make_gpr(input->type()), input)); + method_env->emit(std::make_unique(method_env->make_gpr(input->type()), input)); // add this function to the object file auto fe = get_parent_env_of_type(env);