Example #1
0
 public void run(InternalMethod m, JavaValue[] args) throws Exception {
   logger.setLevel(Level.ALL);
   logger.fine("run " + m.getName());
   try {
     nativeMethods.initialize();
     pushFrame(m, args);
     while (true) {
       int index = getCurrentPC().getValue();
       Instruction currentInstruction = getCurrentMethod().getInstructions()[index];
       incrementPC(currentInstruction.getLength());
       // System.out.print(indent);
       if (debug_instructions) {
         //                    logger.info(instructionCount + " " + getCurrentClass().getDesc() + "
         // :: " + getCurrentMethod().getName() + " " +
         //                            index + ": " + currentInstruction);// + ", " +
         // getCurrentFrame());
         System.out.println(
             instructionCount
                 + " "
                 + getCurrentClass().getDesc()
                 + " :: "
                 + getCurrentMethod().getName()
                 + " "
                 + index
                 + ": "
                 + currentInstruction
                 + ", "
                 + threadsArea.getStackSize()); // + ", " + getCurrentFrame());
       }
       // System.out.println(getCurrentFrame());
       currentInstruction.accept(bytecodeInterpreter);
       if (++instructionCount == maxInstructions && maxInstructions != 0) {
         throw new ExecutionTimeExceededException();
       }
     }
   } catch (ThreadHaltE e) {
     return; // kill current thread and see if you can start another thread, otherwise return
   }
   //        catch (JavaException e) {
   //            throw new Exception(e.getMessage()); // todo
   //        }
   catch (InternalException e) {
     throw new Exception(e.getMessage()); // todo
   }
 }
Example #2
0
 public void callNative(InternalMethod internalMethod, JavaValue[] args)
     throws LinkE, LocalVarsE, BadConversionE, OperandStackE, JavaException {
   nativeMethods.call(internalMethod, args);
 }