本文整理汇总了Java中com.oracle.truffle.api.frame.MaterializedFrame类的典型用法代码示例。如果您正苦于以下问题:Java MaterializedFrame类的具体用法?Java MaterializedFrame怎么用?Java MaterializedFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaterializedFrame类属于com.oracle.truffle.api.frame包,在下文中一共展示了MaterializedFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBindings
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Specialization(guards = {"needsBindings()"})
public Bindings createBindings(
VirtualFrame frame,
@Cached("createGetBindingsNode()") GetBindingsNode getBindingsNode,
@Cached(value = "createFetchers()", dimensions = 1) Fetcher[] fetchers
) {
Bindings ownBindings = getBindingsNode.executeGetBindings(frame);
Bindings bindings = new Bindings();
if (fetchers.length > 0) {
MaterializedFrame materializedFrame = frame.materialize();
for (Fetcher fetcher : fetchers) {
String name = fetcher.getName();
Binding binding = fetcher.fetch(materializedFrame, ownBindings);
bindings.add(name, binding);
}
}
return bindings;
}
示例2: determineContext
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@ExplodeLoop
protected final MaterializedFrame determineContext(final Frame frame) {
SObjectWithContext self = (SObjectWithContext) SArguments.rcvr(frame);
int i = contextLevel - 1;
if (i > 0) {
boolean doBuildChain = determineContext == null;
if (doBuildChain) {
determineContext = buildChain(self, i);
}
self = determineContext.getOuterSelf(self);
}
// Graal needs help here to see that this is always a MaterializedFrame
// so, we record explicitly a class profile
return frameType.profile(outerType.profile(self).getContext());
}
示例3: executeGeneric
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Override
public Object executeGeneric(final VirtualFrame frame) {
Object result = expression.executeGeneric(frame);
MaterializedFrame ctx = determineContext(frame);
FrameOnStackMarker marker = getMarkerFromContext(ctx);
if (marker.isOnStack()) {
throw new ReturnException(result, marker);
} else {
CompilerDirectives.transferToInterpreter();
// TODO: this should never be a performance relevant path... do caching if necessary
SBlock block = (SBlock) SArguments.rcvr(frame);
Object self = SArguments.rcvr(ctx);
// Lookup the invokable
SInvokable invokable = (SInvokable) Types.getClassOf(self).lookupMessage(
escapedBlock, AccessModifier.PROTECTED);
return invokable.invoke(call, new Object[] {self, block});
}
}
示例4: executeGeneric
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Override
public Object executeGeneric(final VirtualFrame frame) {
Object result = expression.executeGeneric(frame);
MaterializedFrame ctx = determineContext(frame);
FrameOnStackMarker marker = getMarkerFromContext(ctx);
if (marker.isOnStack()) {
throw new ReturnException(result, marker);
} else {
blockEscaped.enter();
SBlock block = (SBlock) SArguments.rcvr(frame);
Object self = SArguments.rcvr(ctx);
return SAbstractObject.sendEscapedBlock(self, block, universe);
}
}
示例5: getLexicalClosure
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
protected static MaterializedFrame getLexicalClosure(Frame frame) {
Object[] args = frame.getArguments();
if (args.length > 0) {
return (MaterializedFrame) frame.getArguments()[0];
} else {
return null;
}
}
示例6: open
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Specialization(rewriteOn = FrameSlotTypeException.class)
@CompilerDirectives.TruffleBoundary
public Closeable open(String path, Symbol direction) throws FrameSlotTypeException {
File file = new File(path);
if (!file.isAbsolute()) {
MaterializedFrame globals = this.getContext().getGlobalFrame();
FrameSlot homeDirectorySlot = globals.getFrameDescriptor().findFrameSlot("*home-directory*");
String homeDirectory = (String) globals.getObject(homeDirectorySlot);
file = new File(homeDirectory, path);
//throw new RuntimeException("not implemented");
}
//System.out.println(file.getAbsoluteFile());
try {
switch (direction.getName()) {
case "in":
return new BufferedInputStream(new FileInputStream(file));
case "out":
return new BufferedOutputStream(new FileOutputStream(file));
}
} catch (FileNotFoundException e) {
throw new RuntimeException("file not found:" + e);
}
throw new IllegalArgumentException("invalid direction");
}
示例7: setFast
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Specialization(guards = "symbol == cachedSymbol", limit = "2")
public Object setFast(Symbol symbol, Object value,
@Cached("symbol") Symbol cachedSymbol,
@Cached("lookupFrameSlot(cachedSymbol)") FrameSlot cachedFrameSlot,
@Cached("getGlobalFrame()") MaterializedFrame cachedGlobalFrame) {
cachedGlobalFrame.setObject(cachedFrameSlot, value);
return value;
}
示例8: setLexicalClosure
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
public Function setLexicalClosure(MaterializedFrame lexicalScope) {
//this.lexicalScope = lexicalScope;
//return this;
Function x = new Function(this.callTarget, this.arity, this.curriedArgumentValues);
x.lexicalScope = lexicalScope;
x.form = this.form;
return x;
}
示例9: createMaterializedFrame
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Override
public MaterializedFrame createMaterializedFrame(Object[] arguments, FrameDescriptor frameDescriptor) {
if (LazyFrameBoxingQuery.useFrameWithoutBoxing) {
return new FrameWithoutBoxing(frameDescriptor, arguments);
} else {
return new FrameWithBoxing(frameDescriptor, arguments);
}
}
示例10: SClass
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
/**
* The constructor used for instantiating the SClass of an object literal.
*
* @param frame, the current activation.
*/
public SClass(final SObjectWithClass enclosing, final SClass clazz,
final MaterializedFrame frame) {
super(clazz, clazz.getInstanceFactory());
this.enclosingObject = enclosing;
this.context = frame;
}
示例11: instantiateClass
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@Specialization(guards = {"sameSuperAndMixins(superclassAndMixins, cachedSuperMixins)"})
public SClass instantiateClass(final SObjectWithClass outerObj,
final Object superclassAndMixins, final MaterializedFrame frame,
@Cached("superclassAndMixins") final Object cachedSuperMixins,
@Cached("createClassFactory(superclassAndMixins)") final ClassFactory factory) {
return instantiate(outerObj, factory, frame);
}
示例12: getLexicalScope
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
protected static MaterializedFrame getLexicalScope(Frame frame) {
Object[] args = frame.getArguments();
if (args.length > 0) {
return (MaterializedFrame) frame.getArguments()[0];
} else {
return null;
}
}
示例13: determineContext
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
@ExplodeLoop
protected final MaterializedFrame determineContext(final VirtualFrame frame) {
SBlock self = (SBlock) SArguments.rcvr(frame);
int i = contextLevel - 1;
while (i > 0) {
self = (SBlock) self.getOuterSelf();
i--;
}
// Graal needs help here to see that this is always a MaterializedFrame
// so, we record explicitly a class profile
return frameType.profile(self.getContext());
}
示例14: getGlobalFrame
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
public MaterializedFrame getGlobalFrame() {
return this.globalFrame;
}
示例15: getGlobalFrame
import com.oracle.truffle.api.frame.MaterializedFrame; //导入依赖的package包/类
protected MaterializedFrame getGlobalFrame() {
return this.getContext().getGlobalFrame();
}