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

fix: fit global_State redesign and harden string interning #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/lj-bucket-depth-accessed.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
global stats

probe process("$^libluajit_path").statement("*@lj_str.c:161") {
bucket = &$g->strhash[$h & $g->strmask]
bucket = &$g->str->tab[$h & $g->str->mask]
stats <<< luajit_bucket_depth(bucket)
//printf("depth = %d\n", depth)
//exit()
Expand Down
6 changes: 3 additions & 3 deletions samples/lj-gc-objs.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function process(L)
gcobjs[$*o->gch->gct] <<< size
}

strmask = $*g->strmask
strnum = $*g->strnum
strhash = $*g->strhash
strmask = $*g->str->mask
strnum = $*g->str->num
strhash = $*g->str->tab
$*strhash := @cast(strhash, "GCRef", "$^libluajit_path")

n = 0
Expand Down
6 changes: 3 additions & 3 deletions samples/lj-str-tab.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ function process(L)
g = luajit_G(L)
$*g := @cast(g, "global_State", "$^libluajit_path")

strmask = $*g->strmask
strnum = $*g->strnum
strmask = $*g->str->mask
strnum = $*g->str->num

printf("string count: %d\n", strnum)
printf("bucket count: %d\n", strmask + 1)
printf("load factor: %d%%\n\n", strnum * 100/(strmask + 1))

strhash = $*g->strhash
strhash = $*g->str->tab
$*strhash := @cast(strhash, "GCRef", "$^libluajit_path")

n = 0
Expand Down
6 changes: 3 additions & 3 deletions samples/luajit21-gc64/lj-gc-objs.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function process(L)
gcobjs[$*o->gch->gct] <<< size
}

strmask = $*g->strmask
strnum = $*g->strnum
strhash = $*g->strhash
strmask = $*g->str->mask
strnum = $*g->str->num
strhash = $*g->str->tab
$*strhash := @cast(strhash, "GCRef", "$^libluajit_path")

n = 0
Expand Down
8 changes: 4 additions & 4 deletions tapset/luajit.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $*pt := @cast(pt, "GCproto", "$^libluajit_path")
@define sizeof_SnapShot %( &@cast(0, "SnapShot", "$^libluajit_path")[1] %)
@define sizeof_SnapEntry %( &@cast(0, "SnapEntry", "$^libluajit_path")[1] %)
@define sizeof_K64Array %( &@cast(0, "K64Array", "$^libluajit_path")[1] %)
@define sizeof_ptr %( &@cast(0, "global_State", "$^libluajit_path")->strmask %)
@define sizeof_ptr %( &@cast(0, "global_State", "$^libluajit_path")->str->mask %)
@define sizeof_GCcdataVar %( &@cast(0, "GCcdataVar", "$^libluajit_path")[1] %)
@define sizeof_BCIns %( &@cast(0, "BCIns", "$^libluajit_path")[1] %)

Expand Down Expand Up @@ -771,9 +771,9 @@ function luajit_vm_state(g)
function luajit_find_gcstr(g, str)
{
len = strlen(str)
strmask = $*g->strmask
strnum = $*g->strnum
strhash = $*g->strhash
strmask = $*g->str->mask
strnum = $*g->str->num
strhash = $*g->str->tab
$*strhash := @cast(strhash, "GCRef", "$^libluajit_path")
ret = 0

Expand Down
8 changes: 4 additions & 4 deletions tapset/luajit_gc64.sxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $*pt := @cast(pt, "GCproto", "$^libluajit_path")
@define sizeof_SnapShot %( &@cast(0, "SnapShot", "$^libluajit_path")[1] %)
@define sizeof_SnapEntry %( &@cast(0, "SnapEntry", "$^libluajit_path")[1] %)
@define sizeof_K64Array %( &@cast(0, "K64Array", "$^libluajit_path")[1] %)
@define sizeof_ptr %( &@cast(0, "global_State", "$^libluajit_path")->strmask %)
@define sizeof_ptr %( &@cast(0, "global_State", "$^libluajit_path")->str->mask %)
@define sizeof_GCcdataVar %( &@cast(0, "GCcdataVar", "$^libluajit_path")[1] %)
@define sizeof_BCIns %( &@cast(0, "BCIns", "$^libluajit_path")[1] %)

Expand Down Expand Up @@ -787,9 +787,9 @@ function luajit_vm_state(g)
function luajit_find_gcstr(g, str)
{
len = strlen(str)
strmask = $*g->strmask
strnum = $*g->strnum
strhash = $*g->strhash
strmask = $*g->str->mask
strnum = $*g->str->num
strhash = $*g->str->tab
$*strhash := @cast(strhash, "GCRef", "$^libluajit_path")
ret = 0

Expand Down