MCPcopy Index your code
hub / github.com/antlr/codebuff / _exec

Method _exec

output/java8/1.4.14/Interpreter.java:167–446  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope)

Source from the content-addressed store, hash-verified

165 }
166
167 protected int _exec(STWriter out, InstanceScope scope) {
168 final ST self = scope.st;
169 int start = out.index(); // track char we're about to write
170 int prevOpcode = 0;
171 int n = 0; // how many char we write out
172 int nargs;
173 int nameIndex;
174 int addr;
175 String name;
176 Object o, left, right;
177 ST st;
178 Object[] options;
179 byte[] code = self.impl.instrs; // which code block are we executing
180 int ip = 0;
181 while ( ip < self.impl.codeSize ) {
182 if ( trace || debug ) trace(scope, ip);
183 short opcode = code[ip];
184 //count[opcode]++;
185 scope.ip = ip;
186 ip++; //jump to next instruction or first byte of operand
187 switch ( opcode ) {
188 case Bytecode.INSTR_LOAD_STR:
189 // just testing... load_str(self, ip);
190 ip += Bytecode.OPND_SIZE_IN_BYTES;
191 break;
192 case Bytecode.INSTR_LOAD_ATTR: nameIndex = getShort(code, ip);
193 ip += Bytecode.OPND_SIZE_IN_BYTES;
194 name = self.impl.strings[nameIndex];
195 try {
196 o = getAttribute(scope, name);
197 if ( o==ST.EMPTY_ATTR ) o = null;
198 }
199 catch (STNoSuchAttributeException nsae) {
200 errMgr.runTimeError(this, scope, ErrorType.NO_SUCH_ATTRIBUTE, name);
201 o = null;
202 }
203 operands[++sp] = o;
204 break;
205 case Bytecode.INSTR_LOAD_LOCAL:
206 int valueIndex = getShort(code, ip);
207 ip += Bytecode.OPND_SIZE_IN_BYTES;
208 o = self.locals[valueIndex];
209 if ( o==ST.EMPTY_ATTR ) o = null;
210 operands[++sp] = o;
211 break;
212 case Bytecode.INSTR_LOAD_PROP: nameIndex = getShort(code, ip);
213 ip += Bytecode.OPND_SIZE_IN_BYTES;
214 o = operands[sp--];
215 name = self.impl.strings[nameIndex];
216 operands[++sp] = getObjectProperty(out, scope, o, name);
217 break;
218 case Bytecode.INSTR_LOAD_PROP_IND: Object propName = operands[sp--];
219 o = operands[sp];
220 operands[sp] = getObjectProperty(out, scope, o, propName);
221 break;
222 case Bytecode.INSTR_NEW: nameIndex = getShort(code, ip);
223 ip += Bytecode.OPND_SIZE_IN_BYTES;
224 name = self.impl.strings[nameIndex];

Callers 1

execMethod · 0.95

Calls 15

traceMethod · 0.95
getShortMethod · 0.95
getAttributeMethod · 0.95
getObjectPropertyMethod · 0.95
storeArgsMethod · 0.95
super_newMethod · 0.95
writeObjectNoOptionsMethod · 0.95
mapMethod · 0.95
rot_mapMethod · 0.95
zip_mapMethod · 0.95
testAttributeTrueMethod · 0.95

Tested by

no test coverage detected