Example #1
0
  void VariableScope::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    VariableScope* vs = as<VariableScope>(obj);

    if(!vs->isolated()) {
      Object** ary = vs->stack_locals();

      if(Fiber* fib = try_as<Fiber>(vs->fiber())) {
        FiberData* data = fib->data();

        AddressDisplacement dis(data->data_offset(),
                                data->data_lower_bound(),
                                data->data_upper_bound());

        ary = dis.displace(ary);
      }

      size_t locals = vs->number_of_locals();

      for(size_t i = 0; i < locals; i++) {
        visit.call(ary[i]);
      }
    }
  }
Example #2
0
  void CompiledMethod::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    visit_inliners(obj, visit);

    CompiledMethod* cm = as<CompiledMethod>(obj);
    if(!cm->backend_method_) return;

    VMMethod* vmm = cm->backend_method_;

#ifdef ENABLE_LLVM
    if(cm->jit_data()) {
      cm->jit_data()->visit_all(visit);
    }

    for(int i = 0; i < VMMethod::cMaxSpecializations; i++) {
      if(vmm->specializations[i].jit_data) {
        vmm->specializations[i].jit_data->visit_all(visit);
      }
    }
#endif

    for(size_t i = 0; i < vmm->inline_cache_count(); i++) {
      InlineCache* cache = &vmm->caches[i];

      MethodCacheEntry* mce = cache->cache_;
      if(mce) visit.call(mce);

      for(int i = 0; i < cTrackedICHits; i++) {
        Module* mod = cache->seen_classes_[i].klass();
        if(mod) visit.call(mod);
      }
    }
  }
Example #3
0
  void VariableScope::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    VariableScope* vs = as<VariableScope>(obj);

    size_t locals = vs->number_of_locals();
    for(size_t i = 0; i < locals; i++) {
      visit.call(vs->get_local(i));
    }
  }
Example #4
0
  void VariableScope::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    VariableScope* vs = as<VariableScope>(obj);

    if(!vs->isolated()) {
      Object** ary = vs->stack_locals();
      size_t locals = vs->number_of_locals();

      for(size_t i = 0; i < locals; i++) {
        visit.call(ary[i]);
      }
    }
  }
Example #5
0
  void SendSite::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    SendSite* ss = as<SendSite>(obj);
    if(ss->inner_cache_) {
      SendSite::Internal* cache = ss->inner_cache_;
      if(cache->module) {
        visit.call(cache->module);
      }

      if(cache->method) {
        visit.call(cache->method);
      }

      if(cache->recv_class) {
        visit.call(cache->recv_class);
      }
    }
  }
Example #6
0
  void Regexp::Info::visit(Object* obj, ObjectVisitor& visit) {
    auto_visit(obj, visit);

    Regexp* reg_o = force_as<Regexp>(obj);
    regex_t* reg = reg_o->onig_data;

    if(!reg) return;

    ByteArray* reg_ba = ByteArray::from_body(reg);
    visit.call(reg_ba);

    if(reg->p) {
      ByteArray* ba = ByteArray::from_body(reg->p);
      visit.call(ba);
    }

    if(reg->exact) {
      ByteArray* ba = ByteArray::from_body(reg->exact);
      visit.call(ba);
    }

    if(reg->int_map) {
      ByteArray* ba = ByteArray::from_body(reg->int_map);
      visit.call(ba);
    }

    if(reg->int_map_backward) {
      ByteArray* ba = ByteArray::from_body(reg->int_map_backward);
      visit.call(ba);
    }

    if(reg->repeat_range) {
      ByteArray* ba = ByteArray::from_body(reg->repeat_range);
      visit.call(ba);
    }
  }
Example #7
0
 void Executable::Info::visit(Object* obj, ObjectVisitor& visit) {
   auto_visit(obj, visit);
   visit_inliners(obj, visit);
 }
Example #8
0
 /* By default, just call auto_mark(). This exists so that
  * other types can overload this to perform work before or
  * after auto_marking is done. */
 void TypeInfo::visit(Object* obj, ObjectVisitor& visit) {
   auto_visit(obj, visit);
 }