@@ -106,19 +106,40 @@ local worker = th.spawn(function()
106106 local write_traces = trace_count (32 )
107107 assert (write_traces > 0 )
108108
109+ jit .flush ()
110+ jit .opt .start (" hotloop=1" , " hotexit=1" , " -sink" )
111+
112+ local function table_next (n )
113+ local s = 0
114+ for i = 1 , n do
115+ local t = { only = i }
116+ local key , value = next (t , nil )
117+ assert (key == " only" )
118+ s = s + value
119+ end
120+ return s
121+ end
122+
123+ for _ = 1 , 20 do
124+ assert (table_next (80 ) == 3240 )
125+ end
126+ local next_traces = trace_count (32 )
127+ assert (next_traces > 0 )
128+
109129 return root_traces , side_traces , table_traces , read_traces , index_traces ,
110- write_traces , th .current ():id ()
130+ write_traces , next_traces , th .current ():id ()
111131end )
112132
113133local ok , root_traces , side_traces , table_traces , read_traces , index_traces ,
114- write_traces , tid = worker :join ()
115- assert (ok == true )
134+ write_traces , next_traces , tid = worker :join ()
135+ assert (ok == true , tostring ( root_traces ) )
116136assert (type (root_traces ) == " number" and root_traces > 0 )
117137assert (type (side_traces ) == " number" and side_traces > root_traces )
118138assert (type (table_traces ) == " number" and table_traces > 0 )
119139assert (type (read_traces ) == " number" and read_traces > 0 )
120140assert (type (index_traces ) == " number" and index_traces > 0 )
121141assert (type (write_traces ) == " number" and write_traces > 0 )
142+ assert (type (next_traces ) == " number" and next_traces > 0 )
122143assert (tid == worker :id ())
123144
124- print (" t-jit-secondary OK: secondary TG records, enters, side-traces, allocates tables, reads/writes shared tables, and preserves __index reads in x64 mcode" )
145+ print (" t-jit-secondary OK: secondary TG records, enters, side-traces, allocates tables, reads/writes shared tables, records trace-local next(), and preserves __index reads in x64 mcode" )
0 commit comments