maxLocals calculation

This commit is contained in:
Matthias Raba 2024-06-18 07:37:01 +02:00
parent d2554c9b22
commit ee302bb245

View File

@ -69,18 +69,19 @@ methodAssembler (MethodDeclaration returntype name parameters statement) input =
in case (splitAt index (methods input)) of
(pre, []) -> input
(pre, method : post) -> let
(_, bytecode, _) = assembleMethod (constantPool input, [], paramNames) declaration
(constants, bytecode, aParamNames) = assembleMethod (constantPool input, [], paramNames) declaration
assembledMethod = method {
memberAttributes = [
CodeAttribute {
attributeMaxStack = 420,
attributeMaxLocals = 420,
attributeMaxLocals = fromIntegral $ length aParamNames,
attributeCode = bytecode
}
]
}
in
input {
constantPool = constants,
methods = pre ++ (assembledMethod : post)
}