当前位置: 首页>>代码示例>>Java>>正文


Java SObject类代码示例

本文整理汇总了Java中som.vmobjects.SObject的典型用法代码示例。如果您正苦于以下问题:Java SObject类的具体用法?Java SObject怎么用?Java SObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SObject类属于som.vmobjects包,在下文中一共展示了SObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSObjectCheck

import som.vmobjects.SObject; //导入依赖的package包/类
public static CheckSObject createSObjectCheck(final SObject obj) {
  if (obj instanceof SMutableObject) {
    return new CheckSMutableObject(((SMutableObject) obj).getObjectLayout());
  }

  assert obj instanceof SImmutableObject;
  return new CheckSImmutableObject(((SImmutableObject) obj).getObjectLayout());
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:9,代码来源:DispatchGuard.java

示例2: instantiateClassObject

import som.vmobjects.SObject; //导入依赖的package包/类
private SClass instantiateClassObject(final SObject rcvr) {
  if (superclassAndMixinResolver == null) {
    CompilerDirectives.transferToInterpreterAndInvalidate();
    createResolverCallTargets();
  }

  Object superclassAndMixins = superclassAndMixinResolver.call(new Object[] {rcvr});
  SClass classObject = instantiation.execute(rcvr, superclassAndMixins);
  return classObject;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:11,代码来源:ClassSlotAccessNode.java

示例3: getDispatchNode

import som.vmobjects.SObject; //导入依赖的package包/类
@Override
public AbstractDispatchNode getDispatchNode(final Object receiver,
    final Object firstArg, final AbstractDispatchNode next,
    final boolean forAtomic) {
  SObject rcvr = (SObject) receiver;
  StorageLocation loc = rcvr.getObjectLayout().getStorageLocation(this);
  boolean isSet = loc.isSet(rcvr);

  CachedSlotRead read =
      createNode(loc, DispatchGuard.createSObjectCheck(rcvr), next, isSet);

  if (forAtomic && rcvr instanceof SMutableObject &&
      getAccessType() == SlotAccess.FIELD_READ) {
    return new CachedTxSlotRead(getAccessType(), read,
        DispatchGuard.createSObjectCheck(rcvr), next);
  } else {
    return read;
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:20,代码来源:MixinDefinition.java

示例4: initObjectAccessors

import som.vmobjects.SObject; //导入依赖的package包/类
private static AbstractObjectAccessor[] initObjectAccessors() {
  AbstractObjectAccessor[] accessors = new AbstractObjectAccessor[MAX_OBJECT_FIELDS];

  try {
    for (int i = 0; i < SObject.NUM_OBJECT_FIELDS; i += 1) {
      Field field = SMutableObject.class.getDeclaredField("field" + (i + 1));
      long offset = unsafe.objectFieldOffset(field);
      accessors[i] = new DirectObjectAccessor(offset);
    }
  } catch (NoSuchFieldException | SecurityException e) {
    throw new RuntimeException(e);
  }

  for (int i = SObject.NUM_OBJECT_FIELDS; i < MAX_OBJECT_FIELDS; i += 1) {
    accessors[i] = new ExtensionObjectAccessor(i);
  }
  return accessors;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:StorageAccessor.java

示例5: initPrimitiveAccessors

import som.vmobjects.SObject; //导入依赖的package包/类
private static AbstractPrimitiveAccessor[] initPrimitiveAccessors() {
  AbstractPrimitiveAccessor[] accessors = new AbstractPrimitiveAccessor[MAX_PRIM_FIELDS];

  try {
    for (int i = 0; i < SObject.NUM_PRIMITIVE_FIELDS; i += 1) {
      Field field = SMutableObject.class.getDeclaredField("primField" + (i + 1));
      long offset = unsafe.objectFieldOffset(field);
      accessors[i] = new DirectPrimitiveAccessor(offset, i);
    }
  } catch (NoSuchFieldException | SecurityException e) {
    throw new RuntimeException(e);
  }

  for (int i = SObject.NUM_PRIMITIVE_FIELDS; i < MAX_PRIM_FIELDS; i += 1) {
    accessors[i] = new ExtensionPrimitiveAccessor(i);
  }
  return accessors;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:StorageAccessor.java

示例6: read

import som.vmobjects.SObject; //导入依赖的package包/类
@Override
public SClass read(final SObject rcvr) {
  // here we need to synchronize, because this is actually something that
  // can happen concurrently, and we only want a single instance of the
  // class object
  Object cachedValue = read.read(rcvr);

  assert cachedValue != null;
  if (cachedValue != Nil.nilObject) {
    return (SClass) cachedValue;
  }

  synchronized (rcvr) {
    cachedValue = read.read(rcvr);

    // check whether cache is initialized with class object
    if (cachedValue == Nil.nilObject) {
      SClass classObject = instantiateClassObject(rcvr);
      write.doWrite(rcvr, classObject);
      return classObject;
    } else {
      assert cachedValue instanceof SClass;
      return (SClass) cachedValue;
    }
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:27,代码来源:ClassSlotAccessNode.java

示例7: doWrite

import som.vmobjects.SObject; //导入依赖的package包/类
@Override
public void doWrite(final SObject obj, final Object value) {
  if (value instanceof Long) {
    accessor.write(obj, (long) value);
    if (!accessor.isPrimitiveSet(obj, primMarkProfile)) {
      CompilerDirectives.transferToInterpreterAndInvalidate();
      accessor.markPrimAsSet(obj);

      // fall back to LongSlotWriteSetOrUnset
      replace(new LongSlotWriteSetOrUnset(slot, accessor, guard, nextInCache));
    }
  } else {
    TruffleCompiler.transferToInterpreterAndInvalidate("unstabelized write node");
    ObjectTransitionSafepoint.INSTANCE.writeAndGeneralizeSlot(obj, slot, value);
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:17,代码来源:CachedSlotWrite.java

示例8: write

import som.vmobjects.SObject; //导入依赖的package包/类
@Override
public Object write(final SObject obj, final Object value) {
  try {
    if (hasExpectedLayout(obj)) {
      storage.write(obj, value);
    } else {
      if (layout.layoutForSameClass(obj.getObjectLayout())) {
        writeAndRespecialize(obj, value, "update outdated read node", nextInCache);
      } else {
        nextInCache.write(obj, value);
      }
    }
  } catch (InvalidAssumptionException e) {
    replace(nextInCache).write(obj, value);
  }
  return value;
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:18,代码来源:FieldAccessorNode.java

示例9: doUncached

import som.vmobjects.SObject; //导入依赖的package包/类
@Specialization(replaces = "doCached")
public final SObject doUncached(final VirtualFrame frame, final SBlock loopCondition,
    final SBlock loopBody) {
  CompilerAsserts.neverPartOfCompilation("WhileCache.GenericDispatch"); // no caching, direct
                                                                        // invokes, no loop
                                                                        // count reporting...

  Object conditionResult = loopCondition.getMethod().invoke(new Object[] {loopCondition});

  // TODO: this is a simplification, we don't cover the case receiver isn't a boolean
  boolean loopConditionResult = obj2bool(conditionResult);

  // TODO: this is a simplification, we don't cover the case receiver isn't a boolean
  while (loopConditionResult == predicateBool) {
    loopBody.getMethod().invoke(new Object[] {loopBody});
    conditionResult = loopCondition.getMethod().invoke(new Object[] {loopCondition});
    loopConditionResult = obj2bool(conditionResult);
  }
  return Nil.nilObject;
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:21,代码来源:WhileCache.java

示例10: doWhileUnconditionally

import som.vmobjects.SObject; //导入依赖的package包/类
protected final SObject doWhileUnconditionally(final SBlock loopCondition,
    final SBlock loopBody) {
  long iterationCount = 0;

  boolean loopConditionResult =
      (boolean) conditionValueSend.call(new Object[] {loopCondition});

  try {
    // TODO: this is a simplification, we don't cover the case receiver isn't a boolean
    while (loopConditionResult == predicateBool) {
      bodyValueSend.call(new Object[] {loopBody});
      loopConditionResult = (boolean) conditionValueSend.call(new Object[] {loopCondition});

      if (CompilerDirectives.inInterpreter()) {
        iterationCount++;
      }
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      reportLoopCount(iterationCount);
    }
  }
  return Nil.nilObject;
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:25,代码来源:AbstractWhileNode.java

示例11: create

import som.vmobjects.SObject; //导入依赖的package包/类
public static DispatchGuard create(final Object obj) {
  if (obj == Boolean.TRUE) {
    return new CheckTrue();
  }

  if (obj == Boolean.FALSE) {
    return new CheckFalse();
  }

  if (obj instanceof SClass) {
    return new CheckSClass(((SClass) obj).getObjectLayout());
  }

  if (obj instanceof SObject) {
    return new CheckSObject(((SObject) obj).getObjectLayout());
  }

  return new CheckClass(obj.getClass());
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:20,代码来源:DispatchGuard.java

示例12: newMetaclassClass

import som.vmobjects.SObject; //导入依赖的package包/类
/**
 * Allocate the metaclass class.
 */
public static SClass newMetaclassClass(final SObject kernel) {
  SClass metaclassClass = new SClass(kernel);
  SClass metaclassClassClass = new SClass(kernel);
  metaclassClass.setClass(metaclassClassClass);

  metaclassClass.initializeClass(Symbols.METACLASS, null);
  metaclassClassClass.initializeClass(Symbols.METACLASS_CLASS, null);

  // Connect the metaclass hierarchy
  metaclassClass.getSOMClass().setClass(metaclassClass);
  return metaclassClass;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:16,代码来源:ObjectSystem.java

示例13: invoke

import som.vmobjects.SObject; //导入依赖的package包/类
@Override
public Object invoke(final IndirectCallNode call, final Object[] arguments) {
  VM.callerNeedsToBeOptimized(
      "call without proper call cache. Find better way if this is performance critical.");
  SObject rcvr = (SObject) arguments[0];
  rcvr.writeSlot(this, arguments[1]);
  return rcvr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:9,代码来源:MixinDefinition.java

示例14: getNumberOfNamedSlots

import som.vmobjects.SObject; //导入依赖的package包/类
public static int getNumberOfNamedSlots(final Object obj) {
  CompilerAsserts.neverPartOfCompilation();

  // think, only SObject has fields
  if (!(obj instanceof SObject)) {
    return 0;
  }

  SObject o = (SObject) obj;
  return o.getObjectLayout().getNumberOfFields();
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:12,代码来源:Types.java

示例15: transitionObject

import som.vmobjects.SObject; //导入依赖的package包/类
/**
 * Transition the given object to the latest layout.
 *
 * <p>
 * This method is racy, i.e., it can be called by multiple threads for the
 * same safepoint. It can be for multiple objects or the same.
 *
 * @param obj to be transitioned.
 */
public void transitionObject(final SObject obj) {
  waitForSafepointStart();

  // Safepoint phase, used to update the object
  // object is required to handle updates from multiple threads correctly
  obj.updateLayoutToMatchClass();

  replaceAssumptionAndWaitForSafepointEnd();
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:ObjectTransitionSafepoint.java


注:本文中的som.vmobjects.SObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。