You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tools/emterpretify.py
+1-8
Original file line number
Diff line number
Diff line change
@@ -221,7 +221,7 @@ def handle_arg(arg):
221
221
222
222
'SWITCH', # [lx, ly, lz] switch (lx) { .. }. followed by a jump table for values in range [ly..ly+lz), after which is the default (which might be empty)
223
223
'RET', # [l, 0, 0] return l (depending on which emterpreter_x we are in, has the right type)
224
-
'FUNC', # [num params, total locals (low 8 bits), total locals (high 8 bits)] [which emterpreter (0 = normal, 1 = zero), 0, last zeroinit = num params + num zero-inits (low 8), (high 8)] function with n locals (each taking 64 bits), of which the first are params
224
+
'FUNC', # [num params, total locals (low 8 bits), total locals (high 8 bits)] [which emterpreter (0 = normal, 1 = zero), 0, 0, 0] function with n locals (each taking 64 bits), of which the first are params
225
225
# this is read in the emterpreter prelude, and also in intcalls
226
226
227
227
# slow locals support - copying from/to slow locals
Copy file name to clipboardexpand all lines: tools/js-optimizer.js
+3-17
Original file line number
Diff line number
Diff line change
@@ -7610,23 +7610,9 @@ function emterpretify(ast) {
7610
7610
}
7611
7611
assert(numLocals<FAST_LOCALS,'way too many params!');
7612
7612
assert(FAST_LOCALS<256);
7613
-
varzeroInits;
7614
-
if(numVars<FAST_LOCALS*2){
7615
-
zeroInits=findUninitializedVars(func,asmData);
7616
-
}else{
7617
-
zeroInits=copy(asmData.vars);// give up - tons of vars, this will be slow anyhow, and findUninitializedVars is non-linear so can be very slow on massive function
7618
-
}
7619
-
for(varzeroinzeroInits){
7620
-
locals[zero]=numLocals++;
7621
-
if(numLocals===FAST_LOCALS)numLocals=256;// jump over the temps, remaining locals are slow locals
7622
-
}
7623
-
varlastZeroInit=func[2].length+numLocals;// may be higher than func[2].length + numZeroInits, due to jumping over temps
7624
-
// this means if we have very many zeroinits, we end up zeroing out the temps, oh well
7625
7613
for(variinasmData.vars){
7626
-
if(!(iinzeroInits)){
7627
-
locals[i]=numLocals++;// TODO: sort by frequency of appearance, so common ones are fast, rare are slow
7628
-
if(numLocals===FAST_LOCALS)numLocals=256;// jump over the temps, remaining locals are slow locals
7629
-
}
7614
+
locals[i]=numLocals++;// TODO: sort by frequency of appearance, so common ones are fast, rare are slow
7615
+
if(numLocals===FAST_LOCALS)numLocals=256;// jump over the temps, remaining locals are slow locals
7630
7616
}
7631
7617
varwithSlowLocals=numLocals;
7632
7618
numLocals=Math.min(numLocals,FAST_LOCALS);// ignore the slow locals
@@ -7650,7 +7636,7 @@ function emterpretify(ast) {
7650
7636
// calculate final count of local variables, and emit func header
0 commit comments