Changeset 427

Show
Ignore:
Timestamp:
10/26/08 03:14:22 (2 months ago)
Author:
mooneer
Message:

More performance improvements, this time, by caching identifiers we've
dereferenced.

Location:
interpreter/trunk/vm
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • interpreter/trunk/vm/kite_execute.c

    r426 r427  
    189189            res = kite_new_null(thd); 
    190190        } 
     191    } else if (((kite_funccall_info_t*)cur->obj)->last_deref && 
     192        !strcmp(((kite_funccall_info_t*)cur->obj)->last_deref, ident_string)) { 
     193        found = ((kite_funccall_info_t*)cur->obj)->last_deref_obj; 
     194        kite_reference_object(found->value); 
     195        kite_push_stack(&thd->running_stack, TRUE, found); 
     196        return; 
    191197    } else { 
    192198        do { 
     
    264270        kite_push_stack(&thd->running_stack, TRUE, found); 
    265271        kite_dereference_object(ident); 
     272 
     273        stackentry->last_deref = ident_string; 
     274        stackentry->last_deref_obj = found; 
     275 
    266276        return; 
    267277    } 
     
    314324        found->value = kite_new_null(thd); 
    315325        kite_symtab_insert(thd, &stackentry->locals, found); 
     326        stackentry->last_deref = NULL; 
     327        stackentry->last_deref_obj = NULL; 
    316328    } 
    317329 
     
    676688            (kite_funccall_info_t*)(thd->func_stack->stack[thd->func_stack->length - 1].obj); 
    677689        kite_symtab_insert(thd, &current->locals, propinfo); 
    678          
     690        current->last_deref = NULL; 
     691        current->last_deref_obj = NULL; 
     692 
    679693        thd->exception = NULL; 
    680694        return ins->handler; 
     
    954968            (kite_funccall_info_t*)kite_top_stack(thd->func_stack); 
    955969        entry->this = this; 
     970        entry->last_deref = NULL; 
     971        entry->last_deref_obj = NULL; 
    956972    } 
    957973     
  • interpreter/trunk/vm/kite_parser.y

    r426 r427  
    209209        fcall->line = @2.first_line; 
    210210        fcall->locals = NULL; 
     211        fcall->last_deref = NULL; 
     212        fcall->last_deref_obj = NULL; 
    211213        fcall->sys_or_user = 0; 
    212214        fcall->this = obj; 
     
    372374        fcall->sys_or_user = 0; 
    373375        fcall->this = obj; 
     376        fcall->last_deref = NULL; 
     377        fcall->last_deref_obj = NULL; 
    374378        kite_push_stack(&thd->func_stack, FALSE, fcall); 
    375379         
     
    416420        fcall->line = @1.first_line; 
    417421        fcall->locals = NULL; 
     422        fcall->last_deref = NULL; 
     423        fcall->last_deref_obj = NULL; 
    418424        fcall->sys_or_user = 0; 
    419425        int idx = compiler->obj_created->length; 
     
    448454        fcall->line = @1.first_line; 
    449455        fcall->locals = NULL; 
     456        fcall->last_deref = NULL; 
     457        fcall->last_deref_obj = NULL; 
    450458        fcall->sys_or_user = 0; 
    451459        int idx = compiler->obj_created->length; 
  • interpreter/trunk/vm/kite_vm.h

    r426 r427  
    7171    struct kite_symtab_t *locals; 
    7272    struct kite_object_t *this; 
     73    char *last_deref; 
     74    struct kite_symtab_t *last_deref_obj; 
    7375} kite_funccall_info_t; 
    7476     
     
    211213     entry->file = ins->common.file; \ 
    212214     entry->line = ins->common.line; \ 
     215     entry->last_deref = NULL; \ 
     216     entry->last_deref_obj = NULL; \ 
    213217     entry->sys_or_user = 0; \ 
    214218     kite_push_stack(&thd->func_stack, FALSE, entry); \