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


C++ Object_p::my_heap方法代码示例

本文整理汇总了C++中Object_p::my_heap方法的典型用法代码示例。如果您正苦于以下问题:C++ Object_p::my_heap方法的具体用法?C++ Object_p::my_heap怎么用?C++ Object_p::my_heap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Object_p的用法示例。


在下文中一共展示了Object_p::my_heap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copy_elements

void Execution_Tracer::copy_elements(int src_offset, void* dst, int dst_offset, int num_elems, Object_p dst_obj) {
  lprintf( "copy_elements src_offset %d, buffer 0x%x, dst 0x%x, dst_offset %d, num_elems %d, dst_obj 0x%x, next %d\n",
          src_offset, buffer, dst, dst_offset, num_elems, (Object*)dst_obj, next);



  Oop* dst_oop = (Oop*)dst  +  dst_offset * e_N;
  // zero-fill for GC sake
  for (int i = 0;  i < num_elems;  ++i)
    for (int j = 0;  j < e_N;  ++j)
      dst_oop[i * e_N  +  j] = Oop::from_int(0);

  for (int i = 0;  i < num_elems;  ++i, dst_oop += e_N) {
    bc* bcp = (bc*)entry_ptr(i);  gc* gcp = (gc*)bcp;  proc* procp = (proc*)bcp; rcved_interp* rip = (rcved_interp*)bcp; aux* auxp = (aux*)bcp;
    dst_oop[e_kind] = Oop::from_int(bcp->kind);
    switch (bcp->kind) {
      default: fatal(); break;
      case k_aux: {
        dst_oop[e_id      ] = Oop::from_int(auxp->id);
        dst_oop[e_aux1    ] = Oop::from_int(auxp->aux1);
        dst_oop[e_aux2    ] = Oop::from_int(auxp->aux2);
        dst_oop[e_rank    ] = Oop::from_int(auxp->rank);
      }
        break;
      case k_bc: {
        dst_oop[e_method  ] = bcp->method;  Object_p mo = dst_oop[e_method].as_object();
        dst_oop[e_rcvr    ] = bcp->rcvr;

        dst_oop[e_rank    ] = Oop::from_int(bcp->rank);
        dst_oop[e_bcCount ] = Oop::from_int(bcp->bcCount);
        dst_oop[e_pc      ] = Oop::from_int(bcp->pc  -  (mo->first_byte_address() - mo->as_char_p()));
        dst_oop[e_aux1    ] = Oop::from_int(bcp->aux1);
        dst_oop[e_aux2    ] = Oop::from_int(bcp->aux2);
        dst_oop[e_is_block] = bcp->is_block ? The_Squeak_Interpreter()->roots.trueObj : The_Squeak_Interpreter()->roots.falseObj;

        assert_always(dst_oop[e_method ].is_mem());
        assert_always(dst_oop[e_pc  ].is_int());
        assert_always(dst_oop[e_rank].is_int());
        assert_always(dst_oop[e_is_block] == The_Squeak_Interpreter()->roots.trueObj  ||  dst_oop[e_is_block] == The_Squeak_Interpreter()->roots.falseObj);
        assert_always( (int(dst_oop) - int(dst_obj) - Object::BaseHeaderSize) % e_N  == 0 );
      }
        break;
      case k_gc:
        dst_oop[e_gc  ] = Oop::from_int(gcp->gc);
        dst_oop[e_rank] = Oop::from_int(gcp->rank);
        break;
      case k_proc:
        dst_oop[e_rank]     = Oop::from_int(procp->rank);
        dst_oop[e_process ] = procp->process;
        break;
      case k_rcved_interp:
        dst_oop[e_rank] = Oop::from_int(rip->to_rank);
        break;
    }
  }
  dst_obj->my_heap()->check_multiple_stores_for_generations_only(dst_oop, num_elems * e_N);
}
开发者ID:,项目名称:,代码行数:57,代码来源:


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