Issues with stack allocated closures in Temptory

34 views
Skip to first unread message

aditya siram

unread,
Jun 24, 2019, 2:51:37 PM6/24/19
to ats-lang-users
Hi,
Stack allocated closures don't seem to work the same way in Temptory, eg. compiling the following:

#include "share/HATS/temptory_staload_bucs320.hats"

fun apply
(f: &(string) -<clo1> void, s:string):void = f(s)

implement main0
(argc,argv) =
  let
   
var f = lam@(s:string):void => println! s
 
in
    apply
(f,"hello world")
 
end



results in:

In file included from test2_dats.c:15:
test2_dats
.c: In function mainats_0_argc_argv’:
test2_dats
.c:323:20: warning: implicit declaration of function atstyclo_type’; did you mean atstyvar_type’? [-Wimplicit-function-declaration]
 
ATStmpdec(tmpref2, atstyclo_type(__patsfun_2)) ;
                   
^~~~~~~~~~~~~
/home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/temptory_instrset.h:209:29: note: in definition of macro ATStmpdec
 
#define ATStmpdec(tmp, hit) hit tmp
                             
^~~
test2_dats
.c:323:11: error: expected ‘;’ before tmpref2
 
ATStmpdec(tmpref2, atstyclo_type(__patsfun_2)) ;
           
^~~~~~~
/home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/temptory_instrset.h:209:33: note: in definition of macro ATStmpdec
 
#define ATStmpdec(tmp, hit) hit tmp
                                 
^~~
test2_dats
.c:345:68: error: tmpref2 undeclared (first use in this function)
 
ATSINSclosure_initize(__patsfun_2, ((__patsfun_2__closure_t0ype*)(&tmpref2))) ;
                                                                   
^~~~~~~
/home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/temptory_instrset.h:369:66: note: in definition of macro ATSINSclosure_initize
 
#define ATSINSclosure_initize(flab, tmpenv) (flab##__closureinit)tmpenv
                                                                 
^~~~~~
test2_dats
.c:345:68: note: each undeclared identifier is reported only once for each function it appears in
 
ATSINSclosure_initize(__patsfun_2, ((__patsfun_2__closure_t0ype*)(&tmpref2))) ;
                                                                   
^~~~~~~
/home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/temptory_instrset.h:369:66: note: in definition of macro ATSINSclosure_initize
 
#define ATSINSclosure_initize(flab, tmpenv) (flab##__closureinit)tmpenv



Thanks!
-deech

Hongwei Xi

unread,
Jun 24, 2019, 2:59:59 PM6/24/19
to ats-lan...@googlegroups.com
Fixed it.

The following two lines were missing in ccomp/runtime/temptory_typedefs.h:

#define atstyclo_top struct{ void *cfun; }
#define atstyclo_type(flab) flab##__closure_t0ype

--Hongwei

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/7ee015c5-b3d1-4b26-a5d9-21a967d83144%40googlegroups.com.

aditya siram

unread,
Jun 24, 2019, 3:07:40 PM6/24/19
to ats-lang-users
Oh wow, thanks!



On Monday, June 24, 2019 at 1:59:59 PM UTC-5, gmhwxi wrote:
Fixed it.

The following two lines were missing in ccomp/runtime/temptory_typedefs.h:

#define atstyclo_top struct{ void *cfun; }
#define atstyclo_type(flab) flab##__closure_t0ype

--Hongwei

To unsubscribe from this group and stop receiving emails from it, send an email to ats-lan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages