Skip to content

Commit 427eaab

Browse files
committed
Turn classes into records.
1 parent f40a76e commit 427eaab

File tree

4 files changed

+31
-135
lines changed

4 files changed

+31
-135
lines changed

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/SymbolTable.java

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -149,62 +149,27 @@ public String toString() {
149149
}
150150
}
151151

152-
public static class TableInfo {
153-
/**
154-
* Lower bound on table size.
155-
*/
156-
public final int initialSize;
157-
158-
/**
159-
* Upper bound on table size.
160-
* <p>
161-
* <em>Note:</em> this is the upper bound defined by the module. A table instance might have
162-
* a lower internal max allowed size in practice.
163-
*/
164-
public final int maximumSize;
165-
166-
/**
167-
* The element type of the table.
168-
*/
169-
public final byte elemType;
170-
171-
public TableInfo(int initialSize, int maximumSize, byte elemType) {
172-
this.initialSize = initialSize;
173-
this.maximumSize = maximumSize;
174-
this.elemType = elemType;
175-
}
152+
/**
153+
* @param initialSize Lower bound on table size.
154+
* @param maximumSize Upper bound on table size.
155+
* <p>
156+
* <em>Note:</em> this is the upper bound defined by the module. A table instance
157+
* might have a lower internal max allowed size in practice.
158+
* @param elemType The element type of the table.
159+
*/
160+
public record TableInfo(int initialSize, int maximumSize, byte elemType) {
176161
}
177162

178-
public static class MemoryInfo {
179-
/**
180-
* Lower bound on memory size (in pages of 64 kiB).
181-
*/
182-
public final long initialSize;
183-
184-
/**
185-
* Upper bound on memory size (in pages of 64 kiB).
186-
* <p>
187-
* <em>Note:</em> this is the upper bound defined by the module. A memory instance might
188-
* have a lower internal max allowed size in practice.
189-
*/
190-
public final long maximumSize;
191-
192-
/**
193-
* If the memory uses index type 64.
194-
*/
195-
public final boolean indexType64;
196-
197-
/**
198-
* Whether the memory is shared (modifications are visible to other threads).
199-
*/
200-
public final boolean shared;
201-
202-
public MemoryInfo(long initialSize, long maximumSize, boolean indexType64, boolean shared) {
203-
this.initialSize = initialSize;
204-
this.maximumSize = maximumSize;
205-
this.indexType64 = indexType64;
206-
this.shared = shared;
207-
}
163+
/**
164+
* @param initialSize Lower bound on memory size (in pages of 64 kiB).
165+
* @param maximumSize Upper bound on memory size (in pages of 64 kiB).
166+
* <p>
167+
* <em>Note:</em> this is the upper bound defined by the module. A memory instance
168+
* might have a lower internal max allowed size in practice.
169+
* @param indexType64 If the memory uses index type 64.
170+
* @param shared Whether the memory is shared (modifications are visible to other threads).
171+
*/
172+
public record MemoryInfo(long initialSize, long maximumSize, boolean indexType64, boolean shared) {
208173
}
209174

210175
/**

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmCustomSection.java

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,10 @@
4242

4343
/**
4444
* Information about a custom section.
45+
*
46+
* @param name Name of the custom section.
47+
* @param offset Location in the custom sections array.
48+
* @param length Length of the custom section.
4549
*/
46-
public class WasmCustomSection {
47-
/**
48-
* Name of the custom section.
49-
*/
50-
private final String name;
51-
52-
/**
53-
* Location in the custom sections array.
54-
*/
55-
private final int offset;
56-
57-
/**
58-
* Length of the custom section.
59-
*/
60-
private final int length;
61-
62-
public WasmCustomSection(String name, int offset, int length) {
63-
this.name = name;
64-
this.offset = offset;
65-
this.length = length;
66-
}
67-
68-
/**
69-
* Returns the name of the custom section.
70-
*
71-
* @return name of the custom section.
72-
*/
73-
public String name() {
74-
return name;
75-
}
76-
77-
public int offset() {
78-
return offset;
79-
}
80-
81-
public int length() {
82-
return length;
83-
}
84-
50+
public record WasmCustomSection(String name, int offset, int length) {
8551
}

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/debugging/parser/DebugParseUnit.java

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,10 @@
4646
/**
4747
* Represents the result of parsing debug information.
4848
*/
49-
public final class DebugParseUnit {
50-
private final DebugData rootData;
51-
private final EconomicMap<Integer, DebugData> entries;
52-
private final EconomicMap<Integer, AbbreviationDeclaration> abbreviationTable;
53-
private final int entryOffset;
54-
private final int compilationUnitOffset;
55-
56-
public DebugParseUnit(DebugData rootData, EconomicMap<Integer, DebugData> entries, EconomicMap<Integer, AbbreviationDeclaration> abbreviationTable, int entryOffset, int compilationUnitOffset) {
57-
this.rootData = rootData;
58-
this.entries = entries;
59-
this.abbreviationTable = abbreviationTable;
60-
this.entryOffset = entryOffset;
61-
this.compilationUnitOffset = compilationUnitOffset;
62-
}
63-
64-
public DebugData rootData() {
65-
return rootData;
66-
}
67-
68-
public EconomicMap<Integer, DebugData> entries() {
69-
return entries;
70-
}
71-
72-
public EconomicMap<Integer, AbbreviationDeclaration> abbreviationTable() {
73-
return abbreviationTable;
74-
}
75-
76-
public int entryOffset() {
77-
return entryOffset;
78-
}
79-
80-
public int compilationUnitOffset() {
81-
return compilationUnitOffset;
82-
}
49+
public record DebugParseUnit(
50+
DebugData rootData,
51+
EconomicMap<Integer, DebugData> entries,
52+
EconomicMap<Integer, AbbreviationDeclaration> abbreviationTable,
53+
int entryOffset,
54+
int compilationUnitOffset) {
8355
}

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/nodes/WasmFunctionNode.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,7 @@ private Vector128Ops<V128> vector128Ops() {
189189
}
190190

191191
// region OSR support
192-
private static final class WasmOSRInterpreterState {
193-
final int stackPointer;
194-
final int line;
195-
196-
WasmOSRInterpreterState(int stackPointer, int line) {
197-
this.stackPointer = stackPointer;
198-
this.line = line;
199-
}
192+
private record WasmOSRInterpreterState(int stackPointer, int line) {
200193
}
201194

202195
@Override

0 commit comments

Comments
 (0)