Skip to content
Myr

Rename block_bind_incremental to block_bind_referenced

Before adoption: this commit came in with the history the project adopted, so no landing records it.

block_bind_incremental is block_bind_referenced in a loop backwards. For an 1-inst block, it does the same thing and isn't too much more expensive, so it's not really useful to keep both. Also, block_bind_referenced was a better name for the function.

authored by Muh Muhten · committed by Nico Williams · parent 8537b93 · Browse files · 3 files+8 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−18 removed

  • other:+8 added−18 removed

3 files+8 added−18 removed

modified:src/builtin.c+1 added-1 removed
1791 unmodified lines
1792 builtins = bind_bytecoded_builtins(builtins);1793 builtins = gen_cbinding(function_list, sizeof(function_list)/sizeof(function_list[0]), builtins);1794 builtins = gen_builtin_list(builtins);17951796 *bb = block_bind_incremental(builtins, *bb, OP_IS_CALL_PSEUDO);1796 *bb = block_bind_referenced(builtins, *bb, OP_IS_CALL_PSEUDO);1797 *bb = block_drop_unreferenced(*bb);1798 return nerrors;1799}
modified:src/compile.c+7 added-16 removed
419 unmodified lines
420 free(matchname);421 return body; // We don't return a join because we don't want those sticking around...422}423424// Bind binder to body, then throw it away if not referenced.425block block_bind_referenced(block binder, block body, int bindflags) {426 assert(block_is_single(binder));427 assert(block_has_only_binders(binder, bindflags));428 bindflags |= OP_HAS_BINDING;429430 if (block_bind_subblock(binder, body, bindflags, 0) == 0) {431 block_free(binder);432 } else {433 body = BLOCK(binder, body);434 }435 return body;436}437424static inst* block_take_last(block* b) {425 inst* i = b->last;426 if (i == 0)427 return 0;
9 unmodified lines
437}438439// Binds a sequence of binders, which *must not* alrady be bound to each other,440// to body, throwing away unreferenced defs455block block_bind_incremental(block binder, block body, int bindflags) {441block block_bind_referenced(block binder, block body, int bindflags) {442 assert(block_has_only_binders(binder, bindflags));443 bindflags |= OP_HAS_BINDING;444445 inst* curr;446 while ((curr = block_take_last(&binder))) {461 body = block_bind_referenced(inst_block(curr), body, bindflags);447 block b = inst_block(curr);448 if (block_bind_subblock(b, body, bindflags, 0) == 0) {449 block_free(b);450 } else {451 body = BLOCK(b, body);452 }453 }454 return body;455}456
957 unmodified lines
modified:src/compile.h-1 removed
72 unmodified lines
73int block_is_funcdef(block b);74int block_is_single(block b);75block block_bind_library(block binder, block body, int bindflags, const char* libname);76block block_bind_referenced(block binder, block body, int bindflags);77block block_bind_incremental(block binder, block body, int bindflags);77block block_bind_self(block binder, int bindflags);78block block_drop_unreferenced(block body);7980jv block_take_imports(block* body);
26 unmodified lines