Bug 115301 - fourthTier: SymbolTable should be thread-safe
Summary: fourthTier: SymbolTable should be thread-safe
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 112839
  Show dependency treegraph
 
Reported: 2013-04-27 00:08 PDT by Filip Pizlo
Modified: 2013-04-27 16:13 PDT (History)
15 users (show)

See Also:


Attachments
work in progress (12.35 KB, patch)
2013-04-27 00:08 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (17.28 KB, patch)
2013-04-27 00:25 PDT, Filip Pizlo
ggaren: review+
webkit-ews: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2013-04-27 00:08:25 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2013-04-27 00:08:55 PDT
Created attachment 199896 [details]
work in progress
Comment 2 Filip Pizlo 2013-04-27 00:25:21 PDT
Created attachment 199897 [details]
the patch
Comment 3 Early Warning System Bot 2013-04-27 00:31:32 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass qt-wk2-ews (qt-wk2):
Output: http://webkit-queues.appspot.com/results/56828
Comment 4 Early Warning System Bot 2013-04-27 00:32:27 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass qt-ews (qt):
Output: http://webkit-queues.appspot.com/results/173248
Comment 5 EFL EWS Bot 2013-04-27 00:39:53 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/183476
Comment 6 EFL EWS Bot 2013-04-27 00:41:52 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/239024
Comment 7 Build Bot 2013-04-27 00:51:10 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/58697
Comment 8 Build Bot 2013-04-27 00:56:06 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/37478
Comment 9 Build Bot 2013-04-27 01:03:01 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/51283
Comment 10 kov's GTK+ EWS bot 2013-04-27 01:15:56 PDT
Comment on attachment 199897 [details]
the patch

Attachment 199897 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/153472
Comment 11 Filip Pizlo 2013-04-27 01:51:26 PDT
A near flawless victory of EWS destruction! ;-)  Too bad this patch is for the FTL branch.
Comment 12 Filip Pizlo 2013-04-27 11:16:39 PDT
As expected, this has neutral performance:


Benchmark report for SunSpider, V8Spider, Octane, Kraken, and JSRegress on oldmac (MacPro4,1).

VMs tested:
"TipOfTree" at /Volumes/Data/pizlo/fourthTier/OpenSource/WebKitBuild/Release/jsc (r149236)
"LockedSymTab" at /Volumes/Data/fromMiniMe/fourthTier/secondary/OpenSource/WebKitBuild/Release/jsc (r149236)

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. Emitted a call to gc() between sample
measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the jsc-specific preciseTime() function to get
microsecond-level timing. Reporting benchmark execution times with 95% confidence intervals in milliseconds.

                                                     TipOfTree                LockedSymTab                                   
SunSpider:
   3d-cube                                         9.4853+-0.1687            9.4708+-0.1534        
   3d-morph                                        8.8450+-0.1732     ?      8.8513+-0.1364        ?
   3d-raytrace                                    10.5321+-0.1532     ?     10.5752+-0.1833        ?
   access-binary-trees                             1.8999+-0.0079     ?      1.9032+-0.0063        ?
   access-fannkuch                                 7.8547+-0.1363            7.8521+-0.1087        
   access-nbody                                    4.7085+-0.0093            4.6971+-0.0403        
   access-nsieve                                   4.9781+-0.0629            4.9242+-0.0830          might be 1.0110x faster
   bitops-3bit-bits-in-byte                        1.8504+-0.0099     ?      1.8538+-0.0110        ?
   bitops-bits-in-byte                             7.1578+-0.1013            7.1349+-0.1033        
   bitops-bitwise-and                              2.8015+-0.0589            2.7942+-0.0783        
   bitops-nsieve-bits                              4.7981+-0.0170            4.7400+-0.0833          might be 1.0122x faster
   controlflow-recursive                           3.1646+-0.0494            3.1490+-0.0484        
   crypto-aes                                      7.8315+-0.1485     ?      7.9136+-0.1312        ? might be 1.0105x slower
   crypto-md5                                      4.2016+-0.0411     ?      4.2054+-0.0336        ?
   crypto-sha1                                     3.3061+-0.0154     ?      3.3242+-0.0264        ?
   date-format-tofte                              15.3321+-0.2272           15.1823+-0.1580        
   date-format-xparb                               9.4408+-0.1932     ?      9.8244+-0.3991        ? might be 1.0406x slower
   math-cordic                                     4.0593+-0.0104     ?      4.0606+-0.0073        ?
   math-partial-sums                              12.5430+-0.1325     ?     12.6080+-0.1354        ?
   math-spectral-norm                              3.1746+-0.0110     ?      3.1756+-0.0128        ?
   regexp-dna                                     12.6929+-0.1829     ?     12.9468+-0.1918        ? might be 1.0200x slower
   string-base64                                   5.1346+-0.0648            5.0202+-0.1020          might be 1.0228x faster
   string-fasta                                   10.8201+-0.1367     ?     10.8693+-0.1156        ?
   string-tagcloud                                14.7043+-0.4384           14.2581+-0.2455          might be 1.0313x faster
   string-unpack-code                             28.2888+-0.1585     ?     28.3793+-0.1470        ?
   string-validate-input                           7.4476+-0.1724            7.2448+-0.1799          might be 1.0280x faster

   <arithmetic> *                                  7.9636+-0.0633            7.9599+-0.0661          might be 1.0005x faster
   <geometric>                                     6.4131+-0.0391            6.4053+-0.0456          might be 1.0012x faster
   <harmonic>                                      5.1716+-0.0223            5.1638+-0.0278          might be 1.0015x faster

                                                     TipOfTree                LockedSymTab                                   
V8Spider:
   crypto                                         87.4193+-0.2684     ?     87.8282+-0.2366        ?
   deltablue                                     132.0028+-0.4315     ?    132.2209+-0.8015        ?
   earley-boyer                                   84.0875+-0.4977           83.3908+-0.3244        
   raytrace                                       62.1315+-0.2003     ?     62.4411+-0.2595        ?
   regexp                                        102.8483+-0.7213          102.5691+-0.6543        
   richards                                      118.9806+-0.6528     ?    119.8726+-0.5321        ?
   splay                                          49.1056+-0.3912           48.9985+-0.2025        

   <arithmetic>                                   90.9394+-0.1446     ?     91.0459+-0.2269        ? might be 1.0012x slower
   <geometric> *                                  86.4951+-0.1148     ?     86.5646+-0.1915        ? might be 1.0008x slower
   <harmonic>                                     81.8715+-0.1351     ?     81.9102+-0.1678        ? might be 1.0005x slower

                                                     TipOfTree                LockedSymTab                                   
Octane and V8v7:
   encrypt                                        0.47012+-0.00122    ?     0.47013+-0.00098       ?
   decrypt                                        8.70860+-0.02957          8.68786+-0.02463       
   deltablue                             x2       0.61039+-0.00436          0.60705+-0.00092       
   earley                                         0.91475+-0.00305    ?     0.91992+-0.01022       ?
   boyer                                         12.85130+-0.04347    ?    12.85830+-0.04491       ?
   raytrace                              x2       4.42646+-0.00697    ?     4.43799+-0.00919       ?
   regexp                                x2      32.50308+-0.18186    ?    32.82752+-0.19594       ?
   richards                              x2       0.30974+-0.00053          0.30908+-0.00072       
   splay                                 x2       0.66233+-0.03966          0.66164+-0.03646       
   navier-stokes                         x2      10.83210+-0.03376         10.80770+-0.02305       
   closure                                        0.30775+-0.03515    ?     0.30954+-0.03500       ?
   jquery                                         4.42657+-0.55281    ?     4.42716+-0.54569       ?
   gbemu                                 x2     251.55537+-17.48037       251.45155+-17.33567      
   box2d                                 x2      31.71124+-0.11451    ?    31.71913+-0.08318       ?

V8v7:
   <arithmetic>                                   7.60206+-0.02771    ?     7.63989+-0.02754       ? might be 1.0050x slower
   <geometric> *                                  2.46183+-0.01854    ?     2.46305+-0.01721       ? might be 1.0005x slower
   <harmonic>                                     0.94767+-0.00964          0.94625+-0.00881         might be 1.0015x faster

Octane including V8v7:
   <arithmetic>                                  31.49548+-1.59774    ?    31.51437+-1.58646       ? might be 1.0006x slower
   <geometric> *                                  4.41154+-0.06019    ?     4.41442+-0.05873       ? might be 1.0007x slower
   <harmonic>                                     1.07220+-0.01789          1.07200+-0.01732         might be 1.0002x faster

                                                     TipOfTree                LockedSymTab                                   
Kraken:
   ai-astar                                       493.343+-0.742      ?     494.385+-1.354         ?
   audio-beat-detection                           245.441+-0.939            244.624+-1.173         
   audio-dft                                      323.669+-1.803            323.412+-2.170         
   audio-fft                                      143.650+-0.405            143.629+-0.387         
   audio-oscillator                               234.800+-0.983      ?     235.006+-1.184         ?
   imaging-darkroom                               294.261+-1.558            292.652+-1.150         
   imaging-desaturate                             160.446+-0.280      ?     160.465+-0.479         ?
   imaging-gaussian-blur                          397.865+-0.406      !     399.320+-0.900         ! definitely 1.0037x slower
   json-parse-financial                            80.970+-0.222             80.818+-0.159         
   json-stringify-tinderbox                       101.720+-0.414            101.709+-0.316         
   stanford-crypto-aes                            238.505+-1.177            236.723+-1.854         
   stanford-crypto-ccm                            110.943+-0.344      ?     111.361+-0.210         ?
   stanford-crypto-pbkdf2                         274.398+-1.227      ?     276.021+-1.161         ?
   stanford-crypto-sha256-iterative               115.787+-0.181      !     116.302+-0.271         ! definitely 1.0044x slower

   <arithmetic> *                                 229.700+-0.245      ?     229.745+-0.426         ? might be 1.0002x slower
   <geometric>                                    200.687+-0.215      ?     200.710+-0.352         ? might be 1.0001x slower
   <harmonic>                                     174.507+-0.186      ?     174.550+-0.265         ? might be 1.0002x slower

                                                     TipOfTree                LockedSymTab                                   
JSRegress:
   adapt-to-double-divide                         22.6772+-0.1209           22.5509+-0.1286        
   aliased-arguments-getbyval                      0.9256+-0.0106            0.9221+-0.0097        
   allocate-big-object                             2.5439+-0.0353     ?      2.5527+-0.0388        ?
   arity-mismatch-inlining                         0.7839+-0.0128            0.7770+-0.0156        
   array-access-polymorphic-structure              7.1247+-0.1087            7.0338+-0.1338          might be 1.0129x faster
   array-with-double-add                           5.8482+-0.0954     ?      5.8645+-0.0584        ?
   array-with-double-increment                     4.2005+-0.0894            4.1053+-0.0103          might be 1.0232x faster
   array-with-double-mul-add                       7.0661+-0.0948     ?      7.1388+-0.0993        ? might be 1.0103x slower
   array-with-double-sum                           7.9927+-0.0909            7.8818+-0.1171          might be 1.0141x faster
   array-with-int32-add-sub                       10.5986+-0.1282           10.4619+-0.1108          might be 1.0131x faster
   array-with-int32-or-double-sum                  8.1077+-0.0851            8.0732+-0.0899        
   big-int-mul                                     4.9740+-0.0615     ?      4.9908+-0.0487        ?
   boolean-test                                    4.4304+-0.0610     ?      4.4344+-0.0619        ?
   cast-int-to-double                             14.0254+-0.1403     ?     14.0896+-0.1509        ?
   cell-argument                                  14.5879+-0.1147           14.4835+-0.0913        
   cfg-simplify                                    4.0328+-0.0845            4.0114+-0.0317        
   cmpeq-obj-to-obj-other                         11.5532+-0.1712     ^     11.0827+-0.1869        ^ definitely 1.0425x faster
   constant-test                                   8.5107+-0.1471     ?      8.5506+-0.1349        ?
   direct-arguments-getbyval                       0.8496+-0.0109     ?      0.8500+-0.0094        ?
   double-pollution-getbyval                      10.7973+-0.1073     ?     10.8190+-0.1513        ?
   double-pollution-putbyoffset                    5.0945+-0.0896            5.0583+-0.0340        
   empty-string-plus-int                          11.0503+-0.2076     ?     11.0643+-0.2151        ?
   external-arguments-getbyval                     2.2301+-0.0334     ?      2.2312+-0.0322        ?
   external-arguments-putbyval                     3.2857+-0.0201     ?      3.3349+-0.0764        ? might be 1.0150x slower
   Float32Array-matrix-mult                       14.6364+-0.1432     ^     14.3423+-0.1131        ^ definitely 1.0205x faster
   fold-double-to-int                             22.3196+-0.2973           22.1905+-0.2795        
   function-dot-apply                              3.1942+-0.0105     ?      3.1969+-0.0082        ?
   function-test                                   5.0442+-0.0747     ?      5.0656+-0.0415        ?
   get-by-id-chain-from-try-block                  7.4422+-0.0989            7.3854+-0.0906        
   HashMap-put-get-iterate-keys                   96.5506+-1.2191     ?     97.1141+-0.6602        ?
   HashMap-put-get-iterate                        98.4338+-0.7239     ?     99.0688+-0.8952        ?
   HashMap-string-put-get-iterate                 73.8042+-0.3793     ?     74.4451+-0.8219        ?
   indexed-properties-in-objects                   4.5787+-0.0689     ?      4.5916+-0.0189        ?
   inline-arguments-access                         1.2662+-0.0079            1.2643+-0.0074        
   inline-arguments-local-escape                  23.3145+-0.1568     ?     23.4913+-0.1096        ?
   inline-get-scoped-var                           6.5831+-0.1067     ?      6.6033+-0.1011        ?
   inlined-put-by-id-transition                   16.7702+-0.2042           16.4514+-0.1639          might be 1.0194x faster
   int-or-other-abs-then-get-by-val                8.9707+-0.0925            8.8569+-0.1044          might be 1.0129x faster
   int-or-other-abs-zero-then-get-by-val          37.2793+-0.1553     ?     37.9880+-0.9653        ? might be 1.0190x slower
   int-or-other-add-then-get-by-val               10.3761+-0.1206           10.2648+-0.1026          might be 1.0108x faster
   int-or-other-add                               10.5281+-0.1058     ?     10.5379+-0.1308        ?
   int-or-other-div-then-get-by-val                8.0005+-0.0959     ?      8.0417+-0.1075        ?
   int-or-other-max-then-get-by-val               10.0047+-0.2603     ?     10.1012+-0.1366        ?
   int-or-other-min-then-get-by-val                8.2734+-0.1158            8.1754+-0.0921          might be 1.0120x faster
   int-or-other-mod-then-get-by-val                8.1264+-0.0845            8.0642+-0.0857        
   int-or-other-mul-then-get-by-val                7.2610+-0.0979     ?      7.2645+-0.0973        ?
   int-or-other-neg-then-get-by-val                8.1614+-0.1402            8.0649+-0.0891          might be 1.0120x faster
   int-or-other-neg-zero-then-get-by-val          36.5605+-0.2255           36.5384+-0.1223        
   int-or-other-sub-then-get-by-val               10.2852+-0.1406     ?     10.3753+-0.1161        ?
   int-or-other-sub                                8.3548+-0.0704            8.2582+-0.1099          might be 1.0117x faster
   int-overflow-local                             12.9406+-0.0864     ?     13.0106+-0.0855        ?
   Int16Array-bubble-sort                         49.5605+-0.1955           49.5395+-0.1528        
   Int16Array-load-int-mul                         1.8958+-0.0062     ?      1.9040+-0.0081        ?
   Int8Array-load                                  4.8306+-0.0633     ?      4.8629+-0.0594        ?
   integer-divide                                 15.2532+-0.1342           15.1747+-0.1242        
   integer-modulo                                  2.1141+-0.0159            2.1138+-0.0158        
   make-indexed-storage                            3.9144+-0.0368            3.9099+-0.0372        
   method-on-number                               23.7926+-0.2728     ?     24.0895+-0.3485        ? might be 1.0125x slower
   nested-function-parsing-random                382.1898+-13.2124         381.5689+-13.1304       
   nested-function-parsing                        47.7541+-1.1281     ?     47.8574+-1.0886        ?
   new-array-buffer-dead                           3.6334+-0.0120     ?      3.6366+-0.0114        ?
   new-array-buffer-push                          10.5347+-0.1709     ?     10.6120+-0.1056        ?
   new-array-dead                                 28.3748+-0.1203           28.3088+-0.0863        
   new-array-push                                  7.0678+-0.1366            7.0317+-0.1022        
   number-test                                     4.3368+-0.0582     ?      4.3399+-0.0536        ?
   object-closure-call                             8.3207+-0.0937     ?      8.4598+-0.1156        ? might be 1.0167x slower
   object-test                                     4.8699+-0.0864     ?      4.9424+-0.0532        ? might be 1.0149x slower
   poly-stricteq                                  90.9276+-0.1412     !     92.0319+-0.8518        ! definitely 1.0121x slower
   polymorphic-structure                          20.1326+-0.0886     ?     20.1810+-0.1050        ?
   polyvariant-monomorphic-get-by-id              12.6289+-0.0950           12.6071+-0.1238        
   rare-osr-exit-on-local                         20.8056+-0.1292           20.7675+-0.1310        
   register-pressure-from-osr                     31.6120+-0.1071     ?     31.7152+-0.1346        ?
   simple-activation-demo                         34.5070+-0.1194     ?     34.5641+-0.1351        ?
   slow-array-profile-convergence                  4.3345+-0.0165            4.3195+-0.0142        
   slow-convergence                                3.8316+-0.0110            3.8230+-0.0098        
   sparse-conditional                              1.3315+-0.0174     ?      1.3420+-0.0094        ?
   splice-to-remove                               50.4484+-0.2022     ?     51.0209+-0.5762        ? might be 1.0113x slower
   string-concat-object                            2.7388+-0.0412     ?      2.7569+-0.0337        ?
   string-concat-pair-object                       2.6782+-0.0143     !      2.7395+-0.0464        ! definitely 1.0229x slower
   string-concat-pair-simple                      17.3284+-0.2873           17.2926+-0.1884        
   string-concat-simple                           17.3269+-0.2673           17.3249+-0.2672        
   string-cons-repeat                             10.1490+-0.0308     ?     10.1797+-0.0453        ?
   string-cons-tower                              10.9721+-0.0344     ?     11.0561+-0.0840        ?
   string-equality                               106.0078+-1.1518     ?    106.4500+-1.6264        ?
   string-hash                                     2.6662+-0.0089     ?      2.6750+-0.0100        ?
   string-repeat-arith                            47.0378+-0.2420     ?     47.3012+-0.3184        ?
   string-sub                                     90.0675+-0.4973           89.6221+-0.6720        
   string-test                                     4.3258+-0.0472            4.2769+-0.0302          might be 1.0114x faster
   structure-hoist-over-transitions                3.2836+-0.0259     ?      3.3721+-0.1236        ? might be 1.0270x slower
   tear-off-arguments-simple                       1.7930+-0.0112     ?      1.8036+-0.0132        ?
   tear-off-arguments                              3.4020+-0.0108     ?      3.4037+-0.0088        ?
   temporal-structure                             20.9846+-0.1256     ?     21.1803+-0.4286        ?
   to-int32-boolean                               30.7233+-0.1404           30.7000+-0.1225        
   undefined-test                                  4.5769+-0.0413     ?      4.5834+-0.0371        ?

   <arithmetic>                                   21.0363+-0.1585     ?     21.0698+-0.1436        ? might be 1.0016x slower
   <geometric> *                                   9.4827+-0.0265     ?      9.4852+-0.0225        ? might be 1.0003x slower
   <harmonic>                                      5.2306+-0.0181     ?      5.2325+-0.0156        ? might be 1.0003x slower

                                                     TipOfTree                LockedSymTab                                   
All benchmarks:
   <arithmetic>                                   41.2868+-0.3174     ?     41.3164+-0.3178        ? might be 1.0007x slower
   <geometric>                                    11.4830+-0.0498     ?     11.4841+-0.0493        ? might be 1.0001x slower
   <harmonic>                                      3.7309+-0.0326            3.7305+-0.0312          might be 1.0001x faster

                                                     TipOfTree                LockedSymTab                                   
Geomean of preferred means:
   <scaled-result>                                23.1283+-0.1145     ?     23.1351+-0.1191        ? might be 1.0003x slower
Comment 13 Geoffrey Garen 2013-04-27 15:21:58 PDT
The SymbolTable itself -- excluding Watchpoints -- is immutable after byte-compilation. It must be so in order to maintain lots of different invariants held by arguments objects, closures, and compiled code. It feels a little strange to go out of our way to make mutation thread-safe when it's not safe at all.

Can take advantage of this by ASSERTing that mutation doesn't happen, instead of adding guards for thread-safe mutation?
Comment 14 Filip Pizlo 2013-04-27 15:28:13 PDT
(In reply to comment #13)
> The SymbolTable itself -- excluding Watchpoints -- is immutable after byte-compilation. It must be so in order to maintain lots of different invariants held by arguments objects, closures, and compiled code. It feels a little strange to go out of our way to make mutation thread-safe when it's not safe at all.

Really?  What about a second script tag?

> 
> Can take advantage of this by ASSERTing that mutation doesn't happen, instead of adding guards for thread-safe mutation?
Comment 15 Geoffrey Garen 2013-04-27 15:38:43 PDT
Oops! I forgot about the global object's symbol table. That is mutable.
Comment 16 Geoffrey Garen 2013-04-27 15:48:34 PDT
Comment on attachment 199897 [details]
the patch

r=me
Comment 17 Filip Pizlo 2013-04-27 16:13:55 PDT
Landed in http://trac.webkit.org/changeset/149248