MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / constructItem

Method constructItem

src/main/java/wycc/io/HeapReader.java:149–169  ·  view source on GitHub ↗
(int index, Schema schema, Bytecode[] bytecodes, Item[] items)

Source from the content-addressed store, hash-verified

147 }
148
149 protected void constructItem(int index, Schema schema, Bytecode[] bytecodes, Item[] items) {
150 // FIXME: this fails in the presence of truly recursive items.
151 if (items[index] == null) {
152 // This item not yet constructed, therefore construct it!
153 Bytecode bytecode = bytecodes[index];
154 // Destructure bytecode
155 int opcode = bytecode.opcode;
156 int[] operands = bytecode.operands;
157 byte[] data = bytecode.data;
158 // Construct empty item
159 Item item = schema.getDescriptor(bytecode.opcode).construct(opcode,
160 new Item[operands.length], data);
161 // Store item so can be accessed recursively
162 items[index] = item;
163 // Recursively construct operands
164 for (int i = 0; i != operands.length; ++i) {
165 constructItem(operands[i], schema, bytecodes, items);
166 item.setOperand(i, items[operands[i]]);
167 }
168 }
169 }
170
171 private static class Bytecode {
172 public final int opcode;

Callers 1

constructItemsMethod · 0.95

Calls 3

setOperandMethod · 0.95
getDescriptorMethod · 0.65
constructMethod · 0.45

Tested by

no test coverage detected