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

Method _exec

output/java/1.4.17/Interpreter.java:172–488  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope)

Source from the content-addressed store, hash-verified

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

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