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 in case (splitAt index (methods input)) of
(pre, []) -> input (pre, []) -> input
(pre, method : post) -> let (pre, method : post) -> let
(_, bytecode, _) = assembleMethod (constantPool input, [], paramNames) declaration (constants, bytecode, aParamNames) = assembleMethod (constantPool input, [], paramNames) declaration
assembledMethod = method { assembledMethod = method {
memberAttributes = [ memberAttributes = [
CodeAttribute { CodeAttribute {
attributeMaxStack = 420, attributeMaxStack = 420,
attributeMaxLocals = 420, attributeMaxLocals = fromIntegral $ length aParamNames,
attributeCode = bytecode attributeCode = bytecode
} }
] ]
} }
in in
input { input {
constantPool = constants,
methods = pre ++ (assembledMethod : post) methods = pre ++ (assembledMethod : post)
} }