本文整理汇总了C++中CodeGen::vmiSYS_CALL_ARGDAT方法的典型用法代码示例。如果您正苦于以下问题:C++ CodeGen::vmiSYS_CALL_ARGDAT方法的具体用法?C++ CodeGen::vmiSYS_CALL_ARGDAT怎么用?C++ CodeGen::vmiSYS_CALL_ARGDAT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGen
的用法示例。
在下文中一共展示了CodeGen::vmiSYS_CALL_ARGDAT方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sysClassConstructor
/*
classConstructor( key )( arg1, ..., argN ) -> instance
*/
Ref * sysClassConstructor( Ref * pc, MachineClass *vm ) {
if ( vm->count != 1 ) throw Ginger::Mishap( "Wrong number of arguments" );
Ref kk = vm->fastPeek();
if ( !IsObj( kk ) || *RefToPtr4( kk ) != sysClassKey ) throw Ginger::Mishap( "Key needed" );
Ref * obj_K = RefToPtr4( kk );
long n = SmallToLong( obj_K[ CLASS_OFFSET_NFIELDS ] );
CodeGen codegen = vm->codegen();
codegen->vmiFUNCTION( makeName( "new", obj_K[ CLASS_OFFSET_TITLE ]), n, 1 );
//vmiCHECK_COUNT( codegen, n );
codegen->vmiSYS_CALL_ARGDAT( sysargdatConstruct, kk, n );
codegen->vmiSYS_RETURN();
vm->fastPeek() = codegen->vmiENDFUNCTION();
return pc;
}
示例2: Mishap
/*
classAccessor( key, N:Small )( instance ) -> nth_field_of_instance
*/
Ref * sysClassAccessor( Ref * pc, MachineClass *vm ) {
if ( vm->count != 2 ) throw Ginger::Mishap( "Wrong number of arguments" );
Ref N = vm->fastPop();
if ( !IsSmall( N ) ) throw Ginger::Mishap( "Integer index needed" );
Ref kk = vm->fastPeek();
if ( !isKey( kk ) ) throw Ginger::Mishap( "Key needed" );
long nargs = SmallToLong( RefToPtr4( kk )[ CLASS_OFFSET_NFIELDS ] );
long index = SmallToLong( N );
if ( 1 <= index && index <= nargs ) {
CodeGen codegen = vm->codegen();
// TODO: Figure out name.
codegen->vmiFUNCTION( 1, 1 );
codegen->vmiSYS_CALL_ARGDAT( sysargdatAccess, kk, index );
codegen->vmiSYS_RETURN();
vm->fastPeek() = codegen->vmiENDFUNCTION();
} else {
throw Ginger::Mishap( "ToBeDone" );
}
return pc;
}