Top Description Fields Constructors Methods
org.jruby.runtime.ivars

public Class StampedVariableAccessor

extends VariableAccessor
Class Inheritance
Imports
org.jruby.RubyBasicObject, .RubyClass, org.jruby.util.ArraySupport, java.lang.invoke.VarHandle

A variable accessor that uses a stamped volatile int and Unsafe methods to ensure thread-friendly table updating.

Field Summary

Inherited from org.jruby.runtime.ivars.VariableAccessor:
classIdDUMMY_ACCESSORindexnamerealClassSTAMP_HANDLEVAR_TABLE_HANDLE

Constructor Summary

AccessConstructor and Description
public
StampedVariableAccessor(RubyClass
the "real" class
realClass
,
String
the variable's name
name
,
int
the variable's index
index
,
int
the class's ID
classId
)

Construct a new StampedVariableAccessor for the given "real" class, variable name, variable index, and class ID.

Method Summary

Modifier and TypeMethod and Description
public void
set(Object
the object into which to set this variable
object
,
Object
the variable's value
value
)

Overrides org.jruby.runtime.ivars.VariableAccessor.set.

Set this variable into the given object using Unsafe to ensure safe updating of the variable table.

public static void
setVariableChecked(RubyBasicObject
the object into which to set the variable
self
,
RubyClass
the "real" class for the object
realClass
,
int
the index of the variable
index
,
Object
the variable's value
value
)

Set the given variable index into the specified object.

Inherited from org.jruby.runtime.ivars.VariableAccessor:
getgetClassIdgetIndexgetNamegetOrNilgetOrUndefinedgetVariabletoStringverify

Constructor Detail

StampedVariableAccessorback to summary
public StampedVariableAccessor(RubyClass realClass, String name, int index, int classId)

Construct a new StampedVariableAccessor for the given "real" class, variable name, variable index, and class ID.

Parameters
realClass:RubyClass

the "real" class

name:String

the variable's name

index:int

the variable's index

classId:int

the class's ID

Method Detail

setback to summary
public void set(Object object, Object value)

Overrides org.jruby.runtime.ivars.VariableAccessor.set.

Set this variable into the given object using Unsafe to ensure safe updating of the variable table.

Parameters
object:Object

the object into which to set this variable

value:Object

the variable's value

setVariableCheckedback to summary
public static void setVariableChecked(RubyBasicObject self, RubyClass realClass, int index, Object value)

Set the given variable index into the specified object. The "real" class and index are pass in to provide functional access. This version checks if self has been frozen before proceeding to set the variable.

Parameters
self:RubyBasicObject

the object into which to set the variable

realClass:RubyClass

the "real" class for the object

index:int

the index of the variable

value:Object

the variable's value