File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/main/pt/up/fe/comp2023/jasmin Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -198,9 +198,12 @@ public static String createConstructMethod(String superClassName) {
198
198
public static String createMethodDirective (Method method ) {
199
199
JVMInstructionUtils .numLocals = 0 ;
200
200
JVMInstructionUtils .stackSize = 0 ;
201
- String methodDirective = ".method " ;
202
201
String instructions = handleMethodStatements (method );
202
+ JVMInstructionUtils .numLocals += method .getParams ().size ();
203
+ if (!method .isStaticMethod ())
204
+ JVMInstructionUtils .numLocals ++;
203
205
206
+ String methodDirective = ".method " ;
204
207
methodDirective += createMethodDeclaration (method );
205
208
methodDirective += "\t .limit stack " + JVMInstructionUtils .stackSize + "\n " ;
206
209
methodDirective += "\t .limit locals " + JVMInstructionUtils .numLocals + "\n " ;
You can’t perform that action at this time.
0 commit comments