/** * Set the given variable index into the specified object. The "real" class * and index are pass in to provide functional access. * * @param self the object into which to set the variable * @param realClass the "real" class for the object * @param index the index of the variable * @param value the variable's value */ public static void setVariable(RubyBasicObject self, RubyClass realClass, int index, Object value) { while (true) { int currentStamp = self.varTableStamp; // spin-wait if odd if((currentStamp & 0x01) != 0) continue; Object[] currentTable = (Object[]) UnsafeHolder.U.getObjectVolatile(self, RubyBasicObject.VAR_TABLE_OFFSET); if (currentTable == null || index >= currentTable.length) { if (!createTableUnsafe(self, currentStamp, realClass, currentTable, index, value)) continue; } else { if (!updateTableUnsafe(self, currentStamp, currentTable, index, value)) continue; } break; } }
/** * Set the given variable index into the specified object. The "real" class * and index are pass in to provide functional access. * * @param self the object into which to set the variable * @param realClass the "real" class for the object * @param index the index of the variable * @param value the variable's value */ public static void setVariable(RubyBasicObject self, RubyClass realClass, int index, Object value) { while (true) { int currentStamp = self.varTableStamp; // spin-wait if odd if((currentStamp & 0x01) != 0) continue; Object[] currentTable = (Object[]) UnsafeHolder.U.getObjectVolatile(self, RubyBasicObject.VAR_TABLE_OFFSET); if (currentTable == null || index >= currentTable.length) { if (!createTableUnsafe(self, currentStamp, realClass, currentTable, index, value)) continue; } else { if (!updateTableUnsafe(self, currentStamp, currentTable, index, value)) continue; } break; } }
/** * Set the given variable index into the specified object. The "real" class * and index are pass in to provide functional access. * * @param self the object into which to set the variable * @param realClass the "real" class for the object * @param index the index of the variable * @param value the variable's value */ public static void setVariable(RubyBasicObject self, RubyClass realClass, int index, Object value) { while (true) { int currentStamp = self.varTableStamp; // spin-wait if odd if((currentStamp & 0x01) != 0) continue; Object[] currentTable = (Object[]) UnsafeHolder.U.getObjectVolatile(self, RubyBasicObject.VAR_TABLE_OFFSET); if (currentTable == null || index >= currentTable.length) { if (!createTableUnsafe(self, currentStamp, realClass, currentTable, index, value)) continue; } else { if (!updateTableUnsafe(self, currentStamp, currentTable, index, value)) continue; } break; } }
/** * Set the given variable index into the specified object. The "real" class * and index are pass in to provide functional access. * * @param self the object into which to set the variable * @param realClass the "real" class for the object * @param index the index of the variable * @param value the variable's value */ public static void setVariable(RubyBasicObject self, RubyClass realClass, int index, Object value) { while (true) { int currentStamp = self.varTableStamp; // spin-wait if odd if((currentStamp & 0x01) != 0) continue; Object[] currentTable = (Object[]) UnsafeHolder.U.getObjectVolatile(self, RubyBasicObject.VAR_TABLE_OFFSET); if (currentTable == null || index >= currentTable.length) { if (!createTableUnsafe(self, currentStamp, realClass, currentTable, index, value)) continue; } else { if (!updateTableUnsafe(self, currentStamp, currentTable, index, value)) continue; } break; } }