Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't store temporary pointers in JSValues #5740

Merged
merged 34 commits into from
Nov 1, 2023

Conversation

eddyashton
Copy link
Member

Follow-up to #5717 (reverting that interim fix), resolving #5718.

The general pattern is that we avoid storing temporary things in the Opaque of a JSValue. Instead we store them at the top in the js::Context, flush them when we complete execution, and rehydrate/redirect when new calls come in on JSValues that app code has stashed in the interpreter (this storage pattern should be no worse for lookup, is much easier for cleanup, and lets us memoise some KV-handle lookups).

@eddyashton eddyashton requested a review from a team October 17, 2023 17:00
@ghost
Copy link

ghost commented Oct 17, 2023

js_interp_lazy_kv_handles@78206 aka 20231101.7 vs main ewma over 20 builds from 77722 to 78196

Click to see table

main

build_id build_number pi_basic_mt_sgx_cft^ pi_basic_mt_sgx_cft_mem Commit latency factor tpcc_sgx_cft^ tpcc_sgx_cft_mem pi_basic_mt_virtual_cft^ tpcc_virtual_cft^ ls_virtual_cft^ pi_ls_virtual_cft^ ls_sgx_cft^ ls_sgx_cft_mem pi_basic_virtual_cft^ pi_ls_sgx_cft^ pi_ls_sgx_cft_mem pi_basic_sgx_cft^ pi_basic_sgx_cft_mem pi_basic_js_virtual_cft^ ls_jwt_virtual_cft^ pi_ls_jwt_virtual_cft^ ls_js_virtual_cft^ ls_full_js_virtual_cft^ pi_basic_js_sgx_cft^ pi_basic_js_sgx_cft_mem ls_js_jwt_virtual_cft^ ls_jwt_sgx_cft^ ls_jwt_sgx_cft_mem pi_ls_jwt_sgx_cft^ pi_ls_jwt_sgx_cft_mem ls_js_sgx_cft^ ls_js_sgx_cft_mem ls_full_js_sgx_cft^ ls_full_js_sgx_cft_mem hist_sgx_cft^ ls_js_jwt_sgx_cft^ ls_js_jwt_sgx_cft_mem RB put (/s)^ CHAMP put (/s)^ RB get (/s)^ CHAMP get (/s)^
77722 20231024.29 28002.9 2.51822e+07 0.808583 5477.83 8.59996e+07 68825.6 17482.9 43910 47389.3 13980.7 1.88908e+07 55105.8 14011.7 1.05021e+07 15103.3 1.46964e+07 4422.3 16897.2 19100.4 17082.1 15051.5 1409.7 1.25993e+07 9901.25 6842.46 1.88908e+07 6811.8 6.30784e+06 5772.89 1.67936e+07 5489.45 1.67936e+07 43837.6 4013.18 1.67936e+07 824014 1.17985e+06 8.16421e+06 3.03628e+07
77856 20231025.44 27880.1 2.30851e+07 0.830072 5666.89 8.59996e+07 84849.8 17303.7 45783 47925.3 14118.2 1.88908e+07 54083.6 14176.7 1.05021e+07 15508.7 1.46964e+07 4428.6 17130.6 18998.8 17531.7 14906.9 1425.1 1.25993e+07 9965.7 7259.6 1.67936e+07 6931.4 6.30784e+06 5816.26 1.67936e+07 5714.88 1.67936e+07 44821 3996.87 1.67936e+07 832615 1.17692e+06 8.17447e+06 3.1229e+07
77900 20231025.59 27968.9 2.30851e+07 0.816541 5546.67 8.59996e+07 81852.5 17281.4 45862.6 47692.2 13948.6 1.88908e+07 54378.7 14105.4 1.05021e+07 15469.3 1.46964e+07 4430.3 17128.6 18994.4 17211.3 14724.7 1430.1 1.25993e+07 9880.77 6806.65 1.88908e+07 6880.7 6.30784e+06 5770.88 1.67936e+07 5488.27 1.88908e+07 42489.7 3990.38 1.67936e+07 839143 1.18218e+06 8.15475e+06 3.09642e+07
77909 20231025.62 27790.9 2.30851e+07 0.79592 5576.25 8.59996e+07 82618.8 17614.6 45746.3 48128.1 13953.5 1.88908e+07 53844.8 13887.2 1.05021e+07 15385.2 1.25993e+07 4388 17161.3 19081.4 17522.5 14627.1 1410.9 1.25993e+07 10342.4 6741.99 1.88908e+07 6827.9 6.30784e+06 5792.34 1.67936e+07 5446.53 1.67936e+07 43740.4 3975.81 1.67936e+07 830943 1.17967e+06 8.14732e+06 3.07715e+07
77921 20231026.3 27942.2 2.30851e+07 0.791384 5619.54 8.80968e+07 72066.7 17373 45699.4 48314.8 14116.6 1.88908e+07 54188.2 14237.9 1.05021e+07 15679.6 1.25993e+07 4351.5 17286.9 19246.7 17012.1 14641.1 1439.5 1.25993e+07 10204.5 6842.16 1.67936e+07 7086.5 6.30784e+06 5774.21 1.67936e+07 5775.45 1.67936e+07 44491.1 3999.2 1.67936e+07 835419 1.1779e+06 8.15017e+06 3.23452e+07
77958 20231026.14 27891.3 2.30851e+07 0.772274 5566.37 8.59996e+07 68096.1 17260.9 45673.6 48273.7 14074.9 1.88908e+07 54086 14198.3 1.05021e+07 15598.1 1.46964e+07 4383.2 17108.5 19101.5 17286.3 14984.8 1432.2 1.25993e+07 10377.2 6840.93 1.67936e+07 6965.9 6.30784e+06 5777.94 1.67936e+07 5783.74 1.67936e+07 43732 3984.61 1.67936e+07 834153 1.18014e+06 8.15037e+06 3.08165e+07
77980 20231026.23 27919.7 2.30851e+07 0.799401 5544.83 8.59996e+07 84229.4 17301.4 45630 47959.1 13945.1 1.88908e+07 54124.7 14005.8 1.05021e+07 15441 1.25993e+07 4420.8 17150.6 19602.5 17059.4 14690.5 1419.8 1.25993e+07 9850.2 7232.3 1.67936e+07 6917.8 6.30784e+06 5811.09 1.67936e+07 5487 1.67936e+07 42472.7 4003.14 1.67936e+07 827669 1.18001e+06 8.13674e+06 3.08104e+07
77994 20231026.29 27941.4 2.51822e+07 0.80113 5582.56 8.59996e+07 82095.1 17290 43873.2 47649.7 14017.2 1.88908e+07 54065 14167 1.05021e+07 15610.3 1.25993e+07 4441.8 17136.7 19419.7 17733.8 16838 1446 1.25993e+07 9840.75 6841.03 1.88908e+07 6962.5 6.30784e+06 5764.66 1.67936e+07 5729.26 1.67936e+07 44959.6 4003.36 1.67936e+07 840437 1.18274e+06 8.15494e+06 3.07517e+07
78007 20231026.34 27449.9 2.51822e+07 0.765143 5628.96 8.59996e+07 81427 17307 45407.5 47735 14025.1 1.88908e+07 54044.5 14089.7 1.05021e+07 15601.5 1.46964e+07 4441.4 17288.5 18904.7 17015.3 16872.1 1432.4 1.25993e+07 9816.73 6850.52 1.88908e+07 7096.8 6.30784e+06 5773.88 1.67936e+07 5486.07 1.67936e+07 43179.9 3985.52 1.67936e+07 826445 1.17834e+06 8.14738e+06 3.19605e+07
78033 20231027.4 28127.4 2.51822e+07 0.798824 5577.93 8.59996e+07 65638.2 17273 45862.4 48024.5 13972.7 1.88908e+07 53817.4 14096.8 1.05021e+07 15447.2 1.25993e+07 4439.6 17160.1 19602.8 17044.2 16883.5 1432.2 1.25993e+07 9854.32 7250.65 1.67936e+07 6938.4 6.30784e+06 5786.4 1.67936e+07 5743.72 1.67936e+07 42046.2 4002.74 1.67936e+07 829984 1.18448e+06 8.13813e+06 3.06775e+07
78035 20231027.5 27938.3 2.51822e+07 0.785967 5573.65 8.59996e+07 83501.4 17213.8 45970.2 48037.9 14007.5 1.88908e+07 54501.8 14114.5 1.05021e+07 15503.3 1.46964e+07 4447.9 17062.2 19333.8 16911.6 17015.7 1434.7 1.25993e+07 9990.67 6832.63 1.67936e+07 6983.9 6.30784e+06 5786.59 1.67936e+07 5775.4 1.67936e+07 47144 3982.36 1.67936e+07 831267 1.18066e+06 8.09742e+06 3.06715e+07
78049 20231027.10 28049.5 2.51822e+07 0.781085 5504.64 8.59996e+07 85552.5 17300.2 43575 46933.4 14023.9 1.88908e+07 55026 14102.3 1.05021e+07 15421.6 1.46964e+07 4431 17056.6 19111.7 17359 14869.3 1424.4 1.25993e+07 9805.16 6846.42 1.67936e+07 6826.6 6.30784e+06 5791.73 1.67936e+07 5707.49 1.67936e+07 41017.4 3980.86 1.67936e+07 840517 1.18098e+06 8.16672e+06 3.06803e+07
78065 20231030.3 27850.6 2.30851e+07 0.803529 5645.18 8.59996e+07 80986.2 17287.6 43811.1 46782.1 14038.5 1.88908e+07 54407.3 14125 1.05021e+07 15560.2 1.46964e+07 4392.3 17198.2 19724.6 17634.6 14791.7 1434 1.25993e+07 10345.8 7241.2 1.67936e+07 7023.9 6.30784e+06 5804.59 1.67936e+07 5779.74 1.67936e+07 38753.2 3998.35 1.67936e+07 831589 1.1757e+06 8.07743e+06 3.07175e+07
78110 20231031.2 28002.1 2.30851e+07 0.801968 5577.82 8.59996e+07 90290.4 17706.2 43757.1 47025.6 14078.8 1.88908e+07 54021.7 14211.9 1.05021e+07 15500.2 1.46964e+07 4412.2 17043.4 19501.2 17190 14923.3 1434.1 1.25993e+07 10161.5 7246.56 1.67936e+07 7122.3 6.30784e+06 5824.15 1.67936e+07 5724.41 1.67936e+07 44321.1 3999.43 1.67936e+07 833541 1.17964e+06 8.15397e+06 3.09702e+07
78115 20231031.5 28096.6 2.51822e+07 0.788781 5597.14 8.59996e+07 90398.6 17153.5 45717.6 47743.9 14046.4 1.88908e+07 55284.5 14149.3 1.05021e+07 15573.1 1.46964e+07 4374.5 17204.3 19257.8 17318.7 14893.2 1438.8 1.25993e+07 9790.65 6857.73 1.67936e+07 6984.1 6.30784e+06 5786.81 1.67936e+07 5770.07 1.67936e+07 44365.6 3994.27 1.67936e+07 818357 1.17717e+06 8.15176e+06 3.07813e+07
78128 20231031.10 27738.1 2.51822e+07 0.75716 5630.66 8.59996e+07 71982.3 17076.3 43862 47267.7 14058.5 1.88908e+07 55100.9 14160.9 1.05021e+07 15631.8 1.46964e+07 4371.6 17200.1 19235.2 17122 14762.1 1441.7 1.25993e+07 10396.2 7284.99 1.67936e+07 7044.7 6.30784e+06 5805.39 1.67936e+07 5776.39 1.67936e+07 42934.8 3998.07 1.67936e+07 837504 1.18196e+06 8.15251e+06 3.15981e+07
78146 20231031.17 27901 2.51822e+07 0.780638 5598.38 8.59996e+07 76464.7 17229.5 43813 47595.9 14060.8 1.88908e+07 55096.1 14179 1.05021e+07 15535.7 1.46964e+07 4355.7 17361 19744.5 17356.3 14955.7 1433.1 1.25993e+07 9799.34 6790.28 1.67936e+07 6889.6 6.30784e+06 5772.45 1.67936e+07 5488.66 1.67936e+07 43021.9 3966.05 1.67936e+07 820080 1.18077e+06 8.15047e+06 3.07762e+07
78161 20231031.23 28091.4 2.51822e+07 0.782488 5605.13 8.59996e+07 62893.4 17341.2 43725.6 47396.3 14058.7 1.88908e+07 54809.3 14092.9 1.05021e+07 15472.1 1.46964e+07 4373.5 17176.1 19492.8 17576.4 14802.5 1434.3 1.25993e+07 9795.27 6855.37 1.67936e+07 7006.3 6.30784e+06 5771.02 1.67936e+07 5735.27 1.67936e+07 46424.3 3972.38 1.67936e+07 831500 1.17237e+06 8.17199e+06 3.13663e+07
78188 20231031.34 27969.8 2.30851e+07 0.777414 5602.33 8.59996e+07 69302.6 17118.8 43790 47386.9 14059.1 1.88908e+07 54591.4 14173.3 1.05021e+07 15545.1 1.46964e+07 4355.1 17093.8 17419.8 17431.3 14898.7 1434.6 1.05021e+07 9859.67 7223.17 1.67936e+07 6938.2 6.30784e+06 5775.87 1.67936e+07 5491.97 1.67936e+07 39990.1 3979.22 1.67936e+07 830634 1.18149e+06 8.13241e+06 3.07346e+07
78196 20231101.2 28088.2 2.30851e+07 0.832989 5623.15 8.59996e+07 88490.7 17212.9 43839.1 47046.4 14070.4 1.88908e+07 50979.6 14239.9 1.05021e+07 15638 1.46964e+07 4393 17147.3 19277.1 17624.4 14959.6 1437.9 1.25993e+07 10005.4 6871.58 1.88908e+07 7054.3 6.30784e+06 5818.22 1.67936e+07 5735.09 1.67936e+07 44220.3 3977.77 1.67936e+07 834004 1.18027e+06 8.15222e+06 3.09693e+07

js_interp_lazy_kv_handles

build_id build_number Commit latency factor tpcc_sgx_cft^ tpcc_sgx_cft_mem tpcc_virtual_cft^ ls_sgx_cft^ ls_sgx_cft_mem pi_ls_sgx_cft^ pi_ls_sgx_cft_mem ls_virtual_cft^ pi_basic_sgx_cft^ pi_basic_sgx_cft_mem pi_ls_virtual_cft^ pi_basic_virtual_cft^ pi_basic_mt_sgx_cft^ pi_basic_mt_sgx_cft_mem pi_basic_js_virtual_cft^ ls_jwt_virtual_cft^ pi_ls_jwt_virtual_cft^ ls_jwt_sgx_cft^ ls_jwt_sgx_cft_mem ls_js_virtual_cft^ pi_ls_jwt_sgx_cft^ pi_ls_jwt_sgx_cft_mem ls_full_js_virtual_cft^ ls_js_jwt_virtual_cft^ ls_js_sgx_cft^ ls_js_sgx_cft_mem pi_basic_mt_virtual_cft^ ls_full_js_sgx_cft^ ls_full_js_sgx_cft_mem ls_js_jwt_sgx_cft^ ls_js_jwt_sgx_cft_mem hist_sgx_cft^ pi_basic_js_sgx_cft^ pi_basic_js_sgx_cft_mem RB put (/s)^ CHAMP put (/s)^ RB get (/s)^ CHAMP get (/s)^
78182 20231031.31 0.778837 5574.08 8.59996e+07 17248 14037.5 1.88908e+07 14084.1 1.05021e+07 43550.7 15618.1 1.46964e+07 45938.6 54819.8 28035.9 2.51822e+07 4396.5 17327.2 19206 6816.07 1.88908e+07 17393.3 7084.9 6.30784e+06 15055.3 9771.72 5765.24 1.67936e+07 65358.1 5444.06 1.67936e+07 3986.58 1.67936e+07 44763.8 1417.8 1.25993e+07 830674 1.18526e+06 8.15283e+06 3.08002e+07
78202 20231101.5 0.806031 5687.91 8.59996e+07 17238.4 13984.2 1.88908e+07 14171.4 1.05021e+07 41770.3 15664.4 1.25993e+07 45280 53619.7 27946.7 2.51822e+07 4291.5 17022.2 19446.9 7236.15 1.67936e+07 17391.5 6928.7 6.30784e+06 14840.7 10538.9 5774.52 1.67936e+07 71977.1 5731.4 1.88908e+07 3996.13 1.67936e+07 41734.1 1437.6 1.25993e+07 831838 1.18295e+06 8.14706e+06 3.06798e+07
78206 20231101.7 0.794467 5607.28 8.59996e+07 17705.9 14026.4 1.88908e+07 14094.4 1.05021e+07 43683.9 15595.2 1.46964e+07 46073.2 54683.6 28029.9 2.51822e+07 4347 17074.2 19351 7255.39 1.67936e+07 15028.2 6961.8 6.30784e+06 14925.5 10064.8 5795.05 1.67936e+07 87850.7 5455.05 1.67936e+07 3966.11 1.67936e+07 45779.7 1435.7 1.25993e+07 837337 1.18119e+06 8.15303e+06 3.07697e+07

images

@eddyashton eddyashton marked this pull request as draft October 18, 2023 08:33
@eddyashton eddyashton marked this pull request as ready for review October 19, 2023 16:09
src/js/historical.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
src/js/wrap.cpp Outdated Show resolved Hide resolved
@achamayou
Copy link
Member

@eddyashton can you poke the daily to get an ASAN run?

@achamayou achamayou merged commit 8f7afdb into microsoft:main Nov 1, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants