Mercurial > repos > rhope
annotate runtime/main_end.c @ 186:ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Oct 2011 00:10:02 -0700 |
parents | |
children |
rev | line source |
---|---|
186
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #ifdef ENABLE_PROFILING |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 for (idx = 0; idx < END; ++idx) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 { |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 if(profile_counts[idx]) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 printf("Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\tNested Count: %llu\n", idx, profile_counts[idx], profile_totals[idx], ((double)profile_totals[idx])/((double)profile_counts[idx]), profile_selftotals[idx], ((double)profile_selftotals[idx])/((double)profile_counts[idx]), profile_nestedcounts[idx]); |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 } |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 #endif |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 if (!numret) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 return 0; |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 if (numret < 0) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 return numret; |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 if (get_blueprint(inout[0])->type_id == TYPE_INT32) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 return ((t_Int32 *)inout[0])->Num; |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 #ifdef RAW_FUNC |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 ret = f_If(1, inout); |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 if (ret.retvals[0]) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 #else |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 rhope(FUNC_If, inout, 1, 2); |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 if (inout[0]) |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 #endif |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 return 0; |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 return 1; |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 } |
ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 |