cogent icon indicating copy to clipboard operation
cogent copied to clipboard

code gen for returning a single array

Open zilinc opened this issue 7 years ago • 2 comments

.. In this case, the return type can't be t* as the mem it points to is no longer available outside the function call. We decide to wrap it in a struct. It complicates code-gen a lot. I hope the C gen for dargent can shed some light on how to structure the code generator module. Hence this ticket as a reminder.

For now, the work around is to not return an array alone. Since we don't have singleton tuples, we can still wrap the returning array in a singleton unboxed record.

zilinc avatar Jun 08 '18 13:06 zilinc

Yeah, we should do the struct-wrapping thing.

Wouldn't say dargent would change this much.

I'd recommend wrapping all arrays in a singleton struct.

liamoc avatar Jun 08 '18 13:06 liamoc

It won't. I hope the dargent implementation can subsume the changes I have to make in the code base for it.

(I try to be lazy, to line up with the lazy language I'm using.)

zilinc avatar Jun 08 '18 13:06 zilinc