Mercurial > repos > rhope
comparison 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 |
comparison
equal
deleted
inserted
replaced
103:7428aa5d6ade | 105:43cc42df26cc |
---|---|
1177 } | 1177 } |
1178 | 1178 |
1179 _Consts C Program[text,value,name:out] | 1179 _Consts C Program[text,value,name:out] |
1180 { | 1180 { |
1181 out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ] | 1181 out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ] |
1182 } | |
1183 | |
1184 _Consts C Release[text,value,name:out] | |
1185 { | |
1186 out <- [text]Append[ [["\trelease_ref(_const_"]Append[Escape Rhope Name[name]]]Append[");\n"] ] | |
1182 } | 1187 } |
1183 | 1188 |
1184 _List Literal El[text,val,index,type reg:out] | 1189 _List Literal El[text,val,index,type reg:out] |
1185 { | 1190 { |
1186 out <- [[[[text | 1191 out <- [[[[text |
1465 #include \"func.h\" | 1470 #include \"func.h\" |
1466 #include \"integer.h\" | 1471 #include \"integer.h\" |
1467 #include \"blueprint.h\" | 1472 #include \"blueprint.h\" |
1468 #include \"array.h\" | 1473 #include \"array.h\" |
1469 #include \"worker.h\" | 1474 #include \"worker.h\" |
1470 #include \"bool.h\"\n\n" | 1475 #include \"bool.h\" |
1471 out <- [[[[[[[[[[[[[[[headers | 1476 #include <sys/time.h>\n\n" |
1477 out <- [[[[[[[[[[[[[[[[[headers | |
1472 ]Append[[program]Dispatch[all methods]] | 1478 ]Append[[program]Dispatch[all methods]] |
1473 ]Append[[[program]Type Registry >>]Type Defs] | 1479 ]Append[[[program]Type Registry >>]Type Defs] |
1474 ]Append[Fold["_Consts C Program", | 1480 ]Append[Fold["_Consts C Program", |
1475 Fold["_Defs C Program", "", [program]Functions >>], | 1481 Fold["_Defs C Program", "", [program]Functions >>], |
1476 constants]] | 1482 constants]] |
1477 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], "", Filter[[program]Functions >>, "Not Native"]]] | 1483 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], "", Filter[[program]Functions >>, "Not Native"]]] |
1478 ]Append["\n | 1484 ]Append["\n |
1485 #ifdef ENABLE_PROFILING | |
1486 uint64_t profile_counts[END]; | |
1487 uint64_t profile_totals[END]; | |
1488 uint64_t profile_selftotals[END]; | |
1489 #endif | |
1490 | |
1479 int32_t rhope(uint32_t func, object ** params, uint16_t numparams, uint16_t callspace) | 1491 int32_t rhope(uint32_t func, object ** params, uint16_t numparams, uint16_t callspace) |
1480 { | 1492 { |
1493 #ifdef ENABLE_PROFILING | |
1494 struct timeval time; | |
1495 #endif | |
1481 uint16_t resume,idx, vcparam_offset, last_vcparam; | 1496 uint16_t resume,idx, vcparam_offset, last_vcparam; |
1482 context * ct; | 1497 context * ct; |
1483 calldata * cdata, *temp_cdata, *my_cdata; | 1498 calldata * cdata, *temp_cdata, *my_cdata; |
1484 DispatchVar | 1499 DispatchVar |
1485 FuncDef(Build) | 1500 FuncDef(Build) |
1585 for (idx = 0; idx < argc; ++idx) | 1600 for (idx = 0; idx < argc; ++idx) |
1586 { | 1601 { |
1587 inout[1] = make_String(argv[idx]); | 1602 inout[1] = make_String(argv[idx]); |
1588 rhope(FUNC_Append, inout, 2, 2); | 1603 rhope(FUNC_Append, inout, 2, 2); |
1589 } | 1604 } |
1590 numret = rhope(FUNC_Main, inout, 1, 1); | 1605 numret = rhope(FUNC_Main, inout, 1, 1);"] |
1606 ]Append[Fold["_Consts C Release", "", constants]] | |
1607 ]Append[ | |
1608 " | |
1609 print_mem_info(manager); | |
1610 print_live_object_types(manager); | |
1611 | |
1612 #ifdef ENABLE_PROFILING | |
1613 for (idx = 0; idx < END; ++idx) | |
1614 { | |
1615 if(profile_counts[idx]) | |
1616 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])); | |
1617 } | |
1618 #endif | |
1591 if (!numret) | 1619 if (!numret) |
1592 return 0; | 1620 return 0; |
1593 if (numret < 0) | 1621 if (numret < 0) |
1594 return numret; | 1622 return numret; |
1595 if (get_blueprint(inout[0])->type_id == TYPE_INT32) | 1623 if (get_blueprint(inout[0])->type_id == TYPE_INT32) |