File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,8 @@ export class HDLModuleWASM implements HDLModuleRunner {
230230 stopped : boolean ;
231231 resetStartTimeMsec : number ;
232232
233+ _tick2 : ( ofs : number , iters : number ) => void ;
234+
233235 constructor ( moddef : HDLModuleDef , constpool : HDLModuleDef , maxMemoryMB ?: number ) {
234236 this . hdlmod = moddef ;
235237 this . constpool = constpool ;
@@ -243,12 +245,19 @@ export class HDLModuleWASM implements HDLModuleRunner {
243245 await this . genModule ( ) ;
244246 this . genStateInterface ( ) ;
245247 this . enableTracing ( ) ;
248+ this . cacheFunctions ( ) ;
246249 }
247250
248251 initSync ( ) {
249252 this . genModuleSync ( ) ;
250253 this . genStateInterface ( ) ;
251254 this . enableTracing ( ) ;
255+ this . cacheFunctions ( ) ;
256+ }
257+
258+ private cacheFunctions ( ) {
259+ // Cache the tick2 function for performance:
260+ this . _tick2 = ( this . instance . exports as any ) . tick2 ;
252261 }
253262
254263 powercycle ( ) {
@@ -281,7 +290,7 @@ export class HDLModuleWASM implements HDLModuleRunner {
281290 }
282291
283292 tick2 ( iters : number ) {
284- ( this . instance . exports as any ) . tick2 ( GLOBALOFS , iters ) ;
293+ this . _tick2 ( GLOBALOFS , iters ) ;
285294 }
286295
287296 isFinished ( ) {
You can’t perform that action at this time.
0 commit comments