VM: simplifies factor_vm::determine_inline_cache_type

db4
Björn Lindqvist 2016-02-28 01:10:12 +01:00
parent 5663d39a76
commit 2db1e7e6a5
1 changed files with 3 additions and 8 deletions

View File

@ -17,18 +17,13 @@ void factor_vm::deallocate_inline_cache(cell return_address) {
/* Figure out what kind of type check the PIC needs based on the methods /* Figure out what kind of type check the PIC needs based on the methods
it contains */ it contains */
cell factor_vm::determine_inline_cache_type(array* cache_entries) { cell factor_vm::determine_inline_cache_type(array* cache_entries) {
bool seen_tuple = false; for (cell i = 0; i < array_capacity(cache_entries); i += 2) {
cell i;
for (i = 0; i < array_capacity(cache_entries); i += 2) {
/* Is it a tuple layout? */ /* Is it a tuple layout? */
if (TAG(array_nth(cache_entries, i)) == ARRAY_TYPE) { if (TAG(array_nth(cache_entries, i)) == ARRAY_TYPE) {
seen_tuple = true; return PIC_TUPLE;
break;
} }
} }
return PIC_TAG;
return seen_tuple ? PIC_TUPLE : PIC_TAG;
} }
void factor_vm::update_pic_count(cell type) { void factor_vm::update_pic_count(cell type) {