use of com.oracle.truffle.sl.runtime.SLObject in project graal by oracle.
the class SLLanguage method createObject.
/**
* Allocate an empty object. All new objects initially have no properties. Properties are added
* when they are first stored, i.e., the store triggers a shape change of the object.
*/
public SLObject createObject(AllocationReporter reporter) {
reporter.onEnter(null, 0, AllocationReporter.SIZE_UNKNOWN);
SLObject object = new SLObject(rootShape);
reporter.onReturnValue(object, 0, AllocationReporter.SIZE_UNKNOWN);
return object;
}
use of com.oracle.truffle.sl.runtime.SLObject in project graal by oracle.
the class SLReadPropertyNode method readSLObject.
@Specialization(limit = "LIBRARY_LIMIT")
protected Object readSLObject(SLObject receiver, Object name, @CachedLibrary("receiver") DynamicObjectLibrary objectLibrary, @Cached SLToTruffleStringNode toTruffleStringNode) {
TruffleString nameTS = toTruffleStringNode.execute(name);
Object result = objectLibrary.getOrDefault(receiver, nameTS, null);
if (result == null) {
// read was not successful. In SL we only have basic support for errors.
throw SLUndefinedNameException.undefinedProperty(this, nameTS);
}
return result;
}
Aggregations