Add a test for compiling calls to obj_msg_sendv.

It seems dag_set_live_vars still served a purpose after all, but I don't
feel like bringing it as I'd rather implement its param handing in
dagnode_set_edges. I've now got a test case for it, though the test
currently causes the VM to segfault (even with pr_boundscheck 2!).
This commit is contained in:
Bill Currie 2012-12-22 14:05:12 +09:00
parent 175935ed8b
commit a95f679283
2 changed files with 65 additions and 0 deletions

View File

@ -26,6 +26,7 @@ test_progs_dat=\
infloop.dat \
modulo.dat \
return-ivar.dat \
sendv.dat \
structlive.dat \
structptr.dat \
vecinit.dat \
@ -93,6 +94,13 @@ return-ivar.dat: $(return_ivar_obj) $(QFCC_DEP)
return-ivar.run: Makefile build-run
$(srcdir)/build-run $@
sendv_dat_SOURCES=sendv.r
sendv_obj=$(sendv_dat_SOURCES:.r=.qfo)
sendv.dat: $(sendv_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(sendv_obj)
sendv.run: Makefile build-run
$(srcdir)/build-run $@
structlive_dat_SOURCES=structlive.r
structlive_obj=$(structlive_dat_SOURCES:.r=.qfo)
structlive.dat: $(structlive_obj) $(QFCC_DEP)

57
tools/qfcc/test/sendv.r Normal file
View File

@ -0,0 +1,57 @@
string got;
SEL (string name) sel_get_uid = #0;
@param (id receiver, SEL op, @va_list args) obj_msg_sendv = #0;
id (Class class) class_create_instance = #0;
int obj_increment_retaincount (id object) = #0;
void
send (id obj, string cmd, string str)
{
@static @param params[1];
@va_list va_list = {1, params};
SEL sel;
params[0].string_val = str;
sel = sel_get_uid (cmd);
obj_msg_sendv (obj, sel, va_list);
}
@interface Object //just so the runtime doesn't complain
{
Class isa;
}
+alloc;
-init;
-catch:(string) it;
@end
int
main ()
{
id obj = [[Object alloc] init];
send (obj, "catch:", "it");
return !(got == "it");
}
@implementation Object
+alloc
{
return class_create_instance (self);
}
-init
{
obj_increment_retaincount (self);
return self;
}
-catch:(string) it
{
got = it;
return self;
}
@end
id (id receiver, SEL op, ...) obj_msgSend = #0;
void __obj_exec_class (struct obj_module *msg) = #0;