|
From: Andre R. <and...@us...> - 2004-11-21 21:10:59
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31614/Common/source Modified Files: Tag: New_Tables_Experiment-branch claycallbacks.c lang.c langevaluate.c langhash.c langhtml.c langstartup.c langvalue.c langxml.c opxml.c osacomponent.c tablepack.c tablestructure.c Log Message: newhashtable now takes an additional flag indicating whether the new table should maintain a sorted list of nodes. the symbol tables used for managing local variables during execution of UserTalk code don't need a sort order unless the process is being debugged and the stack of symbol tables can be inspected through the GUI. Index: lang.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/lang.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** lang.c 4 Nov 2004 21:56:39 -0000 1.4 --- lang.c 21 Nov 2004 20:15:26 -0000 1.4.2.1 *************** *** 527,533 **** boolean langdefaultpushtable (hdlhashtable *htable) { register hdlhashtable ht; ! if (!newhashtable (htable)) return (false); --- 527,543 ---- boolean langdefaultpushtable (hdlhashtable *htable) { + /* + 2004-11-21 aradke: symbol tables for local variables don't need to maintain + a sort order, so ask newhashtable to create a pure hash table without + an associated sorted list. this speeds up insertion of local variables + into the symbol table. + + note that this is only true when the current process is not being + debugged, but in that case scriptpushtable does our job instead. + */ + register hdlhashtable ht; ! if (!newhashtable (htable, false)) return (false); Index: langstartup.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langstartup.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** langstartup.c 31 Oct 2004 18:48:51 -0000 1.3 --- langstartup.c 21 Nov 2004 20:15:26 -0000 1.3.2.1 *************** *** 325,329 **** hdlhashtable htable; ! if (!newhashtable (&htable)) /*this is where everything starts*/ return (false); --- 325,329 ---- hdlhashtable htable; ! if (!newhashtable (&htable, true)) /*this is where everything starts*/ //2004-11-21 aradke: need sorted table return (false); Index: claycallbacks.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/claycallbacks.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** claycallbacks.c 31 Oct 2004 17:59:48 -0000 1.3 --- claycallbacks.c 21 Nov 2004 20:15:26 -0000 1.3.2.1 *************** *** 474,478 **** if (hclaybaskettable == nil) { // first time called ! if (!newhashtable (&hclaybaskettable)) return (false); } --- 474,478 ---- if (hclaybaskettable == nil) { // first time called ! if (!newhashtable (&hclaybaskettable, true)) return (false); } Index: langxml.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langxml.c,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** langxml.c 17 Nov 2004 06:52:35 -0000 1.3.2.2 --- langxml.c 21 Nov 2004 20:15:26 -0000 1.3.2.3 *************** *** 1978,1982 **** goto exit; ! if (!newhashtable (&namespaces)) goto exit; --- 1978,1982 ---- goto exit; ! if (!newhashtable (&namespaces, true)) //2004-11-21 aradke: need sorted table goto exit; Index: tablestructure.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tablestructure.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** tablestructure.c 31 Oct 2004 20:41:10 -0000 1.3 --- tablestructure.c 21 Nov 2004 20:15:27 -0000 1.3.2.1 *************** *** 296,300 **** hv = *hvariable; /*copy into register*/ ! if (!newhashtable (htable)) { disposehandle ((Handle) hv); --- 296,300 ---- hv = *hvariable; /*copy into register*/ ! if (!newhashtable (htable, true)) { //2004-11-21 aradke: need sorted table disposehandle ((Handle) hv); Index: tablepack.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tablepack.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** tablepack.c 31 Oct 2004 20:41:10 -0000 1.3 --- tablepack.c 21 Nov 2004 20:15:27 -0000 1.3.2.1 *************** *** 113,117 **** return (false); ! if (!newhashtable (htable)) { disposehandle (hpackedtable); --- 113,117 ---- return (false); ! if (!newhashtable (htable, true)) { //2004-11-21 aradke: need sorted table disposehandle (hpackedtable); Index: langvalue.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langvalue.c,v retrieving revision 1.5.2.4 retrieving revision 1.5.2.5 diff -C2 -d -r1.5.2.4 -r1.5.2.5 *** langvalue.c 16 Nov 2004 23:37:01 -0000 1.5.2.4 --- langvalue.c 21 Nov 2004 20:15:26 -0000 1.5.2.5 *************** *** 8042,8045 **** --- 8042,8048 ---- 4.1b3 dmb: added call to new langseterrorcallbackline for stack tracing (on error) + + 2004-11-21 aradke: request an unsorted table for our locals if the current process + is not being debugged */ *************** *** 8095,8099 **** } ! if (!newhashtable (&hlocaltable)) /*new table for the function when it runs*/ return (false); --- 8098,8102 ---- } ! if (!newhashtable (&hlocaltable, debuggingcurrentprocess ())) /*new table for the function when it runs*/ return (false); Index: opxml.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/opxml.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** opxml.c 15 Nov 2004 20:52:24 -0000 1.3.2.1 --- opxml.c 21 Nov 2004 20:15:26 -0000 1.3.2.2 *************** *** 220,225 **** 7.0b21 PBS -- convert XML text to an outline. - - 7.0b33 PBS: changes to conform to changing spec. Both <head> and <body> are required. <head> may be empty. --- 220,223 ---- *************** *** 241,245 **** /*New local table*/ ! if (!newhashtable (&ht)) goto exit1; --- 239,243 ---- /*New local table*/ ! if (!newhashtable (&ht, true)) //2004-11-21 aradke: need sorted table goto exit1; Index: osacomponent.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/osacomponent.c,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** osacomponent.c 20 Nov 2004 19:14:37 -0000 1.6.2.1 --- osacomponent.c 21 Nov 2004 20:15:26 -0000 1.6.2.2 *************** *** 1043,1047 **** #endif ! fl = newhashtable (&storagetable); #if TARGET_API_MAC_CARBON == 1 --- 1043,1047 ---- #endif ! fl = newhashtable (&storagetable, true); //2004-11-21 aradke: need sorted table? #if TARGET_API_MAC_CARBON == 1 *************** *** 2128,2132 **** tyvaluerecord val; ! if (!newhashtable (hcontext)) return (false); --- 2128,2132 ---- tyvaluerecord val; ! if (!newhashtable (hcontext, true)) //2004-11-21 aradke: need sorted table? return (false); Index: langhtml.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhtml.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** langhtml.c 15 Nov 2004 20:52:24 -0000 1.3.2.1 --- langhtml.c 21 Nov 2004 20:15:26 -0000 1.3.2.2 *************** *** 1074,1078 **** return (false); ! if (!newhashtable (&hcontext)) /*new table for the function when it runs*/ return (false); --- 1074,1078 ---- return (false); ! if (!newhashtable (&hcontext, debuggingcurrentprocess ())) /*new table for the function when it runs*/ //2004-11-21 aradke: need sorted table? return (false); *************** *** 6081,6085 **** return (false); ! if (!newhashtable (&ht)) return (false); --- 6081,6085 ---- return (false); ! if (!newhashtable (&ht, true)) //2004-11-21 aradke: need sorted table return (false); *************** *** 6280,6284 **** goto done; ! if (!newhashtable (&ht)) goto done; --- 6280,6284 ---- goto done; ! if (!newhashtable (&ht, true)) //2004-11-21 aradke: need sorted table goto done; Index: langevaluate.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langevaluate.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** langevaluate.c 30 Oct 2004 23:11:36 -0000 1.3 --- langevaluate.c 21 Nov 2004 20:15:26 -0000 1.3.2.1 *************** *** 865,868 **** --- 865,871 ---- 8/31/92 dmb: added supports for multiple with items, object specifiers + + 2004-11-21 aradke: request an unsorted table for our locals if the current process + is not being debugged */ *************** *** 878,882 **** hdlhashnode hnode; ! if (!newhashtable (&hlocaltable)) /*new table for the function when it runs*/ return (false); --- 881,885 ---- hdlhashnode hnode; ! if (!newhashtable (&hlocaltable, debuggingcurrentprocess ())) /*new table for the function when it runs*/ return (false); Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.15 retrieving revision 1.4.2.16 diff -C2 -d -r1.4.2.15 -r1.4.2.16 *** langhash.c 21 Nov 2004 15:04:35 -0000 1.4.2.15 --- langhash.c 21 Nov 2004 20:15:26 -0000 1.4.2.16 *************** *** 502,506 **** ! boolean newhashtable (hdlhashtable *htable) { /* --- 502,506 ---- ! boolean newhashtable (hdlhashtable *htable, boolean flsorted) { /* *************** *** 515,518 **** --- 515,523 ---- 5.0d15 dmb: preserve new cttmpstack field. We're assuming that the reused table pool is mostly for local tables that actually need temp stacks. + + 2004-11-21 aradke: if flsorted is false, don't allocate a sort list and + set the sortedlist handle to nil. symbol tables for local variables + don't need to maintain a sort order unless the process is being + debugged and therefore the symbol table is accessible via the GUI. */ *************** *** 528,531 **** --- 533,541 ---- if (hmagictable != nil) { + #ifdef fltablesortorderisarray + assert (!flsorted || debuggingcurrentprocess ()); + assert ((**hmagictable).sortedlist == nil || debuggingcurrentprocess ()); + #endif + *htable = hmagictable; *************** *** 561,573 **** #ifdef fltablesortorderisarray ! if (!newlist (&hsort)) { ! ! (**ht).prevhashtable = hfirstfreetable; ! hfirstfreetable = ht; ! return (false); } ! (**ht).sortedlist = hsort; #endif --- 571,592 ---- #ifdef fltablesortorderisarray ! if (flsorted) { ! ! if (!newlist (&hsort)) { ! ! (**ht).prevhashtable = hfirstfreetable; ! hfirstfreetable = ht; ! return (false); ! } } ! else { ! ! assert (!debuggingcurrentprocess ()); ! ! hsort = nil; ! } ! (**ht).sortedlist = hsort; #endif *************** *** 1141,1145 **** #ifdef fltablesortorderisarray ! listclear ((**ht).sortedlist); #else --- 1160,1165 ---- #ifdef fltablesortorderisarray ! if ((**ht).sortedlist) ! listclear ((**ht).sortedlist); #else *************** *** 1430,1433 **** --- 1450,1456 ---- #ifdef fltablesortorderisarray + if ((**currenthashtable).sortedlist == nil) + return (true); + if (langcallbacks.comparenodescallback == (langcomparenodescallback) &falsenoop) return (listappend ((**currenthashtable).sortedlist, (Handle) hnode)); *************** *** 1495,1498 **** --- 1518,1524 ---- #ifdef fltablesortorderisarray + + if ((**currenthashtable).sortedlist == nil) + return; assert (langcallbacks.comparenodescallback != (langcomparenodescallback) &falsenoop); *************** *** 2595,2599 **** register hdlhashtable ht = htable; ! assert ((**ht).ctnodes == listcount ((**ht).sortedlist)); --- 2621,2627 ---- register hdlhashtable ht = htable; ! ! assert ((**ht).sortedlist != nil); ! assert ((**ht).ctnodes == listcount ((**ht).sortedlist)); *************** *** 2706,2709 **** --- 2734,2739 ---- #ifdef fltablesortorderisarray + assert ((**ht).sortedlist != nil); + listresort ((**ht).sortedlist, ix, &hashcompare); *************** *** 2785,2788 **** --- 2815,2820 ---- bigstring bsname; + assert ((**htable).sortedlist != nil); + for (k = 0, kmax = listcount ((**htable).sortedlist); k < kmax; k++) { *************** *** 4125,4128 **** --- 4157,4162 ---- register unsigned long k, kmax; + assert ((**htable).sortedlist != nil); + for (k = 0, kmax = listcount ((**htable).sortedlist); k < kmax; k++) { *************** *** 4177,4180 **** --- 4211,4216 ---- #ifdef fltablesortorderisarray + assert ((**htable).sortedlist != nil); + if (!listvalidindex ((**htable).sortedlist, n)) return (false); *************** *** 4228,4231 **** --- 4264,4269 ---- boolean flfound; + assert ((**htable).sortedlist != nil); + pushhashtable (htable); /*for hashcompare*/ |