void x87_fwait( struct x86_function *p ) { DUMP(); emit_1ub(p, 0x9b); }
void write_points(const char *fname, DATA *d, DPOINT *where, double *est, int n_outfl) { static FILE *f = NULL; #ifdef HAVE_LIBGIS static Site *site = NULL; static int dim = 2; int i; #endif if (! grass()) { if (where == NULL) { if (fname != NULL) { f = efopen(fname, "w"); write_ascii_header(f, d, n_outfl); } else efclose(f); } else { if (f == NULL) ErrMsg(ER_NULL, "write_points(): f"); output_line(f, d, where, est, n_outfl); } } else { #ifdef HAVE_LIBGIS if (where == NULL) { if (fname != NULL) { /* initialize: */ DUMP("opening grass sites list\n"); if (d->mode & Z_BIT_SET) dim++; if ((f = G_sites_open_new((char *) fname)) == NULL) G_fatal_error("%s: cannot open sites file %f for writing\n", G_program_name()); site = G_site_new_struct(CELL_TYPE, dim, 0, n_outfl); } else { /* close: */ DUMP("closing grass sites list\n"); fclose(f); dim = 2; G_site_free_struct(site); site = NULL; } } else { assert(site != NULL); assert(d != NULL); /* fill site: */ site->east = where->x; site->north = where->y; if (d->mode & Z_BIT_SET) site->dim[0] = where->z; if (d->mode & S_BIT_SET) site->ccat = where->u.stratum + strata_min; else site->ccat = GET_INDEX(where) + 1; for (i = 0; i < n_outfl; i++) { if (is_mv_double(&(est[i]))) { site->dbl_att[i] = -9999.0; if (DEBUG_DUMP) printlog(" [%d]:mv ", i); } else { site->dbl_att[i] = est[i]; if (DEBUG_DUMP) printlog(" value[%d]: %g ", i, site->dbl_att[i]); } } if (DEBUG_DUMP) printlog("\n"); G_site_put(f, site); } #else ErrMsg(ER_IMPOSVAL, "gstat/grass error: libgis() not linked"); #endif } }
void __attribute__((__no_instrument_function__)) __cyg_profile_func_exit(void *this_func, void *call_site) { DUMP(this_func, call_site); }
CAMLprim value caml_dump_r(CAML_R, value string){ DUMP("%s", String_val(string)); return Val_unit; }
NS_IMETHODIMP nsStatusReporterManager::DumpReports() { static unsigned number = 1; nsresult rv; nsCString filename("status-reports-"); filename.AppendInt(getpid()); filename.Append('-'); filename.AppendInt(number++); filename.AppendLiteral(".json"); // Open a file in NS_OS_TEMP_DIR for writing. // The file is initialized as "incomplete-status-reports-pid-number.json" in the // begining, it will be rename as "status-reports-pid-number.json" in the end. nsCOMPtr<nsIFile> tmpFile; rv = nsDumpUtils::OpenTempFile(NS_LITERAL_CSTRING("incomplete-") + filename, getter_AddRefs(tmpFile), NS_LITERAL_CSTRING("status-reports")); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } nsCOMPtr<nsIFileOutputStream> ostream = do_CreateInstance("@mozilla.org/network/file-output-stream;1"); rv = ostream->Init(tmpFile, -1, -1, 0); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } //Write the reports to the file DUMP(ostream, "{\n\"subject\":\"about:service reports\",\n"); DUMP(ostream, "\"reporters\": [ "); nsCOMPtr<nsISimpleEnumerator> e; bool more, first = true; EnumerateReporters(getter_AddRefs(e)); while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) { nsCOMPtr<nsISupports> supports; e->GetNext(getter_AddRefs(supports)); nsCOMPtr<nsIStatusReporter> r = do_QueryInterface(supports); nsCString process; rv = r->GetProcess(process); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } nsCString name; rv = r->GetName(name); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } nsCString description; rv = r->GetDescription(description); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } if (first) { first = false; } else { DUMP(ostream, ","); } rv = DumpReport(ostream, process, name, description); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } } DUMP(ostream, "\n]\n}\n"); rv = ostream->Close(); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // Rename the status reports file nsCOMPtr<nsIFile> srFinalFile; rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(srFinalFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } #ifdef ANDROID rv = srFinalFile->AppendNative(NS_LITERAL_CSTRING("status-reports")); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } #endif rv = srFinalFile->AppendNative(filename); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } rv = srFinalFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } nsAutoString srActualFinalFilename; rv = srFinalFile->GetLeafName(srActualFinalFilename); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } rv = tmpFile->MoveTo(/* directory */ nullptr, srActualFinalFilename); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } return NS_OK; }
ZIX_API ZixStatus zix_tree_insert(ZixTree* t, void* e, ZixTreeIter** ti) { DEBUG_PRINTF("**** INSERT %ld\n", (intptr_t)e); int cmp = 0; ZixTreeNode* n = t->root; ZixTreeNode* p = NULL; // Find the parent p of e while (n) { p = n; cmp = t->cmp(e, n->data, t->cmp_data); if (cmp < 0) { n = n->left; } else if (cmp > 0) { n = n->right; } else if (t->allow_duplicates) { n = n->right; } else { if (ti) { *ti = n; } DEBUG_PRINTF("%ld EXISTS!\n", (intptr_t)e); return ZIX_STATUS_EXISTS; } } // Allocate a new node n if (!(n = (ZixTreeNode*)malloc(sizeof(ZixTreeNode)))) { return ZIX_STATUS_NO_MEM; } memset(n, '\0', sizeof(ZixTreeNode)); n->data = e; n->balance = 0; if (ti) { *ti = n; } bool p_height_increased = false; // Make p the parent of n n->parent = p; if (!p) { t->root = n; } else { if (cmp < 0) { assert(!p->left); assert(p->balance == 0 || p->balance == 1); p->left = n; --p->balance; p_height_increased = !p->right; } else { assert(!p->right); assert(p->balance == 0 || p->balance == -1); p->right = n; ++p->balance; p_height_increased = !p->left; } } DUMP(t); // Rebalance if necessary (at most 1 rotation) assert(!p || p->balance == -1 || p->balance == 0 || p->balance == 1); if (p && p_height_increased) { int height_change = 0; for (ZixTreeNode* i = p; i && i->parent; i = i->parent) { if (i == i->parent->left) { if (--i->parent->balance == -2) { zix_tree_rebalance(t, i->parent, &height_change); break; } } else { assert(i == i->parent->right); if (++i->parent->balance == 2) { zix_tree_rebalance(t, i->parent, &height_change); break; } } if (i->parent->balance == 0) { break; } } } DUMP(t); ++t->size; #ifdef ZIX_TREE_VERIFY if (!verify(t, t->root)) { return ZIX_STATUS_ERROR; } #endif return ZIX_STATUS_SUCCESS; }
/* Return 0 on success and non-zero on failure. */ static int caml_deserialize_and_run_in_this_thread(caml_global_context *parent_context, char *blob, int index, sem_t *semaphore, /*out*/caml_global_context **to_context) { #ifdef HAS_MULTICONTEXT /* Make a new empty context, and use it to deserialize the blob into. */ CAML_R = caml_make_empty_context(); // ctx also becomes the thread-local context //DUMPROOTS("splitting: from new thread"); CAMLparam0(); CAMLlocal1(function); //FDUMPROOTS("splitting: from new thread after GC-protecting locals"); int did_we_fail; caml_initialize_context_thread_support_r(ctx); ctx->caml_start_code = parent_context->caml_start_code; ctx->caml_code_size = parent_context->caml_code_size; ctx->caml_saved_code = parent_context->caml_saved_code; #ifdef THREADED_CODE ctx->caml_instr_table = parent_context->caml_instr_table; ctx->caml_instr_base = parent_context->caml_instr_base; #endif // #ifdef THREADED_CODE #ifndef NATIVE_CODE DUMP(); caml_init_code_fragments_r(ctx); // this is needed for caml_install_globals_and_data_as_c_byte_array_r DUMP(); ctx->caml_prim_table = parent_context->caml_prim_table; ctx->caml_prim_name_table = parent_context->caml_prim_name_table; #endif // #ifdef THREADED_CODE *to_context = ctx; caml_install_globals_and_data_as_c_byte_array_r(ctx, blob, &function); DUMP("Done with the blob: index=%i\n", index); /* /\* We're done with the blob: unpin it via the semaphore, so that it */ /* can be destroyed when all split threads have deserialized. *\/ */ /* //fprintf(stderr, "W5.5context %p] [thread %p] (index %i) EEEEEEEEEEEEEEEEEEEEEEEEEE\n", ctx, (void*)(pthread_self()), index); fflush(stderr); caml_release_global_lock(); */ /* DUMP("About to V the semaphore. index=%i\n", index); */ /* sem_post(semaphore); */ #ifndef NATIVE_CODE DUMP(); caml_init_exceptions_r(ctx); DUMP(); //caml_debugger_r(ctx, PROGRAM_START); #endif // #ifndef NATIVE_CODE DUMP(); ctx->caml_exe_name = parent_context->caml_exe_name; ctx->caml_main_argv = parent_context->caml_main_argv; DUMP(); /* We're done with the blob: unpin it via the semaphore, so that it can be destroyed when all split threads have deserialized. */ //fprintf(stderr, "W5.5context %p] [thread %p] (index %i) EEEEEEEEEEEEEEEEEEEEEEEEEE\n", ctx, (void*)(pthread_self()), index); fflush(stderr); caml_release_global_lock(); //SLEEP("before V'ing the semaphore.", 3); DUMP("About to V the semaphore. index=%i\n", index); //int sem_post_result = sem_post(semaphore); //assert(sem_post_result == 0); caml_v_semaphore(semaphore); /* Now do the actual work, in a function which correctly GC-protects its locals: */ did_we_fail = caml_run_function_this_thread_r(ctx, function, index); DUMP("$$$$$$$$$$$$$$$ ran the Caml code in a child context"); if(did_we_fail){ //DUMP("the Caml code failed"); // !!!!!!!!!!!!!!!!!!!!!!!!!!! What shall we do in this case? //volatile int a = 1; a /= 0; /*die horribly*/ DUMP("the Caml code failed"); assert(0); // What shall we do in this case? } /* One less user for this context; the main thread is done: */ caml_unpin_context_r(ctx); CAMLreturnT(int, did_we_fail); /* /\* We're done. But we can't destroy the context yet, until it's */ /* joined: the object must remain visibile to the OCaml code, and */ /* for accessing the pthread_t objecet from the C join code. *\/ */ /* CAMLreturnT(int, did_we_fail); */ #endif // #ifdef HAS_MULTICONTEXT assert(0); // this must be unreachable if multi-context is disabled }
void x87_fscale( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xfd); }
void x87_fsincos( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xfb); }
void x87_fchs( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xe0); }
void x87_fprndint( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xfc); }
void x87_fabs( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xe1); }
void x87_ftst( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xe4); }
void x87_fnclex( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xdb, 0xe2); }
int nsComponentsDlg::Show(int aDirection) { int err = OK; int customSTIndex = 0, i; int numRows = 0; int currRow = 0; GtkWidget *hbox = NULL; XI_VERIFY(gCtx); XI_VERIFY(gCtx->notebook); if (mWidgetsInit == FALSE) { customSTIndex = gCtx->sdlg->GetNumSetupTypes(); sCustomST = gCtx->sdlg->GetSetupTypeList(); for (i=1; i<customSTIndex; i++) sCustomST = sCustomST->GetNext(); DUMP(sCustomST->GetDescShort()); // create a new table and add it as a page of the notebook mTable = gtk_table_new(5, 1, FALSE); gtk_notebook_append_page(GTK_NOTEBOOK(gCtx->notebook), mTable, NULL); mPageNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(gCtx->notebook)); gtk_widget_show(mTable); // 1st row: a label (msg0) // insert a static text widget in the first row GtkWidget *msg0 = gtk_label_new(mMsg0); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), msg0, FALSE, FALSE, 0); gtk_widget_show(hbox); gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 1, 2, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), GTK_FILL, 20, 20); gtk_widget_show(msg0); // 2nd row: a CList with a check box for each row (short desc) GtkWidget *list = NULL; GtkWidget *scrollwin = NULL; GtkStyle *style = NULL; GdkBitmap *ch_mask = NULL; GdkPixmap *checked = NULL; GdkBitmap *un_mask = NULL; GdkPixmap *unchecked = NULL; gchar *dummy[2] = { " ", " " }; nsComponent *currComp = sCustomST->GetComponents()->GetHead(); GtkWidget *descLongTable = NULL; GtkWidget *frame = NULL; scrollwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); list = gtk_clist_new(2); gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); gtk_clist_column_titles_hide(GTK_CLIST(list)); gtk_clist_set_column_auto_resize(GTK_CLIST(list), 0, TRUE); gtk_clist_set_column_auto_resize(GTK_CLIST(list), 1, TRUE); // determine number of rows we'll need numRows = sCustomST->GetComponents()->GetLengthVisible(); for (i = 0; i < numRows; i++) gtk_clist_append(GTK_CLIST(list), dummy); style = gtk_widget_get_style(gCtx->window); checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm); unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask, &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm); while ((currRow < numRows) && currComp) // paranoia! { if (!currComp->IsInvisible()) { if (currComp->IsSelected()) gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, checked, ch_mask); else gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, unchecked, un_mask); gtk_clist_set_text(GTK_CLIST(list), currRow, 1, currComp->GetDescShort()); currRow++; } currComp = currComp->GetNext(); } // by default, first row selected upon Show() sCurrRowSelected = 0; gtk_signal_connect(GTK_OBJECT(list), "select_row", GTK_SIGNAL_FUNC(RowSelected), NULL); gtk_signal_connect(GTK_OBJECT(list), "key_press_event", GTK_SIGNAL_FUNC(KeyPressed), NULL); gtk_container_add(GTK_CONTAINER(scrollwin), list); gtk_widget_show(list); gtk_widget_show(scrollwin); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), scrollwin, TRUE, TRUE, 0); gtk_widget_show(hbox); gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 2, 3, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), 20, 0); // XXX 3rd row: labels for ds avail and ds reqd // 4th row: a frame with a label (long desc) descLongTable = gtk_table_new(1, 1, FALSE); gtk_widget_show(descLongTable); gtk_table_attach(GTK_TABLE(mTable), descLongTable, 0, 1, 4, 5, static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), 20, 20); frame = gtk_frame_new(gCtx->Res("DESCRIPTION")); gtk_table_attach_defaults(GTK_TABLE(descLongTable), frame, 0, 1, 0, 1); gtk_widget_show(frame); sDescLong = gtk_label_new( sCustomST->GetComponents()->GetFirstVisible()->GetDescLong()); gtk_label_set_line_wrap(GTK_LABEL(sDescLong), TRUE); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), sDescLong, FALSE, FALSE, 20); gtk_widget_show(hbox); gtk_table_attach_defaults(GTK_TABLE(descLongTable), hbox, 0, 1, 0, 1); gtk_widget_show(sDescLong); mWidgetsInit = TRUE; } else { gtk_notebook_set_page(GTK_NOTEBOOK(gCtx->notebook), mPageNum); gtk_widget_show(mTable); } // signal connect the buttons gCtx->backID = gtk_signal_connect(GTK_OBJECT(gCtx->back), "clicked", GTK_SIGNAL_FUNC(nsComponentsDlg::Back), gCtx->cdlg); gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked", GTK_SIGNAL_FUNC(nsComponentsDlg::Next), gCtx->cdlg); // show back btn again after setup type dlg where we couldn't go back gtk_widget_set_sensitive(gCtx->back, TRUE); if (aDirection == nsXInstallerDlg::BACKWARD_MOVE) // from install dlg gtk_button_set_label(GTK_BUTTON(gCtx->next), GTK_STOCK_GO_FORWARD); return err; }
void x87_fsqrt( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xfa); }
void nsComponentsDlg::ToggleRowSelection(GtkWidget *aWidget, gint aRow, gboolean aToggleState) { int numRows = 0, currRow = 0; GtkStyle *style = NULL; GdkBitmap *ch_mask = NULL; GdkPixmap *checked = NULL; GdkBitmap *un_mask = NULL; GdkPixmap *unchecked = NULL; nsComponent *currComp = sCustomST->GetComponents()->GetHead(); style = gtk_widget_get_style(gCtx->window); checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm); unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask, &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm); numRows = sCustomST->GetComponents()->GetLengthVisible(); while ((currRow < numRows) && currComp) // paranoia! { if (!currComp->IsInvisible()) { if (aRow == currRow) { // update long desc gtk_label_set_text(GTK_LABEL(sDescLong), currComp->GetDescLong()); gtk_widget_show(sDescLong); if (aToggleState) { if (currComp->IsSelected()) { DUMP("Toggling off..."); currComp->SetUnselected(); } else { DUMP("Toggling on..."); currComp->SetSelected(); } } currComp->ResolveDependees(currComp->IsSelected(), sCustomST->GetComponents()); break; } currRow++; } currComp = currComp->GetNext(); } // after resolving dependees redraw all checkboxes in one fell swoop currRow = 0; currComp = sCustomST->GetComponents()->GetHead(); while ((currRow < numRows) && currComp) // paranoia! { if (!currComp->IsInvisible()) { if (currComp->IsSelected()) { gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, checked, ch_mask); } else { gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, unchecked, un_mask); } currRow++; } currComp = currComp->GetNext(); } }
void x87_fxtract( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xf4); }
ZIX_API ZixStatus zix_tree_remove(ZixTree* t, ZixTreeIter* ti) { ZixTreeNode* const n = ti; ZixTreeNode** pp = NULL; // parent pointer ZixTreeNode* to_balance = n->parent; // lowest node to balance int8_t d_balance = 0; // delta(balance) for n->parent DEBUG_PRINTF("*** REMOVE %ld\n", (intptr_t)n->data); if ((n == t->root) && !n->left && !n->right) { t->root = NULL; if (t->destroy) { t->destroy(n->data); } free(n); --t->size; assert(t->size == 0); return ZIX_STATUS_SUCCESS; } // Set pp to the parent pointer to n, if applicable if (n->parent) { assert(n->parent->left == n || n->parent->right == n); if (n->parent->left == n) { // n is left child pp = &n->parent->left; d_balance = 1; } else { // n is right child assert(n->parent->right == n); pp = &n->parent->right; d_balance = -1; } } assert(!pp || *pp == n); int height_change = 0; if (!n->left && !n->right) { // n is a leaf, just remove it if (pp) { *pp = NULL; to_balance = n->parent; height_change = (!n->parent->left && !n->parent->right) ? -1 : 0; } } else if (!n->left) { // Replace n with right (only) child if (pp) { *pp = n->right; to_balance = n->parent; } else { t->root = n->right; } n->right->parent = n->parent; height_change = -1; } else if (!n->right) { // Replace n with left (only) child if (pp) { *pp = n->left; to_balance = n->parent; } else { t->root = n->left; } n->left->parent = n->parent; height_change = -1; } else { // Replace n with in-order successor (leftmost child of right subtree) ZixTreeNode* replace = n->right; while (replace->left) { assert(replace->left->parent == replace); replace = replace->left; } // Remove replace from parent (replace_p) if (replace->parent->left == replace) { height_change = replace->parent->right ? 0 : -1; d_balance = 1; to_balance = replace->parent; replace->parent->left = replace->right; } else { assert(replace->parent == n); height_change = replace->parent->left ? 0 : -1; d_balance = -1; to_balance = replace->parent; replace->parent->right = replace->right; } if (to_balance == n) { to_balance = replace; } if (replace->right) { replace->right->parent = replace->parent; } replace->balance = n->balance; // Swap node to delete with replace if (pp) { *pp = replace; } else { assert(t->root == n); t->root = replace; } replace->parent = n->parent; replace->left = n->left; n->left->parent = replace; replace->right = n->right; if (n->right) { n->right->parent = replace; } assert(!replace->parent || replace->parent->left == replace || replace->parent->right == replace); } // Rebalance starting at to_balance upwards. for (ZixTreeNode* i = to_balance; i; i = i->parent) { i->balance += d_balance; if (d_balance == 0 || i->balance == -1 || i->balance == 1) { break; } assert(i != n); i = zix_tree_rebalance(t, i, &height_change); if (i->balance == 0) { height_change = -1; } if (i->parent) { if (i == i->parent->left) { d_balance = height_change * -1; } else { assert(i == i->parent->right); d_balance = height_change; } } } DUMP(t); if (t->destroy) { t->destroy(n->data); } free(n); --t->size; #ifdef ZIX_TREE_VERIFY if (!verify(t, t->root)) { return ZIX_STATUS_ERROR; } #endif return ZIX_STATUS_SUCCESS; }
/* st0 = (2^st0)-1 * * Restrictions: -1.0 <= st0 <= 1.0 */ void x87_f2xm1( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xf0); }
CAMLprim value caml_context_split_r(CAML_R, value thread_no_as_value, value function) { #if defined(HAS_MULTICONTEXT) //&& defined(NATIVE_CODE) //DUMPROOTS("splitting: before GC-protecting locals"); CAMLparam1(function); //CAMLlocal2(result, open_channels); CAMLlocal5(result, open_channels, res, tail, chan); //DUMPROOTS("splitting: after GC-protecting locals"); int can_split = caml_can_split_r(ctx); if (! can_split) caml_raise_cannot_split_r(ctx); int thread_no = Int_val(thread_no_as_value); caml_global_context **new_contexts = caml_stat_alloc(sizeof(caml_global_context*) * thread_no); char *blob; sem_t semaphore; int i; caml_initialize_semaphore(&semaphore, 0); /* CAMLparam0(); CAMLlocal1(open_channels); */ /* Make sure that the currently-existing channels stay alive until after deserialization; we can't keep reference counts within the blob, so we pin all alive channels by keeping this list alive: */ /* //if(0){//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* struct channel *channel; */ /* struct channel **channels; */ /* int channel_no = 0; */ /* caml_acquire_global_lock(); */ /* for (channel = caml_all_opened_channels; */ /* channel != NULL; */ /* channel = channel->next) */ /* channel_no ++; */ /* channels = caml_stat_alloc(sizeof(struct channel*) * channel_no); */ /* for (i = 0, channel = caml_all_opened_channels; */ /* channel != NULL; */ /* i ++, channel = channel->next){ */ /* channels[i] = channel; */ /* DUMP("split-pinning channel %p, with fd %i, refcount %i->%i", channel, (int)channel->fd, channel->refcount, channel->refcount + 1); */ /* channel->refcount ++; */ /* } */ /* caml_release_global_lock(); */ //open_channels = caml_ml_all_channels_list_r(ctx); // !!!!!!!!!!!!!!!!!!!! This can occasionally cause crashes related to channel picounts. I certainly messed up something in io.c. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //}//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* //EXPERIMENTAL: BEGIN */ /* { */ /* struct channel * channel; */ /* res = Val_emptylist; */ /* caml_acquire_global_lock(); */ /* int ii, channel_index; */ /* for(ii = 0; ii < 100; ii ++){ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* for (channel_index = 0, channel = caml_all_opened_channels; */ /* channel != NULL; */ /* channel = channel->next, channel_index ++) */ /* /\* Testing channel->fd >= 0 looks unnecessary, as */ /* caml_ml_close_channel changes max when setting fd to -1. *\/ */ /* { */ /* DUMP("round %i, channel_index %i", ii, channel_index); */ /* // !!!!!!!!!!!!! BEGIN */ /* /\* chan = *\/ caml_alloc_channel_r (ctx, channel); */ /* // !!!!!!!!!!!!! END */ /* chan = Val_unit;//caml_alloc_channel_r (ctx, channel); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* tail = res; */ /* res = caml_alloc_small_r (ctx, 2, 0); */ /* Field (res, 0) = chan; */ /* Field (res, 1) = tail; */ /* } */ /* DUMP("End of round %i: there are %i channels alive", ii, channel_index); */ /* DUMP("Before GC'ing"); */ /* caml_gc_compaction_r(ctx, Val_unit); //!!!!!@@@@@@@@@@@@@ */ /* DUMP("After GC'ing"); */ /* } */ /* caml_release_global_lock(); */ /* //open_channels = Val_unit/\* res *\/; */ /* open_channels = res; */ /* } */ /* //EXPERIMENTAL: END */ /* Serialize the context in the main thread, then create threads, and in each one of them deserialize it back in parallel: */ blob = caml_serialize_context(ctx, function); //if(0){//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! caml_split_and_wait_r(ctx, blob, new_contexts, thread_no, &semaphore); //}//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* Now we're done with the blob: */ DUMP("destroying the blob"); caml_stat_free(blob); // !!!!!!!!!!!!!!!!!!!!!!!!!!! This is needed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DUMP("GC'ing after destroying the blob"); caml_gc_compaction_r(ctx, Val_unit); //!!!!!@@@@@@@@@@@@@ DUMP("finalizing the semaphore"); caml_finalize_semaphore(&semaphore); /* Copy the contexts we got, and we're done with new_contexts as well: */ DUMP("copying the new context (descriptors) into the Caml data structure result"); result = caml_alloc_r(ctx, thread_no, 0); caml_gc_compaction_r(ctx, Val_unit); //!!!!!@@@@@@@@@@@@ for(i = 0; i < thread_no; i ++) caml_initialize_r(ctx, &Field(result, i), caml_value_of_context_descriptor(new_contexts[i]->descriptor)); caml_stat_free(new_contexts); DUMP("destroyed the malloced buffer of pointers new_contexts"); //DUMPROOTS("from parent, after splitting"); /* caml_acquire_global_lock(); */ /* for (i = 0; i < channel_no; i ++){ */ /* DUMP("split-unpinning channels[i] %p, with fd %i, refcount %i->%i", channels[i], (int)channels[i]->fd, channels[i]->refcount, channels[i]->refcount - 1); */ /* channels[i]->refcount --; */ /* } */ /* caml_release_global_lock(); */ CAMLreturn(result); //CAMLreturn(Val_unit); #else caml_raise_unimplemented_r(ctx); return Val_unit; // unreachable #endif // #if defined(HAS_MULTICONTEXT) //&& defined(NATIVE_CODE) }
/* st1 = st1 * log2(st0 + 1.0); * pop_stack; * * A fast operation, with restrictions: -.29 < st0 < .29 */ void x87_fyl2xp1( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xf9); note_x87_pop(p); }
static int bdisp_dbg_regs(struct seq_file *s, void *data) { struct bdisp_dev *bdisp = s->private; int ret; unsigned int i; ret = pm_runtime_get_sync(bdisp->dev); if (ret < 0) { seq_puts(s, "Cannot wake up IP\n"); return 0; } seq_printf(s, "Reg @ = 0x%p\n", bdisp->regs); seq_puts(s, "\nStatic:\n"); DUMP(BLT_CTL); DUMP(BLT_ITS); DUMP(BLT_STA1); DUMP(BLT_AQ1_CTL); DUMP(BLT_AQ1_IP); DUMP(BLT_AQ1_LNA); DUMP(BLT_AQ1_STA); DUMP(BLT_ITM0); seq_puts(s, "\nPlugs:\n"); DUMP(BLT_PLUGS1_OP2); DUMP(BLT_PLUGS1_CHZ); DUMP(BLT_PLUGS1_MSZ); DUMP(BLT_PLUGS1_PGZ); DUMP(BLT_PLUGS2_OP2); DUMP(BLT_PLUGS2_CHZ); DUMP(BLT_PLUGS2_MSZ); DUMP(BLT_PLUGS2_PGZ); DUMP(BLT_PLUGS3_OP2); DUMP(BLT_PLUGS3_CHZ); DUMP(BLT_PLUGS3_MSZ); DUMP(BLT_PLUGS3_PGZ); DUMP(BLT_PLUGT_OP2); DUMP(BLT_PLUGT_CHZ); DUMP(BLT_PLUGT_MSZ); DUMP(BLT_PLUGT_PGZ); seq_puts(s, "\nNode:\n"); DUMP(BLT_NIP); DUMP(BLT_CIC); DUMP(BLT_INS); DUMP(BLT_ACK); DUMP(BLT_TBA); DUMP(BLT_TTY); DUMP(BLT_TXY); DUMP(BLT_TSZ); DUMP(BLT_S1BA); DUMP(BLT_S1TY); DUMP(BLT_S1XY); DUMP(BLT_S2BA); DUMP(BLT_S2TY); DUMP(BLT_S2XY); DUMP(BLT_S2SZ); DUMP(BLT_S3BA); DUMP(BLT_S3TY); DUMP(BLT_S3XY); DUMP(BLT_S3SZ); DUMP(BLT_FCTL); DUMP(BLT_RSF); DUMP(BLT_RZI); DUMP(BLT_HFP); DUMP(BLT_VFP); DUMP(BLT_Y_RSF); DUMP(BLT_Y_RZI); DUMP(BLT_Y_HFP); DUMP(BLT_Y_VFP); DUMP(BLT_IVMX0); DUMP(BLT_IVMX1); DUMP(BLT_IVMX2); DUMP(BLT_IVMX3); DUMP(BLT_OVMX0); DUMP(BLT_OVMX1); DUMP(BLT_OVMX2); DUMP(BLT_OVMX3); DUMP(BLT_DEI); seq_puts(s, "\nFilter:\n"); for (i = 0; i < BLT_NB_H_COEF; i++) { seq_printf(s, "BLT_HFC%d \t0x%08X\n", i, readl(bdisp->regs + BLT_HFC_N + i * 4)); } for (i = 0; i < BLT_NB_V_COEF; i++) { seq_printf(s, "BLT_VFC%d \t0x%08X\n", i, readl(bdisp->regs + BLT_VFC_N + i * 4)); } seq_puts(s, "\nLuma filter:\n"); for (i = 0; i < BLT_NB_H_COEF; i++) { seq_printf(s, "BLT_Y_HFC%d \t0x%08X\n", i, readl(bdisp->regs + BLT_Y_HFC_N + i * 4)); } for (i = 0; i < BLT_NB_V_COEF; i++) { seq_printf(s, "BLT_Y_VFC%d \t0x%08X\n", i, readl(bdisp->regs + BLT_Y_VFC_N + i * 4)); } pm_runtime_put(bdisp->dev); return 0; }
void x86_ret( struct x86_function *p ) { DUMP(); assert(p->stack_offset == 0); emit_1ub(p, 0xc3); }
bool StyleContext::parseStyleResult(StyleParamKey _key, StyleParam::Value& _val) const { _val = none_type{}; if (duk_is_string(m_ctx, -1)) { std::string value(duk_get_string(m_ctx, -1)); _val = StyleParam::parseString(_key, value); } else if (duk_is_boolean(m_ctx, -1)) { bool value = duk_get_boolean(m_ctx, -1); switch (_key) { case StyleParamKey::visible: _val = value; break; case StyleParamKey::extrude: _val = value ? glm::vec2(NAN, NAN) : glm::vec2(0.0f, 0.0f); break; default: break; } } else if (duk_is_array(m_ctx, -1)) { duk_get_prop_string(m_ctx, -1, "length"); int len = duk_get_int(m_ctx, -1); duk_pop(m_ctx); switch (_key) { case StyleParamKey::extrude: { if (len != 2) { logMsg("Warning: Wrong array size for extrusion: '%d'.\n", len); break; } duk_get_prop_index(m_ctx, -1, 0); double v1 = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 1); double v2 = duk_get_number(m_ctx, -1); duk_pop(m_ctx); _val = glm::vec2(v1, v2); break; } case StyleParamKey::color: case StyleParamKey::outline_color: case StyleParamKey::font_fill: case StyleParamKey::font_stroke: case StyleParamKey::font_stroke_color: { if (len < 3 || len > 4) { logMsg("Warning: Wrong array size for color: '%d'.\n", len); break; } duk_get_prop_index(m_ctx, -1, 0); double r = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 1); double g = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 2); double b = duk_get_number(m_ctx, -1); duk_pop(m_ctx); double a = 1.0; if (len == 4) { duk_get_prop_index(m_ctx, -1, 3); a = duk_get_number(m_ctx, -1); duk_pop(m_ctx); } _val = (((uint32_t)(255.0 * a) & 0xff) << 24) | (((uint32_t)(255.0 * r) & 0xff)<< 16) | (((uint32_t)(255.0 * g) & 0xff)<< 8) | (((uint32_t)(255.0 * b) & 0xff)); break; } default: break; } } else if (duk_is_number(m_ctx, -1)) { switch (_key) { case StyleParamKey::width: case StyleParamKey::outline_width: case StyleParamKey::font_stroke_width: { double v = duk_get_number(m_ctx, -1); _val = static_cast<float>(v); break; } case StyleParamKey::order: case StyleParamKey::priority: case StyleParamKey::color: case StyleParamKey::outline_color: case StyleParamKey::font_fill: case StyleParamKey::font_stroke: case StyleParamKey::font_stroke_color: { _val = static_cast<uint32_t>(duk_get_uint(m_ctx, -1)); break; } default: break; } } else { logMsg("Warning: Unhandled return type from Javascript function.\n"); } duk_pop(m_ctx); DUMP("parseStyleResult\n"); return !_val.is<none_type>(); }
void x86_retw( struct x86_function *p, unsigned short imm ) { DUMP(); emit_3ub(p, 0xc2, imm & 0xff, (imm >> 8) & 0xff); }
main(int argc, char **argv) { Clause c1, c2; int icl = 1; for (int arg = 1; arg < argc; arg++) { if (String(argv[arg]) == String("-")) { icl = 2; continue; } Literal l(argv[arg]); DUMP(l); switch (icl) { case 1: if (c1.insert(l) != OK) { cout << "unable to insert literal " << l << endl; return(2); } break; case 2: if (c2.insert(l) != OK) { cout << "unable to insert literal " << l << endl; return(2); } break; default: MustBeTrue(icl == 1 || icl == 2); } } DUMP(c1); DUMP(c2); cout << "rename all variables in clauses ..." << endl;; MustBeTrue(c1.renameVariables() == OK); MustBeTrue(c2.renameVariables() == OK); DUMP(c1); DUMP(c2); Substitutions s; switch (subsumes(c1, c2, s)) { case OK: cout << "====================================" << endl; cout << "c1 SUBSUMES c2 !!!" << endl; cout << "subs is ... " << s << endl; s.applyTo(c1); s.applyTo(c2); cout << "subs*c1 is ... " << c1 << endl; cout << "subs*c2 is ... " << c2 << endl; break; case NOMATCH: cout << "====================================" << endl; cout << "c1 DOES NOT SUBSUME c2 !!!" << endl; break; default: cout << "====================================" << endl; cout << "ERROR !!!" << endl; break; } return(0); }
void x86_sahf( struct x86_function *p ) { DUMP(); emit_1ub(p, 0x9e); }
void StreamTest() { FileIn in("d:/chips.cpp"); FileOut out("d:/chips1.cpp"); for(;;) { int c = in.Get(); if(c < 0) break; out.Put(c); } in.Seek(300); out.Seek(300); for(int i = 0; i < 5000; i++) out.Put(in.Get()); out.SetBufferSize(8); out.Seek(0); LOG("================================================"); StringStream ss(LoadFile("d:/chips.cpp")); int nn = 0; dword style = 0; for(;;) { if(++nn % 1000 == 0) Cout() << "ops: " << nn << ", len: " << ss.GetSize() << ", buffersize: " << out.GetBufferSize() << "\n"; if(ss.GetSize() > 256*1024) { int sz = (rand() % 1000) * 100; ss.SetSize(sz); out.SetSize(sz); LOG("Adjusted size: " << ss.GetSize()); } if(ss.GetSize() != out.GetSize()) { Panic("SIZE MISMATCH!"); return; } if((rand() & 255) == 0) { int64 p = out.GetPos(); out.Seek(0); if(ss.GetResult() != LoadStream(out)) { out.Seek(0); SaveFile("d:/f1.txt", LoadStream(out)); SaveFile("d:/f2.txt", ss.GetResult()); Panic("CONTENT INEQUAL!"); return; } out.Seek(p); } int spos = rand() % (int)ss.GetSize(); int ssize = rand() % (out.GetBufferSize() * 7); int tpos = MAKELONG(rand(), rand()) % (int)ss.GetSize(); if((rand() & 3) == 0) tpos = minmax<int>(spos - (rand() & 63) + 32, 0, (int)out.GetSize()); if((rand() & 3) == 0) ssize = rand() % (3 * out.GetBufferSize()); if((rand() & 4091) == 0) { style++; Cout() << "MODE: " << style << "\n"; } LOG("---------------------"); LOG("spos: " << spos << " ssize: " << ssize << " tpos: " << tpos << " style: " << style); // DUMP(ss.GetSize()); // DUMP(out.GetSize()); String a = Copy(out, spos, ssize, tpos, style); String b = Copy(ss, spos, ssize, tpos, style); // DUMP(ss.GetSize()); // DUMP(out.GetSize()); if((rand() & 1023) == 0) out.SetBufferSize((rand() & 127) + 2); if(a != b) { SaveFile("d:/f1c.txt", a); SaveFile("d:/f2c.txt", b); out.Seek(0); SaveFile("d:/f1.txt", LoadStream(out)); SaveFile("d:/f2.txt", ss.GetResult()); DUMP(ss.GetSize()); Panic("INEQUAL READ IN COPY!"); return; } } }
void x87_fldln2( struct x86_function *p ) { DUMP(); emit_2ub(p, 0xd9, 0xed); note_x87_push(p); }