private static Map<DecompiledLocalVariable, Value> fetchSlotValues(Map<DecompiledLocalVariable, Value> map,
                                                                     List<? extends DecompiledLocalVariable> vars,
                                                                     StackFrame frame) throws Exception {
    final Value[] values;
    if (frame instanceof StackFrameImpl) {
      values = ((StackFrameImpl)frame).getSlotsValues(vars);
    }
    else {
      final Long frameId = ReflectionUtil.getField(frame.getClass(), frame, long.class, "id");
      final VirtualMachine vm = frame.virtualMachine();
      final Method stateMethod = vm.getClass().getDeclaredMethod("state");
      stateMethod.setAccessible(true);

      Object slotInfoArray = createSlotInfoArray(vars);

      Object ps;
      final Object vmState = stateMethod.invoke(vm);
      synchronized (vmState) {
        ps = ourEnqueueMethod.invoke(null, vm, frame.thread(), frameId, slotInfoArray);
      }

      final Object reply = ourWaitForReplyMethod.invoke(null, vm, ps);
      values = ReflectionUtil.getField(reply.getClass(), reply, Value[].class, "values");
      if (vars.size() != values.length) {
        throw new InternalException("Wrong number of values returned from target VM");
      }
    }
    int idx = 0;
    for (DecompiledLocalVariable var : vars) {
      map.put(var, values[idx++]);
    }
    return map;
  }
private static Map<DecompiledLocalVariable, Value> fetchSlotValues(Map<DecompiledLocalVariable, Value> map,
                                                                     List<? extends DecompiledLocalVariable> vars,
                                                                     StackFrame frame)