@@ -279,7 +279,6 @@ qword_t ExternalFunctions::call(size_t id, const Arguments& args) {
279279
280280 " jmp label_do_call\n " // Skip the function and call the method
281281
282- // Function bring_next_value_into_rax
283282 " bring_next_value_into_rax:\n "
284283 // These chacks would be nice to have here, but the call somehow segfaults then
285284 // " cmpq $0, (%%R10)\n" // Check if type is None (0)
@@ -291,9 +290,9 @@ qword_t ExternalFunctions::call(size_t id, const Arguments& args) {
291290 // End of bring_next_value_into_rax
292291
293292 " label_do_call:"
294- " movq $0, %%rax\n " // Indicate no vector registers used
295- " call *%[fn_tag]\n "
296- " movq %%rax, %[result_tag]\n "
293+ " movq $0, %%rax\n " // Indicate no vector registers used
294+ " call *%[fn_tag]\n "
295+ " movq %%rax, %[result_tag]\n "
297296
298297 // Restore stack
299298 " movq %%rbp, %%rsp\n "
@@ -314,13 +313,18 @@ qword_t ExternalFunctions::call(size_t id, const Arguments& args) {
314313 return 0 ;
315314 }
316315
316+ if (func.returnType == ret_type::Number) {
317+ int iresult = 0 ;
318+ std::memcpy (&iresult, &result, sizeof (int ));
319+ return iresult;
320+ }
321+
317322 /* if (func.returnType == ret_type::Float) {
318323 float fresult;
319324 std::memcpy(&fresult, &result, sizeof(float));
320325 return fresult;
321326 }*/
322327 // if (func.returnType == ret_type::Ptr)
323- // if (func.returnType == ret_type::Number)
324328
325329 return result;
326330}
0 commit comments