org.jruby.RubyClass.getVariableTableSizeWithExtras()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.jruby.RubyClass.getVariableTableSizeWithExtras方法的一些代码示例,展示了RubyClass.getVariableTableSizeWithExtras的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.getVariableTableSizeWithExtras方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:getVariableTableSizeWithExtras

RubyClass.getVariableTableSizeWithExtras介绍

暂无

代码示例

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Create a new table for the given object sufficient in size to accommodate
 * all known variables.
 * 
 * @param self the object to hold the table
 * @param realClass the "real" class for the object
 * @return the newly-created table
 */
private static Object[] createTable(RubyBasicObject self, RubyClass realClass) {
  return self.varTable = new Object[realClass.getVariableTableSizeWithExtras()];
}

代码示例来源:origin: org.jruby/jruby-core

/**
 * Create a new table for the given object sufficient in size to accommodate
 * all known variables.
 * 
 * @param self the object to hold the table
 * @param realClass the "real" class for the object
 * @return the newly-created table
 */
private static Object[] createTable(RubyBasicObject self, RubyClass realClass) {
  return self.varTable = new Object[realClass.getVariableTableSizeWithExtras()];
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Create a new table for the given object sufficient in size to accommodate
 * all known variables.
 * 
 * @param self the object to hold the table
 * @param realClass the "real" class for the object
 * @return the newly-created table
 */
private static Object[] createTable(RubyBasicObject self, RubyClass realClass) {
  return self.varTable = new Object[realClass.getVariableTableSizeWithExtras()];
}

代码示例来源:origin: org.jruby/jruby-complete

/**
 * Create a new table for the given object sufficient in size to accommodate
 * all known variables.
 * 
 * @param self the object to hold the table
 * @param realClass the "real" class for the object
 * @return the newly-created table
 */
private static Object[] createTable(RubyBasicObject self, RubyClass realClass) {
  return self.varTable = new Object[realClass.getVariableTableSizeWithExtras()];
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
   * Grow an existing table to accommodate all known variables.
   * 
   * @param self the object to hold the table
   * @param realClass the "real" class for the object
   * @param currentTable the current table
   * @return the expanded table
   */
  private static Object[] growTable(RubyBasicObject self, RubyClass realClass, Object[] currentTable) {
    Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
    System.arraycopy(currentTable, 0, newTable, 0, currentTable.length);
    return self.varTable = newTable;
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
   * Grow an existing table to accommodate all known variables.
   * 
   * @param self the object to hold the table
   * @param realClass the "real" class for the object
   * @param currentTable the current table
   * @return the expanded table
   */
  private static Object[] growTable(RubyBasicObject self, RubyClass realClass, Object[] currentTable) {
    Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
    System.arraycopy(currentTable, 0, newTable, 0, currentTable.length);
    return self.varTable = newTable;
  }
}

代码示例来源:origin: org.jruby/jruby-complete

/**
   * Grow an existing table to accommodate all known variables.
   * 
   * @param self the object to hold the table
   * @param realClass the "real" class for the object
   * @param currentTable the current table
   * @return the expanded table
   */
  private static Object[] growTable(RubyBasicObject self, RubyClass realClass, Object[] currentTable) {
    Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
    ArraySupport.copy(currentTable, 0, newTable, 0, currentTable.length);
    return self.varTable = newTable;
  }
}

代码示例来源:origin: org.jruby/jruby-core

/**
   * Grow an existing table to accommodate all known variables.
   * 
   * @param self the object to hold the table
   * @param realClass the "real" class for the object
   * @param currentTable the current table
   * @return the expanded table
   */
  private static Object[] growTable(RubyBasicObject self, RubyClass realClass, Object[] currentTable) {
    Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
    ArraySupport.copy(currentTable, 0, newTable, 0, currentTable.length);
    return self.varTable = newTable;
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];

代码示例来源:origin: org.jruby/jruby-core

Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];

代码示例来源:origin: org.jruby/jruby-complete

/**
 * Create or exapand a table for the given object, using Unsafe CAS and
 * ordering operations to ensure visibility.
 *
 * @param self the object into which to set the variable
 * @param currentStamp the current variable table stamp
 * @param realClass the "real" class for the object
 * @param currentTable the current table
 * @param index the index of the variable
 * @param value the variable's value
 * @return whether the update was successful, for CAS retrying
 */
private static boolean createTableUnsafe(RubyBasicObject self, int currentStamp, RubyClass realClass, Object[] currentTable, int index, Object value) {
  // try to acquire exclusive access to the varTable field
  if (!UnsafeHolder.U.compareAndSwapInt(self, RubyBasicObject.STAMP_OFFSET, currentStamp, ++currentStamp)) {
    return false;
  }
  Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
  if (currentTable != null) {
    ArraySupport.copy(currentTable, 0, newTable, 0, currentTable.length);
  }
  newTable[index] = value;
  UnsafeHolder.U.putOrderedObject(self, RubyBasicObject.VAR_TABLE_OFFSET, newTable);
  // release exclusive access
  self.varTableStamp = currentStamp + 1;
  return true;
}

代码示例来源:origin: org.jruby/jruby-complete

Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];

代码示例来源:origin: org.jruby/jruby-core

/**
 * Create or exapand a table for the given object, using Unsafe CAS and
 * ordering operations to ensure visibility.
 *
 * @param self the object into which to set the variable
 * @param currentStamp the current variable table stamp
 * @param realClass the "real" class for the object
 * @param currentTable the current table
 * @param index the index of the variable
 * @param value the variable's value
 * @return whether the update was successful, for CAS retrying
 */
private static boolean createTableUnsafe(RubyBasicObject self, int currentStamp, RubyClass realClass, Object[] currentTable, int index, Object value) {
  // try to acquire exclusive access to the varTable field
  if (!UnsafeHolder.U.compareAndSwapInt(self, RubyBasicObject.STAMP_OFFSET, currentStamp, ++currentStamp)) {
    return false;
  }
  Object[] newTable = new Object[realClass.getVariableTableSizeWithExtras()];
  if (currentTable != null) {
    ArraySupport.copy(currentTable, 0, newTable, 0, currentTable.length);
  }
  newTable[index] = value;
  UnsafeHolder.U.putOrderedObject(self, RubyBasicObject.VAR_TABLE_OFFSET, newTable);
  // release exclusive access
  self.varTableStamp = currentStamp + 1;
  return true;
}

相关文章

微信公众号

最新文章

更多

RubyClass类方法