optimize op_para and op_deft: change hashmap<string,u64> to hashmap<u32,u32>

This commit is contained in:
ValKmjolnir
2022-07-23 12:02:41 +08:00
parent 8ca0bc52c3
commit e9fc70bba8
3 changed files with 17 additions and 13 deletions
+7 -7
View File
@@ -122,13 +122,13 @@ struct nasal_hash
struct nasal_func
{
int32_t dynpara; // dynamic parameter name index in hash.
uint32_t entry; // pc will set to entry-1 to call this function
uint32_t psize; // used to load default parameters to a new function
uint32_t lsize; // used to expand memory space for local values on stack
std::vector<nasal_ref> local; // local scope with default value(nasal_ref)
std::vector<nasal_ref> upvalue; // closure
std::unordered_map<std::string,size_t> keys; // parameter name table, size_t begins from 1
int32_t dynpara; // dynamic parameter name index in hash.
uint32_t entry; // pc will set to entry-1 to call this function
uint32_t psize; // used to load default parameters to a new function
uint32_t lsize; // used to expand memory space for local values on stack
std::vector<nasal_ref> local; // local scope with default value(nasal_ref)
std::vector<nasal_ref> upvalue; // closure
std::unordered_map<uint32_t,uint32_t> keys; // parameter name table, size_t begins from 1
nasal_func():dynpara(-1),entry(0),psize(0),lsize(0){}
void clear();