Beispiel #1
0
mword *bpdl_dnumber_to_bstruct(bvm_cache *this_bvm, mword *entry){ // bpdl_dnumber_to_bstruct#

#ifdef BPDL_TRACE
_trace;
#endif

    mword is_negative = 0;

    if(rcl(entry,0) == '-'){ // Negative number
        is_negative = 1;
    }

    if(!is_negative){

        char *str = (char*)_ar2str( this_bvm, entry );

        return _val(this_bvm, (mword)atoi((char*)str));

    }
    else{

        char *str = (char*)_ar2str( this_bvm, entry );

        return _val(this_bvm, (mword)(-1*atoi((char*)(str+1))));

    }

    return 0; // Silence compiler warning

}
Beispiel #2
0
mword *bpdl_hnumber_to_bstruct(bvm_cache *this_bvm, mword *entry){ // bpdl_hnumber_to_bstruct#

#ifdef BPDL_TRACE
_trace;
#endif

    char *str = (char*)_ar2str( this_bvm, entry );

    return _val(this_bvm, (mword)strtoul((char*)(str+2),NULL,16));

}
Beispiel #3
0
// Add with carry
//
mword *_addc(bvm_cache *this_bvm, mword a, mword b, mword carry_in){

    mword sum = a + b + carry_in;
    mword *result;

    if(sum < a){
        result = _newlfi(this_bvm, 2, 0);
        lcl(result,0) = (mword)sum;
        lcl(result,1) = 1; // carry bit
    }
    else{
        result = _val(this_bvm, (mword)sum);
    }

    return result;

}
    void operation(CORBA::Long a, const prueba::Iface::FloatSeq& fs)
    {
        /*PROTECTED REGION ID(prueba_Iface_impl::prueba_Iface_operation___pre) ENABLED START*/
        /*PROTECTED REGION END*/

        _corbasim_prueba::Iface::operation _val(a, fs);

        try {
            if (!CORBA::is_nil(__m_reference))
__m_reference->operation(_val.a, _val.fs);
        } catch(...) {
            std::cerr << "CORBA exception!" << std::endl;
        }

        /*PROTECTED REGION ID(prueba_Iface_impl::prueba_Iface_operation___post) ENABLED START*/
        /*PROTECTED REGION END*/

        std::cout << "<operation" << std::endl;

    }
Beispiel #5
0
mword *_babel(bvm_cache *this_bvm, mword *loaded_bvm, mword *arg_stack, mword *sym_table){ // _babel#

    bvm_cache new_bvm;
    bvm_cache *new_bvm_ptr = &new_bvm;
    mword *result = nil;

    cache_new(this_bvm, new_bvm_ptr, loaded_bvm);

    mword *self = tptr_detag(new_bvm_ptr, tptr_detag(new_bvm_ptr, new_bvm_ptr->self)); // Could blow up due to mem_alloc()

    if( !trie_exists(new_bvm_ptr, self, BABEL_SYM_BVM_INITD, nil) ){
        trie_insert( new_bvm_ptr, self, BABEL_SYM_BVM_INITD, nil, _val(new_bvm_ptr,1) );
//        trie_insert( new_bvm_ptr, self, BABEL_SYM_BVM_INITD, nil, _val(new_bvm_ptr,0) );
    }

    mword *bvm_initd = rci(cache_read_from_bvm(new_bvm_ptr, BABEL_SYM_BVM_INITD),0);

    if(!rcl(bvm_initd,0)){
        bvm_new(new_bvm_ptr);
        lcl(bvm_initd,0) = 1;
    }
    else{
        cache_update(new_bvm_ptr);
    }

    if( !trie_exists(new_bvm_ptr, self, BABEL_SYM_CODE_RESTART_POINT, nil) ){
        trie_insert( new_bvm_ptr, self, BABEL_SYM_CODE_RESTART_POINT, nil, rci(new_bvm_ptr->code_ptr,0));
    }

    new_bvm_ptr->flags->BVM_CACHE_DIRTY   = FLAG_CLR;
    new_bvm_ptr->flags->BVM_CACHE_INVALID = FLAG_CLR;

    cache_flush(this_bvm);

    if(!is_nil(sym_table)){
        trie_insert(new_bvm_ptr, tptr_detag(new_bvm_ptr, new_bvm_ptr->self), BABEL_SYM_SOFT_ROOT, nil, sym_table);
    }

    trie_insert(new_bvm_ptr, tptr_detag(new_bvm_ptr, new_bvm_ptr->self), BABEL_SYM_PARENT_BVM, nil, this_bvm->self);

    new_bvm_ptr->flags->BVM_CODE_LIST_EMPTY = FLAG_CLR;

    while(!is_nil(arg_stack)){ // give the arg-list onto the BVM's dstack
        interp_push_operand(new_bvm_ptr, rci(arg_stack, 0));
        arg_stack = rci(arg_stack,1);
    }

    interp_core(new_bvm_ptr);

    cache_cp(new_bvm_ptr, this_bvm); //update flags and interp

    this_bvm->self = _ith(  this_bvm, 
                            trie_lookup_hash(
                                new_bvm_ptr, 
                                tptr_detag(new_bvm_ptr, new_bvm_ptr->self), 
                                BABEL_SYM_PARENT_BVM, 
                                nil),
                            2 );

    cache_update(this_bvm);

    this_bvm->flags->BVM_CACHE_DIRTY   = FLAG_CLR;
    this_bvm->flags->BVM_CACHE_INVALID = FLAG_CLR;

    //copy TOS from new_bvm to this_bvm
    oinfo oi;
    oi.default_data = nil;
    oi.required_tag = nil;
    oi.mask = OI_MASK_ANY;
    oi.min_size = 0;
    oi.max_size = 1;

    if( new_bvm_ptr->flags->BVM_RETURN_TOS_ON_EXIT == FLAG_SET 
            &&
        (new_bvm_ptr->flags->BVM_CODE_LIST_EMPTY == FLAG_SET 
            ||
        (get_advance_type(new_bvm_ptr) == BVM_RETURN))){

        get_operands(new_bvm_ptr,1,&oi);
        result = oi.data;

        stack_pop(new_bvm_ptr,rci(new_bvm_ptr->dstack_ptr,0));

//        stack_push(this_bvm,
//                rci(this_bvm->dstack_ptr,0),
//                stack_new_entry(
//                    this_bvm,
//                    oi.data,
//                    nil));

    }

    // Reset all flags in case of re-entry
    new_bvm_ptr->flags->BVM_RETURN_TOS_ON_EXIT = FLAG_CLR; // FIXME: This restore to previous value, not force-clear
    new_bvm_ptr->flags->BVM_CODE_LIST_EMPTY = FLAG_CLR;

    if(get_advance_type(new_bvm_ptr) == BVM_RETURN){
        set_advance_type(new_bvm_ptr, BVM_ADVANCE);
    }

    this_bvm->flags->BVM_RETURN_TOS_ON_EXIT = FLAG_CLR;
    this_bvm->flags->BVM_CODE_LIST_EMPTY    = FLAG_CLR;

    return result;

}
Beispiel #6
0
			_RetType operator ()(){ return _val(); }
Beispiel #7
0
			operator _T(){ return _val(); }