示例#1
0
 @TruffleBoundary
 protected InternalMethod doLookup(InternalMethod currentMethod, DynamicObject selfMetaClass) {
   assert RubyGuards.isRubyClass(selfMetaClass);
   InternalMethod superMethod = ModuleOperations.lookupSuperMethod(currentMethod, selfMetaClass);
   // TODO (eregon, 12 June 2015): Is this correct?
   if (superMethod != null && superMethod.isUndefined()) {
     superMethod = null;
   }
   return superMethod;
 }
 @Override
 public String toString() {
   return String.format(
       "CachedBoxedDispatchNode(:%s, %s@%x, %s)",
       getCachedNameAsSymbol().toString(),
       expectedReceiver,
       expectedReceiver.hashCode(),
       method == null ? "null" : method.toString());
 }
示例#3
0
  @Override
  public Object execute(VirtualFrame frame) {
    final DynamicObject module = (DynamicObject) definingModule.execute(frame);
    final InternalMethod definition =
        prepareLexicalScope(module, definitionMethod.executeMethod(frame));

    return callModuleDefinitionNode.call(
        frame,
        definition.getCallTarget(),
        RubyArguments.pack(
            null,
            null,
            definition,
            DeclarationContext.MODULE,
            null,
            module,
            null,
            new Object[] {}));
  }
  public CachedSingletonDispatchNode(
      RubyContext context,
      Object cachedName,
      DispatchNode next,
      DynamicObject expectedReceiver,
      DynamicObject expectedClass,
      InternalMethod method,
      DispatchAction dispatchAction) {
    super(context, cachedName, next, dispatchAction);

    this.expectedReceiver = expectedReceiver;
    this.unmodifiedAssumption = Layouts.MODULE.getFields(expectedClass).getUnmodifiedAssumption();
    this.next = next;
    this.method = method;
    this.callNode = Truffle.getRuntime().createDirectCallNode(method.getCallTarget());
    applySplittingInliningStrategy(callNode, method);
  }
示例#5
0
 @TruffleBoundary
 private InternalMethod prepareLexicalScope(DynamicObject module, InternalMethod definition) {
   lexicalScope.unsafeSetLiveModule(module);
   Layouts.MODULE.getFields(lexicalScope.getParent().getLiveModule()).addLexicalDependent(module);
   return definition.withDeclaringModule(module);
 }