Mercurial > repos > rhope
diff cbackend.rhope @ 105:43cc42df26cc
Various compiler improvements
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 24 Aug 2010 23:22:17 -0400 |
parents | f51c4c17457c |
children | e5627038b7e7 fd23ab2c1a73 |
line wrap: on
line diff
--- a/cbackend.rhope Wed Aug 11 03:13:28 2010 -0400 +++ b/cbackend.rhope Tue Aug 24 23:22:17 2010 -0400 @@ -1181,6 +1181,11 @@ out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ] } +_Consts C Release[text,value,name:out] +{ + out <- [text]Append[ [["\trelease_ref(_const_"]Append[Escape Rhope Name[name]]]Append[");\n"] ] +} + _List Literal El[text,val,index,type reg:out] { out <- [[[[text @@ -1467,8 +1472,9 @@ #include \"blueprint.h\" #include \"array.h\" #include \"worker.h\" -#include \"bool.h\"\n\n" - out <- [[[[[[[[[[[[[[[headers +#include \"bool.h\" +#include <sys/time.h>\n\n" + out <- [[[[[[[[[[[[[[[[[headers ]Append[[program]Dispatch[all methods]] ]Append[[[program]Type Registry >>]Type Defs] ]Append[Fold["_Consts C Program", @@ -1476,8 +1482,17 @@ constants]] ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], "", Filter[[program]Functions >>, "Not Native"]]] ]Append["\n +#ifdef ENABLE_PROFILING +uint64_t profile_counts[END]; +uint64_t profile_totals[END]; +uint64_t profile_selftotals[END]; +#endif + int32_t rhope(uint32_t func, object ** params, uint16_t numparams, uint16_t callspace) { +#ifdef ENABLE_PROFILING + struct timeval time; +#endif uint16_t resume,idx, vcparam_offset, last_vcparam; context * ct; calldata * cdata, *temp_cdata, *my_cdata; @@ -1587,7 +1602,20 @@ inout[1] = make_String(argv[idx]); rhope(FUNC_Append, inout, 2, 2); } - numret = rhope(FUNC_Main, inout, 1, 1); + numret = rhope(FUNC_Main, inout, 1, 1);"] + ]Append[Fold["_Consts C Release", "", constants]] + ]Append[ + " + print_mem_info(manager); + print_live_object_types(manager); + +#ifdef ENABLE_PROFILING + for (idx = 0; idx < END; ++idx) + { + if(profile_counts[idx]) + printf(\"Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\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])); + } +#endif if (!numret) return 0; if (numret < 0)