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

Method _exec

output/java8/1.4.12/Interpreter.java:171–442  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope)

Source from the content-addressed store, hash-verified

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