Skip to content

Commit

Permalink
issue #331: initial implementation of enableIsNilOptimination for GsD…
Browse files Browse the repository at this point in the history
…evKit stones
  • Loading branch information
dalehenrich committed Aug 18, 2023
1 parent ff2e52b commit 8ef5ae5
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 6 deletions.
21 changes: 21 additions & 0 deletions bin/bootstrapGLASS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 17 additions & 2 deletions bin/createStone
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ as the default <gemstone-user-id>.
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/<stone-name> directory if it exists
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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";;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
52 changes: 52 additions & 0 deletions bin/private/disableIsNilOptimization.tpz
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#=========================================================================
# Copyright (c) 2023 GemTalk Systems, LLC <dhenrich@gemtalksystems.com>.
#
# 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
20 changes: 17 additions & 3 deletions bin/upgradeStone
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ OPTIONS
-f
Force creation of new stone by deleting
\$GS_HOME/gemstone/stone/<target-stone-name> 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
Expand Down Expand Up @@ -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
}
Expand All @@ -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";;
Expand All @@ -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
Expand Down Expand Up @@ -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=$?
Expand Down
2 changes: 1 addition & 1 deletion tests/seaside3Install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?

Expand Down

0 comments on commit 8ef5ae5

Please sign in to comment.