Ticket #150: loadbytecode.patch

File loadbytecode.patch, 1.8 KB (added by NotFound, 12 years ago)

Load bytecode and dynpmc libs in 'parrot' HLL context

  • src/dynext.c

     
    428428    void (*init_func)(PARROT_INTERP, PMC *); 
    429429    PMC *lib_pmc; 
    430430 
     431    INTVAL regs_used[] = { 2, 2, 2, 2 }; /* Arbitrary values */ 
     432    const int parrot_hll_id = 0; 
     433    PMC * context = Parrot_push_context(interp, regs_used); 
     434    Parrot_pcc_set_HLL(interp, context, parrot_hll_id); 
     435    Parrot_pcc_set_namespace(interp, context, 
     436            Parrot_get_HLL_namespace(interp, parrot_hll_id)); 
     437 
    431438    /* 
    432439     * work around gcc 3.3.3 and other problem with dynpmcs 
    433440     * something during library loading doesn't stand a GC run 
     
    475482    /* UNLOCK */ 
    476483    Parrot_unblock_GC_mark(interp); 
    477484 
     485    Parrot_pop_context(interp); 
     486 
    478487    return lib_pmc; 
    479488} 
    480489 
  • src/packfile.c

     
    47114711    ASSERT_ARGS(compile_or_load_file) 
    47124712    char * const filename = Parrot_str_to_cstring(interp, path); 
    47134713 
     4714    INTVAL regs_used[] = { 2, 2, 2, 2 }; /* Arbitrary values */ 
     4715    const int parrot_hll_id = 0; 
     4716    PMC * context = Parrot_push_context(interp, regs_used); 
     4717    Parrot_pcc_set_HLL(interp, context, parrot_hll_id); 
     4718    Parrot_pcc_set_namespace(interp, context, 
     4719            Parrot_get_HLL_namespace(interp, parrot_hll_id)); 
     4720 
    47144721    if (file_type == PARROT_RUNTIME_FT_PBC) { 
    47154722        PackFile * const pf = PackFile_append_pbc(interp, filename); 
    47164723        Parrot_str_free_cstring(filename); 
     
    47384745            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR, 
    47394746                "compiler returned NULL ByteCode '%Ss' - %Ss", path, err); 
    47404747    } 
     4748 
     4749    Parrot_pop_context(interp); 
    47414750} 
    47424751 
    47434752/*