Fix reset/shift and eval combination problem v2 #972
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
<<本件は、急いでマージする必用はありません。>>
#848 を更新したものです。
現状の HEAD に移植しました。
本件は、以下の問題を修正したものです。
どちらも、部分継続の終端マーカーのセットと、
Scm_VMDynamicWind() の継続フレーム追加との
競合によるものであり、
reset 実行時に継続フレームを一段追加することで対策しています。
ただ、今見ると、
vm.c の「Fix memory leak of the empty partial continuation.」のところが、
若干あやしいような気もします。
<補足情報>
この改造をしないで回避したい場合、
以下のように reset と eval/guard の間に何か命令をはさむとうまくいくことがあります。
ただ、ループにするとメモリリークするので、この方向で一般化はできないようです。
<テスト結果>
(1) Gauche-effects の effects.scm で、
*use-native-reset*
を #t にして、各サンプルを実行 ==> OK(2) 以下のメモリリークのテスト ==> OK
(出典 : http://okmij.org/ftp/continuations/against-callcc.html#memory-leak )
(これは (use gauche.partcont-meta) だとメモリリークします)
(3) Kahua の nqueen を実行 ==> OK
(4) https://practical-scheme.net/wiliki/wiliki.cgi?Gauche%3ABugs#H-2dgngv
の pcdemo10.scm を実行 ==> OK