Tcl Source Code

Hex Artifact Content
Login

Artifact 171462a90496c43a375089b7b501a8635a7126e3:

Attachment "README" to ticket [519535ffff] added by msofer 2002-02-19 03:41:49.
0000: 54 68 69 73 20 69 73 20 61 20 76 65 72 79 20 72  This is a very r
0010: 6f 75 67 68 2f 65 78 70 65 72 69 6d 65 6e 74 61  ough/experimenta
0020: 6c 20 70 61 74 63 68 21 20 0a 0a 0a 49 20 2d 20  l patch! ...I - 
0030: 43 68 61 6e 67 65 73 20 69 6e 20 74 68 69 73 20  Changes in this 
0040: 70 61 74 63 68 3a 0a 0a 20 20 20 2a 20 49 6e 63  patch:..   * Inc
0050: 6f 72 70 6f 72 61 74 69 6f 6e 20 6f 66 20 6e 65  orporation of ne
0060: 77 20 66 75 6e 63 74 69 6f 6e 73 20 77 69 74 68  w functions with
0070: 20 73 69 67 6e 61 74 75 72 65 0a 20 20 20 20 20   signature.     
0080: 20 54 63 6c 5f 4f 62 6a 20 2a 20 54 63 6c 43 6f   Tcl_Obj * TclCo
0090: 72 65 46 75 6e 20 28 54 63 6c 5f 49 6e 74 65 72  reFun (Tcl_Inter
00a0: 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 6f  p *interp, int o
00b0: 62 6a 63 2c 20 0a 20 20 20 20 20 20 20 20 20 20  bjc, .          
00c0: 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20   Tcl_Obj *CONST 
00d0: 6f 62 6a 76 5b 5d 2c 20 69 6e 74 20 61 72 67 63  objv[], int argc
00e0: 2c 20 43 6c 69 65 6e 74 44 61 74 61 20 2a 61 72  , ClientData *ar
00f0: 67 76 29 3b 0a 0a 20 20 20 20 20 54 68 65 73 65  gv);..     These
0100: 20 77 69 6c 6c 20 69 6d 70 6c 65 6d 65 6e 74 20   will implement 
0110: 74 68 65 20 63 6f 72 65 20 66 75 6e 63 74 69 6f  the core functio
0120: 6e 61 6c 69 74 79 20 6f 66 20 54 63 6c 3b 20 74  nality of Tcl; t
0130: 68 65 20 73 74 61 6e 64 61 72 64 0a 20 20 20 20  he standard.    
0140: 20 63 61 6c 6c 73 20 61 63 74 20 61 73 20 66 72   calls act as fr
0150: 6f 6e 74 20 65 6e 64 73 20 66 6f 72 20 74 68 65  ont ends for the
0160: 6d 2e 0a 0a 20 20 20 20 20 54 68 65 20 75 73 61  m...     The usa
0170: 67 65 20 69 73 20 74 6f 20 61 6c 6c 6f 77 20 72  ge is to allow r
0180: 65 63 65 69 76 69 6e 67 20 70 6f 69 6e 74 65 72  eceiving pointer
0190: 73 20 74 6f 20 43 20 73 74 72 75 63 74 75 72 65  s to C structure
01a0: 73 20 74 68 61 74 20 61 72 65 0a 20 20 20 20 20  s that are.     
01b0: 64 65 74 65 72 6d 69 6e 65 64 20 61 74 20 70 72  determined at pr
01c0: 6f 63 2d 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20  oc-compile time 
01d0: 2d 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74  - for example, t
01e0: 6f 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20  o variables...  
01f0: 20 2a 20 4d 6f 64 69 66 69 63 61 74 69 6f 6e 20   * Modification 
0200: 6f 66 20 74 68 65 20 6d 61 69 6e 20 76 61 72 69  of the main vari
0210: 61 62 6c 65 20 61 63 63 65 73 73 20 66 75 6e 63  able access func
0220: 74 69 6f 6e 73 20 69 6e 20 74 63 6c 56 61 72 2e  tions in tclVar.
0230: 63 20 74 6f 0a 20 20 20 20 20 66 6f 6c 6c 6f 77  c to.     follow
0240: 20 74 68 69 73 20 73 74 72 75 63 74 75 72 65 2e   this structure.
0250: 20 46 61 63 74 6f 72 69 6e 67 20 6f 75 74 20 54   Factoring out T
0260: 63 6c 4c 6f 6f 6b 75 70 56 61 72 2e 0a 0a 20 20  clLookupVar...  
0270: 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20 6f 66   * Definition of
0280: 20 6e 65 77 20 69 6e 73 74 72 75 63 74 69 6f 6e   new instruction
0290: 73 20 74 6f 0a 20 20 20 20 20 20 20 2d 20 6c 6f  s to.       - lo
02a0: 6f 6b 75 70 20 76 61 72 69 61 62 6c 65 20 70 6f  okup variable po
02b0: 69 6e 74 65 72 73 20 67 69 76 65 6e 20 74 68 65  inters given the
02c0: 69 72 20 69 6e 64 65 78 20 28 6c 6f 63 61 6c 73  ir index (locals
02d0: 29 20 6f 72 20 6e 61 6d 65 0a 20 20 20 20 20 20  ) or name.      
02e0: 20 2d 20 70 75 73 68 20 6e 6f 6e 2d 54 63 6c 5f   - push non-Tcl_
02f0: 4f 62 6a 20 69 74 65 6d 73 20 6f 6e 20 74 68 65  Obj items on the
0300: 20 54 63 6c 20 73 74 61 63 6b 0a 20 20 20 20 20   Tcl stack.     
0310: 20 20 2d 20 63 61 6c 6c 20 61 20 54 63 6c 43 6f    - call a TclCo
0320: 72 65 46 75 6e 0a 0a 20 20 20 2a 20 74 65 73 74  reFun..   * test
0330: 20 74 72 69 61 6c 3a 20 5b 67 65 74 73 5d 20 69   trial: [gets] i
0340: 73 20 63 6f 6d 70 69 6c 65 64 20 75 73 69 6e 67  s compiled using
0350: 20 74 68 65 73 65 20 69 6e 74 65 72 66 61 63 65   these interface
0360: 73 2c 20 77 69 74 68 20 61 20 32 30 25 20 0a 20  s, with a 20% . 
0370: 20 20 20 20 73 70 65 65 64 20 67 61 69 6e 20 69      speed gain i
0380: 6e 20 74 68 65 20 62 65 6e 63 68 6d 61 72 6b 73  n the benchmarks
0390: 3a 0a 0a 20 20 20 20 20 30 30 30 20 56 45 52 53  :..     000 VERS
03a0: 49 4f 4e 53 3a 20 20 20 20 20 20 20 20 20 20 20  IONS:           
03b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03c0: 70 61 74 63 68 65 64 20 20 20 20 48 45 41 44 0a  patched    HEAD.
03d0: 20 20 20 20 20 30 30 31 20 52 45 41 44 20 35 39       001 READ 59
03e0: 35 4b 2c 20 67 65 74 73 20 20 20 20 20 20 20 20  5K, gets        
03f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 33                13
0400: 36 34 38 32 20 20 31 37 35 36 37 34 0a 20 20 20  6482  175674.   
0410: 20 20 30 30 36 20 52 45 41 44 20 33 30 35 30 62    006 READ 3050b
0420: 2c 20 67 65 74 73 20 20 20 20 20 20 20 20 20 20  , gets          
0430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 34                74
0440: 32 20 20 20 20 20 39 35 33 0a 20 20 20 20 20 30  2     953.     0
0450: 31 31 20 52 45 41 44 20 62 69 6e 20 35 39 35 4b  11 READ bin 595K
0460: 2c 20 67 65 74 73 20 20 20 20 20 20 20 20 20 20  , gets          
0470: 20 20 20 20 20 20 20 20 31 34 35 32 34 38 20 20          145248  
0480: 31 38 33 39 34 32 0a 20 20 20 20 20 30 31 36 20  183942.     016 
0490: 52 45 41 44 20 62 69 6e 20 33 30 35 30 62 2c 20  READ bin 3050b, 
04a0: 67 65 74 73 20 20 20 20 20 20 20 20 20 20 20 20  gets            
04b0: 20 20 20 20 20 20 20 20 38 30 33 20 20 20 20 31          803    1
04c0: 30 30 37 0a 0a 0a 49 49 20 2d 20 4e 6f 74 65 73  007...II - Notes
04d0: 3a 0a 0a 20 20 20 2a 20 49 4e 53 54 5f 47 45 54  :..   * INST_GET
04e0: 5f 53 43 41 4c 41 52 2c 20 49 4e 53 54 5f 53 45  _SCALAR, INST_SE
04f0: 54 5f 53 43 41 4c 41 52 2c 20 49 4e 53 54 5f 49  T_SCALAR, INST_I
0500: 4e 43 52 5f 53 43 41 4c 41 52 20 61 6e 64 0a 20  NCR_SCALAR and. 
0510: 20 20 20 20 49 4e 53 54 5f 46 4f 52 45 41 43 48      INST_FOREACH
0520: 20 77 65 72 65 20 63 68 61 6e 67 65 64 20 74 6f   were changed to
0530: 20 75 73 65 20 64 69 72 65 63 74 6c 79 20 74 68   use directly th
0540: 65 20 63 6f 72 65 20 66 75 6e 63 74 69 6f 6e 73  e core functions
0550: 0a 20 20 20 20 20 69 6e 73 74 65 61 64 20 6f 66  .     instead of
0560: 20 67 6f 69 6e 67 20 74 68 72 6f 75 67 68 20 74   going through t
0570: 68 65 20 69 6e 74 65 72 66 61 63 65 2e 0a 0a 20  he interface... 
0580: 20 20 2a 20 74 68 65 20 28 69 6e 63 72 29 20 66    * the (incr) f
0590: 75 6e 63 74 69 6f 6e 73 27 20 69 6e 74 65 72 61  unctions' intera
05a0: 63 74 69 6f 6e 20 77 69 74 68 20 74 68 65 20 6e  ction with the n
05b0: 65 77 20 36 34 62 69 74 20 70 61 74 63 68 20 68  ew 64bit patch h
05c0: 61 73 20 74 6f 0a 20 20 20 20 20 62 65 20 74 68  as to.     be th
05d0: 6f 75 67 68 74 20 6f 75 74 3b 20 61 73 20 69 73  ought out; as is
05e0: 20 68 65 72 65 2c 20 69 74 20 77 69 6c 6c 20 70   here, it will p
05f0: 72 6f 62 61 62 6c 79 20 62 6f 6d 62 20 2d 20 74  robably bomb - t
0600: 68 65 20 70 61 74 63 68 0a 20 20 20 20 20 61 73  he patch.     as
0610: 73 75 6d 65 73 20 74 68 61 74 20 79 6f 75 20 63  sumes that you c
0620: 61 6e 20 73 74 6f 72 65 20 61 20 22 6c 6f 6e 67  an store a "long
0630: 22 20 69 6e 20 61 20 22 43 6c 69 65 6e 74 44 61  " in a "ClientDa
0640: 74 61 22 0a 0a 20 20 20 2a 20 61 6c 6c 20 68 6f  ta"..   * all ho
0650: 70 65 20 6f 66 20 70 6f 72 74 61 62 69 6c 69 74  pe of portabilit
0660: 79 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65  y of the compile
0670: 64 20 63 6f 64 65 20 69 73 20 67 6f 6e 65 2c 20  d code is gone, 
0680: 61 73 20 69 74 20 75 73 65 73 0a 20 20 20 20 20  as it uses.     
0690: 70 6f 69 6e 74 65 72 73 2e 20 41 20 6e 65 77 20  pointers. A new 
06a0: 73 61 76 65 2f 6c 6f 61 64 20 66 61 63 69 6c 69  save/load facili
06b0: 74 79 20 66 6f 72 20 63 6f 6d 70 69 6c 65 64 20  ty for compiled 
06c0: 63 6f 64 65 20 68 61 73 20 74 6f 20 62 65 0a 20  code has to be. 
06d0: 20 20 20 20 74 68 6f 75 67 68 74 20 6f 75 74 3b      thought out;
06e0: 20 69 74 20 63 61 6e 20 62 65 20 69 6d 70 6c 65   it can be imple
06f0: 6d 65 6e 74 65 64 20 76 69 61 20 73 74 75 62 73  mented via stubs
0700: 20 74 61 62 6c 65 73 2e 0a 0a 49 49 49 20 2d 20   tables...III - 
0710: 4f 75 74 6c 6f 6f 6b 3a 0a 0a 20 20 20 2a 20 54  Outlook:..   * T
0720: 68 65 20 64 65 74 61 69 6c 73 20 6e 65 65 64 20  he details need 
0730: 73 6f 6d 65 20 77 6f 72 6b 69 6e 67 20 6f 75 74  some working out
0740: 3b 20 68 6f 77 65 76 65 72 2c 20 69 74 20 69 73  ; however, it is
0750: 20 63 6f 6e 63 65 69 76 61 62 6c 65 0a 20 20 20   conceivable.   
0760: 20 20 74 68 61 74 20 74 68 65 20 6e 65 77 20 65    that the new e
0770: 6e 67 69 6e 65 20 77 69 6c 6c 20 6f 6e 6c 79 20  ngine will only 
0780: 61 64 64 72 65 73 73 20 76 61 72 69 61 62 6c 65  address variable
0790: 73 20 74 68 72 6f 75 67 68 20 61 0a 20 20 20 20  s through a.    
07a0: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20   combination of 
07b0: 28 49 4e 53 54 5f 4c 4f 4f 4b 55 50 2c 20 49 4e  (INST_LOOKUP, IN
07c0: 53 54 5f 43 41 4c 4c 5f 43 46 55 4e 29 2e 0a 0a  ST_CALL_CFUN)...
07d0: 20 20 20 2a 20 54 68 69 73 20 6f 70 65 6e 73 20     * This opens 
07e0: 74 68 65 20 70 61 74 68 20 66 6f 72 20 63 6f 6d  the path for com
07f0: 70 69 6c 69 6e 67 20 61 6c 6c 20 69 6e 73 74 72  piling all instr
0800: 75 63 74 69 6f 6e 73 2c 20 70 65 72 66 6f 72 6d  uctions, perform
0810: 69 6e 67 0a 20 20 20 20 20 73 75 62 2d 63 6f 6d  ing.     sub-com
0820: 6d 61 6e 64 20 73 65 6c 65 63 74 69 6f 6e 20 61  mand selection a
0830: 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2c 20  t compile time, 
0840: 61 6e 64 20 6d 61 6e 79 20 6f 74 68 65 72 20 6f  and many other o
0850: 70 74 73 2e 0a 0a                                pts...