aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-16 21:35:55 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-03-16 21:38:34 -0700
commitfffcc8b9abf43a69d71c37c92fc149f661dd6da1 (patch)
treec5a796db79955008c46a61bda54da7e41a47ffb7 /src
parentd6554919b1e2e5f598e7997297a358905ee54913 (diff)
downloadteliva-fffcc8b9abf43a69d71c37c92fc149f661dd6da1.tar.gz
stop running task.scheduler by default
sieve.tlv is 50% slower (18s vs 12s) with the new function call instrumentation.
Diffstat (limited to 'src')
-rw-r--r--src/lua.c3
-rw-r--r--src/task.lua19
-rw-r--r--src/teliva.c2
3 files changed, 3 insertions, 21 deletions
diff --git a/src/lua.c b/src/lua.c
index 2c5e696..5445e86 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -249,7 +249,8 @@ static int pmain (lua_State *L) {
if (s->status != 0) return 0;
/* call main() */
- lua_getglobal(L, "spawn_main");
+ assign_call_graph_depth_to_name(L, /*depth*/2, "main"); /* manually seed debug info */
+ lua_getglobal(L, "main");
s->status = docall(L, 0, 1);
if (s->status != 0) return report_in_developer_mode(L, s->status);
diff --git a/src/task.lua b/src/task.lua
index 9546069..e8bf842 100644
--- a/src/task.lua
+++ b/src/task.lua
@@ -384,25 +384,6 @@ _M.RECV = RECV
_M.SEND = SEND
_M.NOP = NOP
--- Specific to Teliva
-function spawn_main()
- task.spawn(call_main)
- task.scheduler()
- assert(false, "Teliva ran out of stuff to do. Possible causes:\n"..
- "- main() returned. Apps shouldn't let this happen.\n"..
- "- App is reading past the end of a file (after recv() returned nil)\n"..
- "- Some channel is blocked forever.\n")
- curses.nodelay(true)
- curses.getch()
-end
-
--- This function exists only to make the call to 'main' visible to Teliva.
--- Teliva can't yet recognize the caller of indirect calls, as happens with
--- task.spawn.
-function call_main()
- main()
-end
-
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Tests
diff --git a/src/teliva.c b/src/teliva.c
index dbd0677..1e2eb34 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -484,7 +484,7 @@ restart:
y += 2;
mvprintw(y, 0, "functions: ");
y++;
- for (int depth = /*ignore callers of main*/3; ; ++depth) {
+ for (int depth = /*main*/2; ; ++depth) {
mvaddstr(y, 0, " ");
bool drew_anything = false;
index_within_level = 0;