C: in addition to deece78dec

Fix generation of heap dump metadata
This commit is contained in:
Alexey Andreev 2020-05-15 18:05:50 +03:00
parent deece78dec
commit 333ee95604

View File

@ -922,7 +922,7 @@ public class ClassGenerator {
codeWriter.println("fieldDescriptors = (TeaVM_FieldDescriptors*) " codeWriter.println("fieldDescriptors = (TeaVM_FieldDescriptors*) "
+ "&(struct { uint32_t count; TeaVM_FieldDescriptor data[" + "&(struct { uint32_t count; TeaVM_FieldDescriptor data["
+ fields.size() + "]; }) {").indent(); + fields.size() + "]; }) {").indent();
generateHeapDumpFields(fields); generateHeapDumpFields(codeWriter, fields);
codeWriter.outdent().print("}"); codeWriter.outdent().print("}");
if (initMethod) { if (initMethod) {
codeWriter.println(";"); codeWriter.println(";");
@ -938,7 +938,7 @@ public class ClassGenerator {
codeWriter.println("staticFieldDescriptors = (TeaVM_StaticFieldDescriptors*) " codeWriter.println("staticFieldDescriptors = (TeaVM_StaticFieldDescriptors*) "
+ "&(struct { uint32_t count; TeaVM_StaticFieldDescriptor data[" + "&(struct { uint32_t count; TeaVM_StaticFieldDescriptor data["
+ staticFields.size() + "]; }) {").indent(); + staticFields.size() + "]; }) {").indent();
generateHeapDumpFields(staticFields); generateHeapDumpFields(codeWriter, staticFields);
codeWriter.outdent().print("}"); codeWriter.outdent().print("}");
if (initMethod) { if (initMethod) {
codeWriter.println(";"); codeWriter.println(";");
@ -947,7 +947,7 @@ public class ClassGenerator {
codeWriter.println().outdent().println("#endif"); codeWriter.println().outdent().println("#endif");
} }
private void generateHeapDumpFields(List<HeapDumpField> fields) { private void generateHeapDumpFields(CodeWriter codeWriter, List<HeapDumpField> fields) {
codeWriter.println(".count = " + fields.size() + ","); codeWriter.println(".count = " + fields.size() + ",");
codeWriter.println(".data = {").indent(); codeWriter.println(".data = {").indent();
for (int i = 0; i < fields.size(); ++i) { for (int i = 0; i < fields.size(); ++i) {