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

Method _exec

output/java8/1.4.17/Interpreter.java:171–452  ·  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...
194 load_str(self, ip);
195 ip += Bytecode.OPND_SIZE_IN_BYTES;
196 break;
197 case Bytecode.INSTR_LOAD_ATTR: nameIndex = getShort(code, ip);
198 ip += Bytecode.OPND_SIZE_IN_BYTES;
199 name = self.impl.strings[nameIndex];
200 try {
201 o = getAttribute(scope, name);
202 if ( o==ST.EMPTY_ATTR ) o = null;
203 }
204 catch (STNoSuchAttributeException nsae) {
205 errMgr.runTimeError(this, scope, ErrorType.NO_SUCH_ATTRIBUTE, name);
206 o = null;
207 }
208 operands[++sp] = o;
209 break;
210 case Bytecode.INSTR_LOAD_LOCAL:
211 int valueIndex = getShort(code, ip);
212 ip += Bytecode.OPND_SIZE_IN_BYTES;
213 o = self.locals[valueIndex];
214 if ( o==ST.EMPTY_ATTR ) o = null;
215 operands[++sp] = o;
216 break;
217 case Bytecode.INSTR_LOAD_PROP: nameIndex = getShort(code, ip);
218 ip += Bytecode.OPND_SIZE_IN_BYTES;
219 o = operands[sp--];
220 name = self.impl.strings[nameIndex];
221 operands[++sp] = getObjectProperty(out, scope, o, name);
222 break;
223 case Bytecode.INSTR_LOAD_PROP_IND: Object propName = operands[sp--];
224 o = operands[sp];
225 operands[sp] = getObjectProperty(out, scope, o, propName);
226 break;
227 case Bytecode.INSTR_NEW: nameIndex = getShort(code, ip);
228 ip += Bytecode.OPND_SIZE_IN_BYTES;

Callers 1

execMethod · 0.95

Calls 15

traceMethod · 0.95
load_strMethod · 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

Tested by

no test coverage detected