From 8ef5ae5fb2990876e5706239fbd168d51cc9bf4a Mon Sep 17 00:00:00 2001 From: Dale Henrichs Date: Fri, 18 Aug 2023 11:33:48 -0700 Subject: [PATCH] issue #331: initial implementation of enableIsNilOptimination for GsDevKit stones --- bin/bootstrapGLASS | 21 ++++++++++ bin/createStone | 19 ++++++++- bin/private/disableIsNilOptimization.tpz | 52 ++++++++++++++++++++++++ bin/upgradeStone | 20 +++++++-- tests/seaside3Install.sh | 2 +- 5 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 bin/private/disableIsNilOptimization.tpz diff --git a/bin/bootstrapGLASS b/bin/bootstrapGLASS index ed262fda..d0d451b7 100755 --- a/bin/bootstrapGLASS +++ b/bin/bootstrapGLASS @@ -17,6 +17,12 @@ Bootstrap GLASS into an extent0.dbf. OPTIONS -h display help + -E + enable isNil optimization (leave enabled). upgradeImage enables isNil + optimization by default but, there are potential problems with isNil + optimization in some Seaside projects, upgradeSeasideImage disables + isNil optimiazation unless this options is specified. See + https://github.com/GsDevKit/GsDevKit_home/issues/331 for more information EXAMPLES $(basename $0) -h @@ -33,6 +39,15 @@ source ${GS_HOME}/bin/defGsDevKit.env source ${GS_HOME}/bin/private/shFunctions getOpts_help $@ +enableIsNilOptimization="false" +while getopts "E" OPT ; do + case "$OPT" in + E) enableIsNilOptimization="true";; + *) usage; exit_1_banner "Uknown option";; + esac +done +shift $(($OPTIND - 1)) + if [ $# -ne 1 ]; then usage; exit_1_banner "wrong number of arguments (1 expected)" fi @@ -62,6 +77,12 @@ $GS_HOME/bin/startTopaz $stoneName -l << EOF input $GS_HOME/bin/private/prepareBootstrapGLASS.tpz EOF +if [ "enableIsNilOptimization" = "false" ]; then +$GS_HOME/bin/startTopaz $stoneName -l << EOF +input $GS_HOME/bin/private/disableIsNilOptimization.tpz +EOF +fi + $GS_HOME/bin/startTopaz $stoneName -l << EOF input $GS_HOME/bin/private/bootstrapGLASS.tpz EOF diff --git a/bin/createStone b/bin/createStone index 5c74b451..fd52cba9 100755 --- a/bin/createStone +++ b/bin/createStone @@ -32,6 +32,13 @@ as the default . OPTIONS -h display help + -E + 3.7.0 ONLY. Only has an effect when used with the -b option. + Enable isNil optimization (leave enabled). upgradeImage enables isNil + optimization by default but, there are potential problems with isNil + optimization in some Seaside projects, upgradeSeasideImage disables + isNil optimiazation unless this options is specified. See + https://github.com/GsDevKit/GsDevKit_home/issues/331 for more information. -f Force creation of new stone, by deleting \$GS_SERVER/stones/ directory if it exists @@ -108,6 +115,7 @@ EXAMPLES $(basename $0) -c -z \$GS_HOME/sys/local/server/templates/myStoneConfig.ston gs_329 3.2.9 $(basename $0) -BG -z \$GS_HOME/sys/local/server/templates/myStoneConfig.ston gs_340 3.4.0 $(basename $0) -BGC -z \$GS_HOME/sys/local/server/templates/myStoneConfig.ston gs_340 3.4.0 + $(basename $0) -b -E -U bozo gs_370 3.7.0 $(basename $0) -b -U bozo gs_329 3.2.9 $(basename $0) -b -U bozo -P theClown gs_329 3.2.9 @@ -144,7 +152,8 @@ bootstrapGLASS="false" defaultExtentName="extent0.seaside.dbf" defaultGemstoneUserId="DataCurator" gemstonePassword="swordfish" -while getopts "fghns:t:u:i:l:z:cBCGU:P:b" OPT ; do +enableIsNilOptimizationArg="" +while getopts "fghns:t:u:i:l:z:cBCEGU:P:b" OPT ; do case "$OPT" in h) usage; exit 0;; f) force="true";; @@ -163,6 +172,7 @@ while getopts "fghns:t:u:i:l:z:cBCGU:P:b" OPT ; do b) bootstrapGLASS="true"; defaultExtentName="extent0.dbf" ;; U) gemstoneUserId="${OPTARG}";; P) gemstonePassword="${OPTARG}";; + E) enableIsNilOptimizationArg="-E";; *) usage; exit_1_banner "Uknown option";; esac done @@ -215,7 +225,12 @@ fi if [ "$installTode" = "true" ] ; then if [ "$bootstrapGLASS" = "true" ] ; then - "$GS_HOME/bin/bootstrapGLASS" $stoneName + majorMinorVersion="${vers:0:3}" + if [ "$majorMinorVersion" = "3.7" ] ; then + # ignore enableIsNilOptimizationArg for versions other than 3.7.x + enableIsNilOptimizationArg="" + fi + "$GS_HOME/bin/bootstrapGLASS" $enableIsNilOptimizationArg $stoneName fi "$GS_SYS/bin/todeLoad" $stoneName else diff --git a/bin/private/disableIsNilOptimization.tpz b/bin/private/disableIsNilOptimization.tpz new file mode 100644 index 00000000..8364ac27 --- /dev/null +++ b/bin/private/disableIsNilOptimization.tpz @@ -0,0 +1,52 @@ +#========================================================================= +# Copyright (c) 2023 GemTalk Systems, LLC . +# +# MIT license: https://github.com/GsDevKit/GsDevKit_home/blob/master/license.txt +#========================================================================= + +# Disable isNil optimization in a 3.7.0 or greater image +# ( see https://github.com/GsDevKit/GsDevKit_upgrade/issues/30) + +! run with topaz -l -T50000 or larger + +level 1 +iferr 1 stk +iferr 2 stack +iferr 3 exit 1 + +set user SystemUser pass swordfish +login +category: 'Private' +classmethod: GsNMethod +_adjustOptimizedSelectors + OptimizedSelectors := #( notNil yourself ). +% + +run +| x | +GsNMethod _adjustOptimizedSelectors . +(x := GsNMethod configurableOptimizedSelectors) = #( notNil yourself ) +ifFalse:[ Error signal: 'wrong value ', x printString ]. +true +% +commit +logout +login +run + "recompile methods that contain an isNil selector pattern ... to ensure method is not optimized" + | cnt | + cnt := 0 . + ((ClassOrganizer new substringSearch: 'isNil') at: 1) do:[:meth | + meth recompileFromSource . + GsFile gciLogServer:'recompiled ' , meth printString . + cnt := cnt + 1 . + ]. + ^ cnt +% +commit + +errorCount + +logout + +exit 0 diff --git a/bin/upgradeStone b/bin/upgradeStone index 31537b48..e4bc816a 100755 --- a/bin/upgradeStone +++ b/bin/upgradeStone @@ -23,6 +23,13 @@ OPTIONS -f Force creation of new stone by deleting \$GS_HOME/gemstone/stone/ directory if it exists + -E + Upgrades to 3.7.z and above. + Enable isNil optimization (leave enabled). upgradeImage enables isNil + optimization by default but, there are potential problems with isNil + optimization in some Seaside projects, upgradeSeasideImage disables + isNil optimiazation unless this options is specified. See + https://github.com/GsDevKit/GsDevKit_home/issues/331 for more information. -g Do not install tODE in upgraded stone. Allow for upgrading a stone that does not have tODE installed in the original stone and that should not @@ -53,7 +60,9 @@ EXAMPLES $(basename $0) -h $(basename $0) -l /home/loadMyApplication gs_3106 gs_329 3.2.9 $(basename $0) -U bozo -P theClown gs_3106 gs_329 3.2.9 - $(basename $0) gs_3106 gs_329 3.2.9 + $(basename $0) -E gs_366 gs_370 3.7.0 + $(basename $0) gs_345 gs_355 3.5.5 + $(basename $0) gs_366 gs_370 3.7.0 HELP } @@ -80,7 +89,8 @@ gemstoneUserId="DataCurator" gemstonePassword="swordfish" topazWaitForDebug="" skipInstallTode="false" -while getopts "cfhl:s:um:U:P:Wg" OPT ; do +enableIsNilOptimizationArg="" +while getopts "cfhl:s:um:U:EP:Wg" OPT ; do case "$OPT" in h) usage; exit 0;; c) runUpgrade="false";; @@ -96,6 +106,7 @@ while getopts "cfhl:s:um:U:P:Wg" OPT ; do U) gemstoneUserId="${OPTARG}";; P) gemstonePassword="${OPTARG}";; W) topazWaitForDebug=" -W ";; + E) enableIsNilOptimizationArg="-E";; *) usage; exit_1_banner "Uknown option";; esac done @@ -252,9 +263,12 @@ EOF 3.5.*) remoteDebugFlag="";; # remote debugging flag is not available in 3.5.x *) remoteDebugFlag="$topazWaitForDebug" ;; esac + case "$gsvers" in + 3.5.*|3.6.*) enableIsNilOptimizationFlag="";; # enable isNil optimization flag not available in 3.5.x and 3.6.x + *) enableIsNilOptimizationFlag="$enableIsNilOptimizationArg" set +e upgradeScript=$GEMSTONE/upgrade/createGsDevKit_upgrade.topaz - "$GEMSTONE/seaside/bin/upgradeSeasideImage" -c $tempObjCacheSize -s $targetStoneName -u $gemstoneUserId -p $gemstonePassword -P $upgradeScript $remoteDebugFlag 2>&1 << EOF + "$GEMSTONE/seaside/bin/upgradeSeasideImage" -c $tempObjCacheSize -s $targetStoneName -u $gemstoneUserId -p $gemstonePassword -P $upgradeScript $remoteDebugFlag $enableIsNilOptimizationFlag 2>&1 << EOF EOF status=$? diff --git a/tests/seaside3Install.sh b/tests/seaside3Install.sh index 95505821..dbb446e4 100755 --- a/tests/seaside3Install.sh +++ b/tests/seaside3Install.sh @@ -30,7 +30,7 @@ set +e # we want to ensure that we kill the chrome driver in the event of a test project install --url=http://gsdevkit.github.io/GsDevKit_home/Seaside32.ston project load --loads=\`#('CI')\` Seaside3 test --batch project Seaside3 -eval \`[ (self hasErrors or: [ self unexpectedFailures size > 0 ]) ifTrue: [ self error: 'Tests FAILED' ] ifFalse: [ 'Tests PASSED' ] ] on: Warning do: [ :ex | ex resume: true ]\` +eval \`[ (self hasErrors or: [ self unexpectedFailures size > 0 or: [ (self unexpectedPasses reject: [ :each | each class = WAWebDriverFunctionalTestCase and: [ each selector = #'testCORSFilterFunctionalTest' ] ]) size > 0 ] ]) ifTrue: [ self error: 'Tests failed' ] ifFalse: [ 'Tests PASSED' ] ] on: Warning do: [ :ex | ex resume: true ]\` EOF status=$?