KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > ast > executable > YARVMachine


1 package org.jruby.ast.executable;
2
3 import org.jruby.Ruby;
4 import org.jruby.RubyHash;
5 import org.jruby.RubyModule;
6 import org.jruby.RubyString;
7 import org.jruby.MetaClass;
8 import org.jruby.parser.StaticScope;
9 import org.jruby.parser.LocalStaticScope;
10 import org.jruby.runtime.CallType;
11 import org.jruby.runtime.DynamicScope;
12 import org.jruby.runtime.ThreadContext;
13 import org.jruby.runtime.Visibility;
14 import org.jruby.runtime.builtin.IRubyObject;
15 import org.jruby.internal.runtime.methods.YARVMethod;
16 import org.jruby.internal.runtime.methods.WrapperMethod;
17
18 public class YARVMachine {
19     private static final boolean TAILCALL_OPT = Boolean.getBoolean("jruby.tailcall.enabled");
20
21     public static final YARVMachine INSTANCE = new YARVMachine();
22
23     public static int instruction(String JavaDoc name) {
24         return YARVInstructions.instruction(name);
25     }
26
27     public static class InstructionSequence {
28         public String JavaDoc magic;
29         public int major;
30         public int minor;
31         public int format_type;
32         public Object JavaDoc misc;
33         public String JavaDoc name;
34         public String JavaDoc filename;
35         public Object JavaDoc[] line;
36         public String JavaDoc type;
37
38         public String JavaDoc[] locals;
39
40         public int args_argc;
41         public int args_arg_opts;
42         public String JavaDoc[] args_opt_labels;
43         public int args_rest;
44         public int args_block;
45
46         public Object JavaDoc[] exception;
47
48         public Instruction[] body;
49
50         public InstructionSequence(Ruby runtime, String JavaDoc name, String JavaDoc file, String JavaDoc type) {
51             magic = "YARVInstructionSimpledataFormat";
52             major = 1;
53             minor = 1;
54             format_type = 1;
55             misc = runtime.getNil();
56             this.name = name;
57             this.filename = file;
58             this.line = new Object JavaDoc[0];
59             this.type = type;
60             this.locals = new String JavaDoc[0];
61             this.args_argc = 0;
62             this.args_arg_opts = 0;
63             this.exception = new Object JavaDoc[0];
64         }
65     }
66
67     public static class Instruction {
68         final public int bytecode;
69         public int line_no;
70         public String JavaDoc s_op0;
71         public IRubyObject o_op0;
72         public Object JavaDoc _tmp;
73         public long l_op0;
74         public long l_op1;
75         public int i_op1;
76         public InstructionSequence iseq_op;
77         public Instruction[] ins_op;
78         public int i_op3;
79
80         public int index;
81
82         public Instruction(int bytecode) {
83             this.bytecode = bytecode;
84         }
85
86         public Instruction(int bytecode, String JavaDoc op) {
87             this.bytecode = bytecode;
88             this.s_op0 = op;
89         }
90
91         public Instruction(int bytecode, String JavaDoc op, InstructionSequence op1) {
92             this.bytecode = bytecode;
93             this.s_op0 = op;
94             this.iseq_op = op1;
95         }
96
97         public Instruction(int bytecode, long op) {
98             this.bytecode = bytecode;
99             this.l_op0 = op;
100         }
101
102         public Instruction(int bytecode, IRubyObject op) {
103             this.bytecode = bytecode;
104             this.o_op0 = op;
105         }
106
107         public Instruction(int bytecode, String JavaDoc op, int op1, Instruction[] op2, int op3) {
108             this.bytecode = bytecode;
109             this.s_op0 = op;
110             this.i_op1 = op1;
111             this.ins_op = op2;
112             this.i_op3 = op3;
113         }
114
115         public String JavaDoc toString() {
116             return "[:" + YARVInstructions.name(bytecode) + ", " + (s_op0 != null ? s_op0 : (o_op0 != null ? o_op0.toString() : ("" + l_op0))) + "]";
117         }
118     }
119     
120     public IRubyObject exec(ThreadContext context, IRubyObject self, StaticScope scope, Instruction[] bytecodes) {
121         return exec(context,self, new DynamicScope(scope,null),bytecodes);
122     }
123
124     public IRubyObject exec(ThreadContext context, IRubyObject self, DynamicScope scope, Instruction[] bytecodes) {
125         IRubyObject[] stack = new IRubyObject[255];
126         int stackTop = 0;
127         stack[stackTop] = context.getRuntime().getNil();
128         int ip = 0;
129         Ruby runtime = context.getRuntime();
130         context.preRootNode(scope);
131         IRubyObject recv;
132         IRubyObject other;
133
134         yarvloop: while (ip < bytecodes.length) {
135             //System.err.println("Executing: " + YARVInstructions.name(bytecodes[ip].bytecode));
136
switch (bytecodes[ip].bytecode) {
137             case YARVInstructions.NOP:
138                 break;
139             case YARVInstructions.GETLOCAL:
140                 stack[++stackTop] = context.getCurrentScope().getValue((int)bytecodes[ip].l_op0,0);
141                 break;
142             case YARVInstructions.SETLOCAL:
143                 context.getCurrentScope().setValue((int)bytecodes[ip].l_op0, stack[stackTop--],0);
144                 break;
145             case YARVInstructions.GETSPECIAL:
146                 System.err.println("Not implemented, YARVMachine." + YARVInstructions.name(bytecodes[ip].bytecode));
147                 break;
148             case YARVInstructions.SETSPECIAL:
149                 System.err.println("Not implemented, YARVMachine." + YARVInstructions.name(bytecodes[ip].bytecode));
150                 break;
151             case YARVInstructions.GETDYNAMIC:
152                 System.err.println("Not implemented, YARVMachine." + YARVInstructions.name(bytecodes[ip].bytecode));
153                 break;
154             case YARVInstructions.SETDYNAMIC:
155                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
156                 break;
157             case YARVInstructions.GETINSTANCEVARIABLE:
158                 stack[++stackTop] = self.getInstanceVariable(bytecodes[ip].s_op0);
159                 break;
160             case YARVInstructions.SETINSTANCEVARIABLE:
161                 self.setInstanceVariable(bytecodes[ip].s_op0, stack[stackTop--]);
162                 break;
163             case YARVInstructions.GETCLASSVARIABLE: {
164                 RubyModule rubyClass = context.getRubyClass();
165                 String JavaDoc name = bytecodes[ip].s_op0;
166     
167                 if (rubyClass == null) {
168                     stack[++stackTop] = self.getMetaClass().getClassVar(name);
169                 } else if (!rubyClass.isSingleton()) {
170                     stack[++stackTop] = rubyClass.getClassVar(name);
171                 } else {
172                     RubyModule module = (RubyModule) rubyClass.getInstanceVariable("__attached__");
173     
174                     if (module != null) {
175                         stack[++stackTop] = module.getClassVar(name);
176                     } else {
177                         stack[++stackTop] = context.getRuntime().getNil();
178                     }
179                 }
180                 break;
181             }
182             case YARVInstructions.SETCLASSVARIABLE: {
183                 RubyModule rubyClass = (RubyModule) context.peekCRef().getValue();
184     
185                 if (rubyClass == null) {
186                     rubyClass = self.getMetaClass();
187                 } else if (rubyClass.isSingleton()) {
188                     rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__");
189                 }
190     
191                 rubyClass.setClassVar(bytecodes[ip].s_op0, stack[stackTop--]);
192                 break;
193             }
194             case YARVInstructions.GETCONSTANT:
195                 IRubyObject cls = stack[stackTop--];
196                 stack[++stackTop] = context.getConstant(bytecodes[ip].s_op0);
197                 break;
198             case YARVInstructions.SETCONSTANT:
199                 RubyModule module = (RubyModule) context.peekCRef().getValue();
200                 module.setConstant(bytecodes[ip].s_op0,stack[stackTop--]);
201                 runtime.incGlobalState();
202                 break;
203             case YARVInstructions.GETGLOBAL:
204                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
205                 break;
206             case YARVInstructions.SETGLOBAL:
207                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
208                 break;
209             case YARVInstructions.PUTNIL:
210                 stack[++stackTop] = context.getRuntime().getNil();
211                 break;
212             case YARVInstructions.PUTSELF:
213                 stack[++stackTop] = self;
214                 break;
215             case YARVInstructions.PUTUNDEF:
216                 // ko1 said this is going away
217
System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
218                 break;
219             case YARVInstructions.PUTOBJECT:
220                 stack[++stackTop] = bytecodes[ip].o_op0;
221                 break;
222             case YARVInstructions.PUTSTRING:
223                 stack[++stackTop] = context.getRuntime().newString(bytecodes[ip].s_op0);
224                 break;
225             case YARVInstructions.CONCATSTRINGS: {
226                 StringBuffer JavaDoc concatter = new StringBuffer JavaDoc();
227                 for (int i = 0; i < bytecodes[ip].l_op0; i++) {
228                     concatter.append(stack[stackTop--].toString());
229                 }
230                 stack[++stackTop] = context.getRuntime().newString(concatter.toString());
231                 break;
232             }
233             case YARVInstructions.TOSTRING:
234                 if(!(stack[stackTop] instanceof RubyString)) {
235                     stack[stackTop] = (stack[stackTop]).callMethod(context, "to_s");
236                 }
237                 break;
238             case YARVInstructions.TOREGEXP:
239                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
240                 break;
241             case YARVInstructions.NEWARRAY: {
242                 int size = (int)bytecodes[ip].l_op0;
243                 IRubyObject[] arr = new IRubyObject[size];
244                 for(int i = size - 1; i >= 0; i--) {
245                     arr[i] = stack[stackTop--];
246                 }
247                 stack[++stackTop] = context.getRuntime().newArrayNoCopy(arr);
248                 break;
249             }
250             case YARVInstructions.DUPARRAY:
251                 stack[++stackTop] = bytecodes[ip].o_op0.dup();
252                 break;
253             case YARVInstructions.EXPANDARRAY:
254                 // masgn array to values
255
System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
256                 break;
257             case YARVInstructions.CONCATARRAY:
258                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
259                 break;
260             case YARVInstructions.SPLATARRAY:
261                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
262                 break;
263             case YARVInstructions.CHECKINCLUDEARRAY:
264                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
265                 break;
266             case YARVInstructions.NEWHASH:
267                 int hsize = (int)bytecodes[ip].l_op0;
268                 RubyHash h = RubyHash.newHash(runtime);
269                 IRubyObject v,k;
270                 for(int i = hsize; i>0; i -= 2) {
271                     v = stack[stackTop--];
272                     k = stack[stackTop--];
273                     h.aset(k,v);
274                 }
275                 stack[++stackTop] = h;
276                 break;
277             case YARVInstructions.NEWRANGE:
278                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
279                 break;
280             case YARVInstructions.PUTNOT:
281                 stack[stackTop+1] = stack[stackTop].isTrue() ? runtime.getFalse() : runtime.getTrue();
282                 stackTop++;
283                 break;
284             case YARVInstructions.POP:
285                 stackTop--;
286                 break;
287             case YARVInstructions.DUP:
288                 stack[stackTop + 1] = stack[stackTop];
289                 stackTop++;
290                 break;
291             case YARVInstructions.DUPN: {
292                 int size = (int)bytecodes[ip].l_op0;
293                 for (int i = 0; i < size; i++) {
294                     stack[stackTop + 1] = stack[stackTop - size];
295                     stackTop++;
296                 }
297                 break;
298             }
299             case YARVInstructions.SWAP:
300                 stack[stackTop + 1] = stack[stackTop];
301                 stack[stackTop] = stack[stackTop - 1];
302                 stack[stackTop - 1] = stack[stackTop + 1];
303             case YARVInstructions.REPUT:
304                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
305                 break;
306             case YARVInstructions.TOPN: {
307                 int n = (int)bytecodes[ip].l_op0;
308                 other = stack[stackTop - n];
309                 stack[++stackTop] = other;
310                 break;
311             }
312             case YARVInstructions.SETN: {
313                 int n = (int)bytecodes[ip].l_op0;
314                 stack[stackTop - n] = stack[stackTop];
315                 break;
316             }
317             case YARVInstructions.EMPTSTACK:
318                 stackTop = 0;
319                 break;
320             case YARVInstructions.DEFINEMETHOD:
321                 RubyModule containingClass = context.getRubyClass();
322     
323                 if (containingClass == null) {
324                     throw runtime.newTypeError("No class to add method.");
325                 }
326
327                 String JavaDoc mname = bytecodes[ip].iseq_op.name;
328                 if (containingClass == runtime.getObject() && mname == "initialize") {
329                     runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop");
330                 }
331     
332                 Visibility visibility = context.getCurrentVisibility();
333                 if (mname == "initialize" || visibility.isModuleFunction() || context.isTopLevel()) {
334                     visibility = Visibility.PRIVATE;
335                 }
336                 
337                 if (containingClass.isSingleton()) {
338                     IRubyObject attachedObject = ((MetaClass) containingClass).getAttachedObject();
339                     
340                     if (attachedObject.getMetaClass() == runtime.getFixnum() || attachedObject.getMetaClass() == runtime.getClass("Symbol")) {
341                         throw runtime.newTypeError("can't define singleton method \"" +
342                                 mname + "\" for " + attachedObject.getType());
343                     }
344                 }
345
346                 StaticScope sco = new LocalStaticScope(null);
347                 sco.setVariables(bytecodes[ip].iseq_op.locals);
348                 YARVMethod newMethod = new YARVMethod(containingClass, bytecodes[ip].iseq_op, sco, visibility, context.peekCRef());
349
350                 containingClass.addMethod(mname, newMethod);
351     
352                 if (context.getCurrentVisibility().isModuleFunction()) {
353                     containingClass.getSingletonClass().addMethod(
354                             mname,
355                             new WrapperMethod(containingClass.getSingletonClass(), newMethod,
356                                     Visibility.PUBLIC));
357                     containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(mname));
358                 }
359     
360                 // 'class << state.self' and 'class << obj' uses defn as opposed to defs
361
if (containingClass.isSingleton()) {
362                     ((MetaClass) containingClass).getAttachedObject().callMethod(
363                             context, "singleton_method_added", runtime.newSymbol(mname));
364                 } else {
365                     containingClass.callMethod(context, "method_added", runtime.newSymbol(mname));
366                 }
367                 stack[++stackTop] = runtime.getNil();
368                 runtime.incGlobalState();
369                 break;
370             case YARVInstructions.ALIAS:
371                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
372                 break;
373             case YARVInstructions.UNDEF:
374                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
375                 runtime.incGlobalState();
376                 break;
377             case YARVInstructions.DEFINED:
378                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
379                 break;
380             case YARVInstructions.POSTEXE:
381                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
382                 break;
383             case YARVInstructions.TRACE:
384                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
385                 break;
386             case YARVInstructions.DEFINECLASS:
387                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
388                 break;
389             case YARVInstructions.SEND: {
390                 String JavaDoc name = bytecodes[ip].s_op0;
391                 IRubyObject[] args = new IRubyObject[bytecodes[ip].i_op1];
392
393                 Instruction[] blockBytecodes = bytecodes[ip].ins_op;
394                 // TODO: block stuff
395
int flags = bytecodes[ip].i_op3;
396                 CallType callType;
397
398                 for (int i = args.length; i > 0; i--) {
399                     args[i-1] = stack[stackTop--];
400                 }
401
402                 if ((flags & YARVInstructions.VCALL_FLAG) == 0) {
403                     if ((flags & YARVInstructions.FCALL_FLAG) == 0) {
404                         recv = stack[stackTop--];
405                         callType = CallType.NORMAL;
406                     } else {
407                         stackTop--;
408                         recv = self;
409                         callType = CallType.FUNCTIONAL;
410                     }
411                 } else {
412                     recv = self;
413                     callType = CallType.VARIABLE;
414                 }
415                 assert recv.getMetaClass() != null : recv.getClass().getName();
416
417                 if(TAILCALL_OPT && (bytecodes[ip+1].bytecode == YARVInstructions.LEAVE ||
418                                     (flags & YARVInstructions.TAILCALL_FLAG) == YARVInstructions.TAILCALL_FLAG) &&
419                    recv == self && name.equals(context.getFrameName())) {
420                     stackTop = 0;
421                     ip = -1;
422                     
423                     for(int i=0;i<args.length;i++) {
424                         context.getCurrentScope().getValues()[i] = args[i];
425                     }
426                 } else {
427                     stack[++stackTop] = recv.callMethod(context, name, args, callType);
428                 }
429                 break;
430             }
431             case YARVInstructions.INVOKESUPER:
432                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
433                 break;
434             case YARVInstructions.INVOKEBLOCK:
435                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
436                 break;
437             case YARVInstructions.LEAVE:
438                 break yarvloop;
439             case YARVInstructions.FINISH:
440                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
441                 break;
442             case YARVInstructions.THROW:
443                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
444                 break;
445             case YARVInstructions.JUMP:
446                 ip = (int)bytecodes[ip].l_op0;
447                 continue yarvloop;
448             case YARVInstructions.BRANCHIF:
449                 if (stack[stackTop--].isTrue()) {
450                     ip = (int)bytecodes[ip].l_op0;
451                 } else {
452                     ip++;
453                 }
454                 continue yarvloop;
455             case YARVInstructions.BRANCHUNLESS:
456                 if (!stack[stackTop--].isTrue()) {
457                     ip = (int)bytecodes[ip].l_op0;
458                 } else {
459                     ip++;
460                 }
461                 continue yarvloop;
462             case YARVInstructions.GETINLINECACHE:
463                 if(bytecodes[ip].l_op1 == runtime.getGlobalState()) {
464                     stack[++stackTop] = bytecodes[ip].o_op0;
465                     ip = (int)bytecodes[ip].l_op0;
466                     continue yarvloop;
467                 }
468                 break;
469             case YARVInstructions.ONCEINLINECACHE:
470                 if(bytecodes[ip].l_op1 > 0) {
471                     stack[++stackTop] = bytecodes[ip].o_op0;
472                     ip = (int)bytecodes[ip].l_op0;
473                     continue yarvloop;
474                 }
475                 break;
476             case YARVInstructions.SETINLINECACHE:
477                 int we = (int)bytecodes[ip].l_op0;
478                 bytecodes[we].o_op0 = stack[stackTop];
479                 bytecodes[we].l_op1 = runtime.getGlobalState();
480                 break;
481             case YARVInstructions.OPT_CASE_DISPATCH:
482                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
483 break;
484             case YARVInstructions.OPT_CHECKENV:
485                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
486 break;
487             case YARVInstructions.OPT_PLUS:
488                 other = stack[stackTop--];
489                 recv = stack[stackTop--];
490                 stack[++stackTop] = recv.callMethod(context,"+",other);
491                 break;
492             case YARVInstructions.OPT_MINUS:
493                 other = stack[stackTop--];
494                 recv = stack[stackTop--];
495                 stack[++stackTop] = recv.callMethod(context,"-",other);
496                 break;
497             case YARVInstructions.OPT_MULT:
498                 other = stack[stackTop--];
499                 recv = stack[stackTop--];
500                 stack[++stackTop] = recv.callMethod(context,"*",other);
501                 break;
502             case YARVInstructions.OPT_DIV:
503                 other = stack[stackTop--];
504                 recv = stack[stackTop--];
505                 stack[++stackTop] = recv.callMethod(context,"/",other);
506                 break;
507             case YARVInstructions.OPT_MOD:
508                 other = stack[stackTop--];
509                 recv = stack[stackTop--];
510                 stack[++stackTop] = recv.callMethod(context,"%",other);
511                 break;
512             case YARVInstructions.OPT_EQ:
513                 other = stack[stackTop--];
514                 recv = stack[stackTop--];
515                 stack[++stackTop] = recv.callMethod(context,"==",other);
516                 break;
517             case YARVInstructions.OPT_LT:
518                 other = stack[stackTop--];
519                 recv = stack[stackTop--];
520                 stack[++stackTop] = recv.callMethod(context,"<",other);
521                 break;
522             case YARVInstructions.OPT_LE:
523                 other = stack[stackTop--];
524                 recv = stack[stackTop--];
525                 stack[++stackTop] = recv.callMethod(context,"<=",other);
526                 break;
527             case YARVInstructions.OPT_LTLT:
528                 other = stack[stackTop--];
529                 recv = stack[stackTop--];
530                 stack[++stackTop] = recv.callMethod(context,"<<",other);
531                 break;
532             case YARVInstructions.OPT_AREF:
533                 other = stack[stackTop--];
534                 recv = stack[stackTop--];
535                 stack[++stackTop] = recv.callMethod(context,"[]",other);
536                 break;
537             case YARVInstructions.OPT_ASET:
538                 //YARV will never emit this, for some reason.
539
IRubyObject value = stack[stackTop--];
540                 other = stack[stackTop--];
541                 recv = stack[stackTop--];
542                 stack[++stackTop] = recv.callMethod(context,"[]=",new IRubyObject[]{other,value});
543                 break;
544             case YARVInstructions.OPT_LENGTH:
545                 recv = stack[stackTop--];
546                 stack[++stackTop] = recv.callMethod(context,"length");
547                 break;
548             case YARVInstructions.OPT_SUCC:
549                 recv = stack[stackTop--];
550                 stack[++stackTop] = recv.callMethod(context,"succ");
551                 break;
552             case YARVInstructions.OPT_REGEXPMATCH1:
553                 stack[stackTop] = bytecodes[ip].o_op0.callMethod(context,"=~",stack[stackTop]);
554                 break;
555             case YARVInstructions.OPT_REGEXPMATCH2:
556                 other = stack[stackTop--];
557                 recv = stack[stackTop--];
558                 stack[++stackTop] = recv.callMethod(context,"=~",other);
559                 break;
560             case YARVInstructions.OPT_CALL_NATIVE_COMPILED:
561                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
562 break;
563             case YARVInstructions.BITBLT:
564                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
565 break;
566             case YARVInstructions.ANSWER:
567                 stack[++stackTop] = runtime.newFixnum(42);
568                 break;
569             case YARVInstructions.GETLOCAL_OP_2:
570                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
571 break;
572             case YARVInstructions.GETLOCAL_OP_3:
573                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
574 break;
575             case YARVInstructions.GETLOCAL_OP_4:
576                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
577 break;
578             case YARVInstructions.SETLOCAL_OP_2:
579                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
580 break;
581             case YARVInstructions.SETLOCAL_OP_3:
582                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
583 break;
584             case YARVInstructions.SETLOCAL_OP_4:
585                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
586 break;
587             case YARVInstructions.GETDYNAMIC_OP__WC__0:
588                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
589 break;
590             case YARVInstructions.GETDYNAMIC_OP_1_0:
591                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
592 break;
593             case YARVInstructions.GETDYNAMIC_OP_2_0:
594                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
595 break;
596             case YARVInstructions.GETDYNAMIC_OP_3_0:
597                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
598 break;
599             case YARVInstructions.GETDYNAMIC_OP_4_0:
600                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
601 break;
602             case YARVInstructions.SETDYNAMIC_OP__WC__0:
603                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
604 break;
605             case YARVInstructions.SETDYNAMIC_OP_1_0:
606                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
607 break;
608             case YARVInstructions.SETDYNAMIC_OP_2_0:
609                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
610 break;
611             case YARVInstructions.SETDYNAMIC_OP_3_0:
612                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
613 break;
614             case YARVInstructions.SETDYNAMIC_OP_4_0:
615                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
616 break;
617             case YARVInstructions.PUTOBJECT_OP_INT2FIX_0_0_C_:
618                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
619 break;
620             case YARVInstructions.PUTOBJECT_OP_INT2FIX_0_1_C_:
621                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
622 break;
623             case YARVInstructions.PUTOBJECT_OP_QTRUE:
624                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
625 break;
626             case YARVInstructions.PUTOBJECT_OP_QFALSE:
627                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
628 break;
629             case YARVInstructions.SEND_OP__WC___WC__QFALSE_0__WC_:
630                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
631 break;
632             case YARVInstructions.SEND_OP__WC__0_QFALSE_0__WC_:
633                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
634 break;
635             case YARVInstructions.SEND_OP__WC__1_QFALSE_0__WC_:
636                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
637 break;
638             case YARVInstructions.SEND_OP__WC__2_QFALSE_0__WC_:
639                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
640 break;
641             case YARVInstructions.SEND_OP__WC__3_QFALSE_0__WC_:
642                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
643 break;
644             case YARVInstructions.SEND_OP__WC___WC__QFALSE_0X04__WC_:
645                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
646 break;
647             case YARVInstructions.SEND_OP__WC__0_QFALSE_0X04__WC_:
648                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
649 break;
650             case YARVInstructions.SEND_OP__WC__1_QFALSE_0X04__WC_:
651                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
652 break;
653             case YARVInstructions.SEND_OP__WC__2_QFALSE_0X04__WC_:
654                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
655 break;
656             case YARVInstructions.SEND_OP__WC__3_QFALSE_0X04__WC_:
657                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
658 break;
659             case YARVInstructions.SEND_OP__WC__0_QFALSE_0X0C__WC_:
660                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
661 break;
662             case YARVInstructions.UNIFIED_PUTOBJECT_PUTOBJECT:
663                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
664 break;
665             case YARVInstructions.UNIFIED_PUTOBJECT_PUTSTRING:
666                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
667 break;
668             case YARVInstructions.UNIFIED_PUTOBJECT_SETLOCAL:
669                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
670 break;
671             case YARVInstructions.UNIFIED_PUTOBJECT_SETDYNAMIC:
672                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
673 break;
674             case YARVInstructions.UNIFIED_PUTSTRING_PUTSTRING:
675                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
676 break;
677             case YARVInstructions.UNIFIED_PUTSTRING_PUTOBJECT:
678                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
679 break;
680             case YARVInstructions.UNIFIED_PUTSTRING_SETLOCAL:
681                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
682 break;
683             case YARVInstructions.UNIFIED_PUTSTRING_SETDYNAMIC:
684                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
685 break;
686             case YARVInstructions.UNIFIED_DUP_SETLOCAL:
687                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
688 break;
689             case YARVInstructions.UNIFIED_GETLOCAL_GETLOCAL:
690                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
691 break;
692             case YARVInstructions.UNIFIED_GETLOCAL_PUTOBJECT:
693                 System.err.println("Not implemented, YARVMachine." +YARVInstructions.name(bytecodes[ip].bytecode));
694 break;
695             }
696             ip++;
697         }
698
699         context.postRootNode();
700         return stack[stackTop];
701     }
702 }
703
Popular Tags