This commit is contained in:
Justin Ethier 2018-10-08 18:49:59 -04:00
parent 7404f229d8
commit c4a952fba0

View file

@ -3082,10 +3082,28 @@ extern object __glo_square_191_191inline_191_191_scheme_base;
extern object __glo_eof_91object_191_191inline_191_191_scheme_base;
#include "cyclone/runtime.h"
#include "cyclone/runtime-main.h"
static void __host_lambda_1(void *data, int pc, int argc, object *args);
static void __host_lambda_1(void *data, int pc, int argc, object *args) { // TODO: self? cont?
static void __host_lambda_1(void *data, int argc);
static void __lambda_2(void *data, int argc, object self_7311, object r_737) {
((gc_thread_data *)data)->pc = 2;
((gc_thread_data *)data)->args[0] = self_7311;
((gc_thread_data *)data)->args[1] = r_737;
__host_lambda_1(data, argc);
}
static void __lambda_1(void *data, int argc, closure _,object k_735, object n_731_732) {
((gc_thread_data *)data)->pc = 1;
((gc_thread_data *)data)->args[0] = k_735;
((gc_thread_data *)data)->args[1] = n_731_732;
__host_lambda_1(data, argc);
}
static void __lambda_3(void *data, int argc, object self_7312, object r_7310) {
((gc_thread_data *)data)->pc = 3;
((gc_thread_data *)data)->args[0] = self_7312;
((gc_thread_data *)data)->args[1] = r_7310;
__host_lambda_1(data, argc);
}
static void __host_lambda_1(void *data, int argc) {
object top;
object stack = ((gc_thread_data *)data)->args; // TODO: do it inline for benchmarks/production code
object *stack = ((gc_thread_data *)data)->args; // TODO: do it inline for benchmarks/production code
// // initialize "stack" here, and unload arguments.
// // assumes the compile can compute the stack's max size, since it knows the number of args each function has
// memcpy(stack, args, sizeof(object) * argc);
@ -3096,19 +3114,19 @@ static void __host_lambda_1(void *data, int pc, int argc, object *args) { // TOD
// bundle up args, pc, and pass them along
switch(((gc_thread_data *)data)->pc) {
3: { // Lambda ID 3
case 3: { // Lambda ID 3
//static void __lambda_3(void *data, int argc, object self_7312, object r_7310) {
// return_closcall2(data, __glo_write_scheme_write, primitive__75halt, r_7310);;
return_closcall2(data, __glo_write_scheme_write, primitive__75halt, stack[1]);
break;
}
1: { // Lambda ID 1
case 1: { // Lambda ID 1
//static void __lambda_1(void *data, int argc, closure _,object k_735, object n_731_732) {
Cyc_st_add(data, "fac-test.scm:fac");
// TODO: how much smarter does our compiler need to be to compute local jumps for the below instead of C fnc calls?
object c_7316 = Cyc_num_fast_eq_op(data, stack[1], obj_int2obj(0));
if( (boolean_f != c_7316) ){
return_closcall1(data, k_735, obj_int2obj(1));
return_closcall1(data, stack[0], obj_int2obj(1));
} else {
closureN_type* c_7319 = alloca(sizeof(closureN_type));
@ -3129,7 +3147,7 @@ return_closcall2(data, __glo_fac, &c_7319, c_7330);
// TODO
break;
}
2: { // Lambda ID 2
case 2: { // Lambda ID 2
//static void __lambda_2(void *data, int argc, object self_7311, object r_737) {
//complex_num_type local_7324; object c_7325 = Cyc_fast_mul(data,&local_7324,((closureN)self_7311)->elements[1], r_737);
//return_closcall1(data, ((closureN)self_7311)->elements[0], c_7325);;
@ -3208,9 +3226,9 @@ static void c_entry_pt_first_lambda(void *data, int argc, closure cont, object v
mclosure0(c_7332, (function_type)__lambda_3);c_7332.num_args = 1;
TODO: how do we know what calling convention to use for glo_fac? we could use a wrapper that accepts
the current calling convention and then makes a call to the real function. this sucks in terms of
performance (unless we can make it up later via a goto loop!) but may be a reasonable starting point
//TODO: how do we know what calling convention to use for glo_fac? we could use a wrapper that accepts
//the current calling convention and then makes a call to the real function. this sucks in terms of
//performance (unless we can make it up later via a goto loop!) but may be a reasonable starting point
return_closcall2(data, __glo_fac, &c_7332, obj_int2obj(10));
;
}