コード例 #1
0
ファイル: TruffleDebugNodes.java プロジェクト: ibmsoe/jruby
 @Specialization
 public RubyString javaClassOf(RubyArray array) {
   notDesignedForCompilation();
   return getContext()
       .makeString(
           "RubyArray("
               + (array.getStore() == null ? "null" : array.getStore().getClass())
               + "*"
               + array.getSize()
               + ")");
 }
コード例 #2
0
ファイル: RubyFiber.java プロジェクト: jhominal/jruby
  /**
   * Send a message to a fiber by posting into a message queue. Doesn't explicitly notify the Java
   * thread (although the queue implementation may) and doesn't wait for the message to be received.
   * On entry, assumes the the GIL is held. On exit, not holding the GIL.
   */
  public void resume(RubyFiber sendingFiber, Object... args) {
    RubyNode.notDesignedForCompilation();

    Object arg;

    if (args.length == 0) {
      arg = getContext().getCoreLibrary().getNilObject();
    } else if (args.length == 1) {
      arg = args[0];
    } else {
      arg = RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), args);
    }

    final RubyThread runningThread = threadManager.leaveGlobalLock();

    messageQueue.add(new FiberResumeMessage(runningThread, sendingFiber, arg));
  }