- Timestamp:
- Feb 3, 2015 9:06:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmk_cc_exec.c
r2772 r2777 325 325 uint32_t uInputHash; 326 326 #endif 327 /** Reference count. */ 328 uint32_t volatile cRefs; 327 329 } KMKCCEXPPROG; 328 330 /** Pointer to a string expansion program. */ … … 1457 1459 pProg->pFirstInstr = (PKMKCCEXPCORE)kmk_cc_block_get_next_ptr(pBlock); 1458 1460 kmk_cc_exp_stats_init(&pProg->Stats); 1461 pProg->cRefs = 1; 1459 1462 #ifdef KMK_CC_STRICT 1460 1463 pProg->uInputHash = kmk_cc_debug_string_hash_n(0, pchStr, cchStr); … … 1916 1919 pchDst = ensure_variable_buffer_space(pchDst, offStart + pProg->Stats.cchAvg + 32); 1917 1920 1921 KMK_CC_ASSERT(pProg->cRefs > 0); 1922 pProg->cRefs++; 1923 1918 1924 pchDst = kmk_exec_expand_instruction_stream_to_var_buf(pProg->pFirstInstr, pchDst); 1925 1926 pProg->cRefs--; 1927 KMK_CC_ASSERT(pProg->cRefs > 0); 1919 1928 1920 1929 cchResult = (uint32_t)(pchDst - variable_buffer); … … 1962 1971 void kmk_cc_variable_changed(struct variable *pVar) 1963 1972 { 1964 KMK_CC_ASSERT(pVar->evalprog || pVar->expandprog); 1973 PKMKCCEXPPROG pProg = pVar->expandprog; 1974 1975 KMK_CC_ASSERT(pVar->evalprog || pProg); 1976 1965 1977 #if 0 1966 1978 if (pVar->evalprog) … … 1970 1982 } 1971 1983 #endif 1972 if (pVar->expandprog) 1973 { 1974 kmk_cc_block_free_list(pVar->expandprog->pBlockTail); 1984 1985 if (pProg) 1986 { 1987 if (pProg->cRefs == 1) 1988 kmk_cc_block_free_list(pProg->pBlockTail); 1989 else 1990 fatal(NULL, _("Modifying a variable (%s) while its expansion program is running is not supported"), pVar->name); 1975 1991 pVar->expandprog = NULL; 1976 1992 } … … 1985 2001 void kmk_cc_variable_deleted(struct variable *pVar) 1986 2002 { 1987 KMK_CC_ASSERT(pVar->evalprog || pVar->expandprog); 2003 PKMKCCEXPPROG pProg = pVar->expandprog; 2004 2005 KMK_CC_ASSERT(pVar->evalprog || pProg); 2006 1988 2007 #if 0 1989 2008 if (pVar->evalprog) … … 1993 2012 } 1994 2013 #endif 1995 if (pVar->expandprog) 1996 { 1997 kmk_cc_block_free_list(pVar->expandprog->pBlockTail); 2014 2015 if (pProg) 2016 { 2017 if (pProg->cRefs == 1) 2018 kmk_cc_block_free_list(pProg->pBlockTail); 2019 else 2020 fatal(NULL, _("Deleting a variable (%s) while its expansion program is running is not supported"), pVar->name); 1998 2021 pVar->expandprog = NULL; 1999 2022 }
Note:
See TracChangeset
for help on using the changeset viewer.