-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
926e994
commit 9a5cf8d
Showing
10 changed files
with
83 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"indexstorage:gc/tick" | ||
"indexstorage:tick" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
#> indexstorage:gc/_index.d | ||
# @private | ||
|
||
#> score_holder | ||
# @within function indexstorage:gc/* | ||
#declare score_holder #LoopIndex | ||
#> GC main | ||
# @within function | ||
# indexstorage:tick | ||
# indexstorage:gc/main/loop | ||
#declare score_holder #GCIndex | ||
|
||
#> GC resize | ||
# @within function | ||
# indexstorage:tick | ||
# indexstorage:gc/resize/loop | ||
#declare score_holder #ResizeIndex |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#> indexstorage:gc/main/_index.d | ||
# @private | ||
|
||
#> score_holder | ||
# @within function | ||
# indexstorage:tick | ||
# indexstorage:gc/main/loop | ||
#declare score_holder #GCIndex |
4 changes: 2 additions & 2 deletions
4
...dexstorage/functions/gc/copy.m.mcfunction → ...orage/functions/gc/main/copy.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#> indexstorage:gc/copy.m | ||
#> indexstorage:gc/main/copy.m | ||
# @input args | ||
# id : int | ||
# @within function indexstorage:gc/loop | ||
# @within function indexstorage:gc/main/loop | ||
|
||
$data modify storage indexstorage:core m.name set from storage indexstorage: data[$(id)].UUIDString |
4 changes: 2 additions & 2 deletions
4
...dexstorage/functions/gc/exec.m.mcfunction → ...orage/functions/gc/main/exec.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#> indexstorage:gc/exec.m | ||
#> indexstorage:gc/main/exec.m | ||
# @input args | ||
# name : string | ||
# @within function indexstorage:gc/loop | ||
# @within function indexstorage:gc/main/loop | ||
|
||
$execute if score $(name) Ashen.IndexStorage.ID matches 0.. run return 0 | ||
function indexstorage:deprive/ with storage indexstorage:core m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#> indexstorage:gc/main/loop | ||
# @within function | ||
# indexstorage:tick | ||
# indexstorage:gc/main/loop | ||
|
||
# 1加える | ||
execute store result storage indexstorage:core m.id int 1 run scoreboard players add #GCIndex Ashen.IndexStorage.ID 1 | ||
execute if score #GCIndex Ashen.IndexStorage.ID > #StorageIDIndex Ashen.Global.Global run return 0 | ||
|
||
# 存在しなければ削除 | ||
function indexstorage:gc/main/copy.m with storage indexstorage:core m | ||
function indexstorage:gc/main/exec.m with storage indexstorage:core m | ||
|
||
# reset | ||
data remove storage indexstorage:core m | ||
|
||
# ループを入れる | ||
function indexstorage:gc/main/loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#> indexstorage:gc/resize/loop | ||
# @within function | ||
# indexstorage:tick | ||
# indexstorage:gc/resize/loop | ||
|
||
# 末尾を削除 | ||
data remove storage indexstorage: data[-1] | ||
# ループ | ||
scoreboard players remove #ResizeIndex Ashen.Global.Temporary 1 | ||
execute if score #ResizeIndex Ashen.Global.Temporary matches 1.. run function indexstorage:gc/resize/loop |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#> indexstorage:tick | ||
# @within tag/function ashen_lib:tick/ | ||
|
||
#> Val | ||
# @private | ||
#declare score_holder #CurrentTime | ||
#declare score_holder #LatestGC | ||
|
||
# 前回GCからの経過時間を取得 | ||
execute store result score #CurrentTime Ashen.Global.Temporary run data get storage global Time 1 | ||
execute store result score #LatestGC Ashen.Global.Temporary run data get storage indexstorage:core LatestGC 1 | ||
scoreboard players operation #LatestGC Ashen.Global.Temporary -= #CurrentTime Ashen.Global.Temporary | ||
scoreboard players operation #LatestGC Ashen.Global.Temporary *= #-1 Ashen.Global.Const | ||
|
||
# (#GCDuration)tick経過していたらgcループを発火 | ||
# 存在しないデータを削除 | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run scoreboard players set #GCIndex Ashen.IndexStorage.ID -1 | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run function indexstorage:gc/main/loop | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global store result storage indexstorage:core LatestGC int 1 run scoreboard players get #CurrentTime Ashen.Global.Temporary | ||
# 配列のリサイズ | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run scoreboard players operation #ResizeIndex Ashen.Global.Temporary = #StorageIDIndex Ashen.Global.Global | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run scoreboard players set #StorageIDIndex Ashen.Global.Global -1 | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run scoreboard players operation #StorageIDIndex Ashen.Global.Global > * Ashen.IndexStorage.ID | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global run scoreboard players operation #ResizeIndex Ashen.Global.Temporary -= #StorageIDIndex Ashen.Global.Global | ||
execute if score #LatestGC Ashen.Global.Temporary >= #GCInterval Ashen.Global.Global if score #ResizeIndex Ashen.Global.Temporary matches 1.. run function indexstorage:gc/resize/loop | ||
|
||
# リセット | ||
scoreboard players reset #CurrentTime Ashen.Global.Temporary | ||
scoreboard players reset #LatestGC Ashen.Global.Temporary | ||
scoreboard players reset #GCIndex Ashen.IndexStorage.ID | ||
scoreboard players reset #ResizeIndex Ashen.Global.Temporary |