Esempio n. 1
0
void cgInitStaticLoc(IRLS& env, const IRInstruction* inst) {
  auto const extra = inst->extra<InitStaticLoc>();
  auto const link = rds::bindStaticLocal(extra->func, extra->name);
  auto& v = vmain(env);

  // Initialize the RefData by storing the new value into it's TypedValue and
  // incrementing the RefData reference count (which will set it to 1).
  auto mem = rvmtl()[link.handle() + rds::StaticLocalData::ref_offset()];
  storeTV(v, mem + RefData::tvOffset(), srcLoc(env, inst, 0), inst->src(0));
  emitStoreRefCount(v, OneReference, mem);
  v << storebi{uint8_t(HeaderKind::Ref), mem + (int)HeaderKindOffset};
  markRDSHandleInitialized(v, link.handle());

  static_assert(sizeof(HeaderKind) == 1, "");
}
Esempio n. 2
0
void cgInitClsCns(IRLS& env, const IRInstruction* inst) {
  auto const extra = inst->extra<InitClsCns>();
  auto const link = rds::bindClassConstant(extra->clsName, extra->cnsName);
  auto& v = vmain(env);

  auto const args = argGroup(env, inst)
    .addr(rvmtl(), safe_cast<int32_t>(link.handle()))
    .immPtr(NamedEntity::get(extra->clsName))
    .immPtr(extra->clsName)
    .immPtr(extra->cnsName);

  cgCallHelper(v, env, CallSpec::direct(lookupClsCnsHelper),
               callDestTV(env, inst), SyncOptions::Sync, args);

  markRDSHandleInitialized(v, link.handle());
}
Esempio n. 3
0
void cgMarkRDSInitialized(IRLS& env, const IRInstruction* inst) {
  auto const handle = inst->extra<MarkRDSInitialized>()->handle;
  if (rds::isNormalHandle(handle)) markRDSHandleInitialized(vmain(env), handle);
}