authorgravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-07-28 11:46:31+09:00
committergravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 16:50:08+09:00
loga2e5691228c61e5c56220fc8f5f72e47b0611000
treeb30961308c5e93d8859b4125fac897a8a7b21297
parent9366a58bdd91a8b5e7bc7d4babb6f91b989769db

src/codegen.cpp: return null if calling convention is not async;

Tracking Issue #1296 ;

1 files changed, 9 insertions(+), 3 deletions(-)

src/codegen.cpp+9-3
......@@ -4149,9 +4149,15 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
41494149static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
41504150 IrInstructionHandle *instruction)
41514151{
4152 // @andrewrk, not sure what to place here ?
4153 // `get_promise_frame_type` ?
4154 LLVMValueRef handle = LLVMConstNull(g->builtin_types.entry_promise->type_ref);
4152
4153 bool is_async = executable->fn_entry != nullptr &&
4154 executable->fn_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync;
4155
4156 if (!is_async || !executable->coro_handle) {
4157 return LLVMConstNull(g->builtin_types.entry_promise->type_ref);
4158 }
4159
4160 LLVMValueRef handle = ir_llvm_value(g, executable->coro_handle);
41554161 return LLVMBuildRet(g->builder, handle);
41564162}
41574163