UniformSizeBroker_p UniformSizeBroker::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return UniformSizeBroker_p( static_cast<UniformSizeBroker*>(pObject.rawPtr()) ); return 0; }
TimeFormatter_p TimeFormatter::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return TimeFormatter_p( static_cast<TimeFormatter*>(pObject.rawPtr()) ); return 0; }
Font_p Font::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Font_p( static_cast<Font*>(pObject.rawPtr()) ); return 0; }
SimpleVolumeMeter_p SimpleVolumeMeter::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return SimpleVolumeMeter_p( static_cast<SimpleVolumeMeter*>(pObject.rawPtr()) ); return 0; }
ScalePreferredSizeBroker_p ScalePreferredSizeBroker::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return ScalePreferredSizeBroker_p( static_cast<ScalePreferredSizeBroker*>(pObject.rawPtr()) ); return 0; }
BitmapGlyphs_p BitmapGlyphs::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return BitmapGlyphs_p( static_cast<BitmapGlyphs*>(pObject.rawPtr()) ); return 0; }
StandardPresenter_p StandardPresenter::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return StandardPresenter_p( static_cast<StandardPresenter*>(pObject.rawPtr()) ); return 0; }
TestWidget_p TestWidget::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return TestWidget_p( static_cast<TestWidget*>(pObject.rawPtr()) ); return 0; }
Panel_p Panel::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Panel_p( static_cast<Panel*>(pObject.rawPtr()) ); return 0; }
SurfaceFactory_p SurfaceFactory::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return SurfaceFactory_p( static_cast<SurfaceFactory*>(pObject.rawPtr()) ); return 0; }
Capsule_p Capsule::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Capsule_p( static_cast<Capsule*>(pObject.rawPtr()) ); return 0; }
Container_p Container::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Container_p( static_cast<Container*>(pObject.rawPtr()) ); return 0; }
ModalLayer_p ModalLayer::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return ModalLayer_p( static_cast<ModalLayer*>(pObject.rawPtr()) ); return 0; }
TextEditor_p TextEditor::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return TextEditor_p( static_cast<TextEditor*>(pObject.rawPtr()) ); return 0; }
ColorSkin_p ColorSkin::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return ColorSkin_p( static_cast<ColorSkin*>(pObject.rawPtr()) ); return 0; }
Menubar_p Menubar::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Menubar_p( static_cast<Menubar*>(pObject.rawPtr()) ); return 0; }
ValueDisplay_p ValueDisplay::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return ValueDisplay_p( static_cast<ValueDisplay*>(pObject.rawPtr()) ); return 0; }
Knob_p Knob::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Knob_p( static_cast<Knob*>(pObject.rawPtr()) ); return 0; }
Button_p Button::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Button_p( static_cast<Button*>(pObject.rawPtr()) ); return 0; }
InputHandler_p InputHandler::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return InputHandler_p( static_cast<InputHandler*>(pObject.rawPtr()) ); return 0; }
MsgFunc_p MsgFunc::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return MsgFunc_p( static_cast<MsgFunc*>(pObject.rawPtr()) ); return 0; }
Image_p Image::cast( const Object_p& pObject ) { if( pObject && pObject->isInstanceOf(CLASSNAME) ) return Image_p( static_cast<Image*>(pObject.rawPtr()) ); return 0; }
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); }
void Execution_Tracer::check_it(Oop ents) { Object_p eo = ents.as_object(); int wl = eo->fetchWordLength(); int n = wl / e_N; for (int i = 0; i < n; ++i) { int x = -1; Oop rank = eo->fetchPointer(x = i * e_N + e_rank); assert_always( rank.is_int()); switch (eo->fetchPointer(i * e_N + e_kind).integerValue()) { default: fatal(); case k_bc: { Oop meth = eo->fetchPointer(x = i * e_N + e_method); assert_always(meth.is_mem()); Oop rcvr = eo->fetchPointer(x = i * e_N + e_rcvr); Oop pc = eo->fetchPointer(x = i * e_N + e_pc ); assert_always(pc.is_int()); Oop is_block = eo->fetchPointer(x = i * e_N + e_is_block); assert_always(is_block == The_Squeak_Interpreter()->roots.trueObj || is_block == The_Squeak_Interpreter()->roots.falseObj); break; } case k_gc: { Oop gc = eo->fetchPointer(x = i * e_N + e_gc ); assert_always(gc.is_int()); } break; case k_proc: { Oop process = eo->fetchPointer(x = i * e_N + e_process); assert_always(process.is_mem()); } break; case k_rcved_interp: break; case k_aux: break; } } }
RouteId MsgRouter::_addRoute( const Object_p& pSource, Route * pRoute ) { if( !pSource ) return 0; Chain<Route>& chain = m_sourceRoutes[pSource.rawPtr()]; chain.pushBack(pRoute); pRoute->m_handle = m_routeCounter++; return pRoute->m_handle; }
int MsgRouter::deleteRoutesFrom( const Object_p& pSource ) { auto it = m_sourceRoutes.find(Object_wp(pSource.rawPtr()) ); if( it == m_sourceRoutes.end() ) return 0; int nDeleted = it->second.size(); m_sourceRoutes.erase(it); return nDeleted; }
void Execution_Tracer::print_entries(Oop ents, Printer* p) { Object_p eo = ents.as_object(); int n = eo->fetchWordLength() / e_N; int x; for (int i = 0; i < n; ++i) { int rank = eo->fetchPointer(x = i * e_N + e_rank).integerValue(); p->printf("%3d on %2d: ", i - n, rank); switch (eo->fetchPointer(i * e_N + e_kind).integerValue()) { default: fatal(); break; case k_proc: { Oop process = eo->fetchPointer(i * e_N + e_process); assert(process.is_mem()); p->printf("switch to process 0x%x", process.as_untracked_object_ptr()); } break; case k_aux: { int rank = eo->fetchPointer(i * e_N + e_rank).integerValue(); int aux1 = eo->fetchPointer(i * e_N + e_aux1).integerValue(); //int aux2 = eo->fetchPointer(i * e_N + e_aux2).integerValue(); int id = eo->fetchPointer(i * e_N + e_id ).integerValue(); // p->printf("on %d: aux1 0x%x aux2 0x%x id %d", rank, aux1, aux2, id); p->printf("on %d: aux1 %s id %d", rank, aux1, id); } break; case k_gc: p->printf("gc: %d", eo->fetchPointer(i * e_N + e_gc).integerValue()); break; case k_rcved_interp: p->printf("received interp"); break; case k_bc: { Oop meth = eo->fetchPointer(i * e_N + e_method); assert(meth.is_mem()); Oop rcvr = eo->fetchPointer(i * e_N + e_rcvr); int pc = eo->fetchPointer(i * e_N + e_pc ).integerValue(); bool is_block = eo->fetchPointer(i * e_N + e_is_block) == The_Squeak_Interpreter()->roots.trueObj; int aux1 = eo->fetchPointer(i * e_N + e_aux1).integerValue(); int aux2 = eo->fetchPointer(i * e_N + e_aux2).integerValue(); Oop klass = rcvr.fetchClass(); Oop sel, mclass; bool have_sel_and_mclass = klass.as_object()->selector_and_class_of_method_in_me_or_ancestors(meth, &sel, &mclass); if (!have_sel_and_mclass) continue; if (mclass == The_Squeak_Interpreter()->roots.nilObj) mclass = rcvr.fetchClass(); p->printf("rcvr: "); rcvr.print(p); if (mclass != klass) { p->printf("("); bool is_meta; Oop mclassName = mclass.as_object()->name_of_class_or_metaclass(&is_meta); if (is_meta) p->printf("class "); mclassName.as_object()->print_bytes(p); p->printf(")"); } p->printf(" >> "); sel.as_object()->print_bytes(p); p->printf(is_block ? " [] " : " "); p->printf(", pc: %d, ", pc); Object_p mo = meth.as_object(); u_char bc = mo->first_byte_address()[pc]; The_Squeak_Interpreter()->printBC(bc, p); p->printf(", bcCount %d", eo->fetchPointer(i * e_N + e_bcCount).integerValue()); if (aux1) p->printf(", aux1 = 0x%x", aux1); if (aux1) p->printf(", aux1 = 0x%x", aux2); } break; } p->nl(); } }