static gboolean data_table_init (GnmDialogDataTable *state, WBCGtk *wbcg) { state->gui = gnm_gtk_builder_load ("data-table.ui", NULL, GO_CMD_CONTEXT (wbcg)); if (state->gui == NULL) return TRUE; state->dialog = go_gtk_builder_get_widget (state->gui, "DataTable"); gnm_dialog_setup_destroy_handlers (GTK_DIALOG (state->dialog), state->wbcg, GNM_DIALOG_DESTROY_CURRENT_SHEET_REMOVED); state->row_entry = init_entry (state, 0); state->col_entry = init_entry (state, 1); g_signal_connect (G_OBJECT (state->dialog), "response", G_CALLBACK (cb_data_table_response), state); gnm_init_help_button ( go_gtk_builder_get_widget (state->gui, "help"), GNUMERIC_HELP_LINK_DATA_TABLE); /* a candidate for merging into attach guru */ gnm_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), DIALOG_DATA_TABLE_KEY); go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg), GTK_WINDOW (state->dialog)); wbc_gtk_attach_guru (state->wbcg, state->dialog); g_object_set_data_full (G_OBJECT (state->dialog), "state", state, (GDestroyNotify)cb_data_table_destroy); gtk_widget_show_all (GTK_WIDGET (state->dialog)); return FALSE; }
static gboolean so_list_init (GnmDialogSOList *state, WBCGtk *wbcg, SheetObject *so) { GnmExprTop const *texpr; GtkBuilder *gui; gui = gnm_gtk_builder_load ("res:ui/so-list.ui", NULL, GO_CMD_CONTEXT (wbcg)); if (gui == NULL) return TRUE; state->wbcg = wbcg; state->so = so; state->dialog = go_gtk_builder_get_widget (gui, "SOList"); gnm_dialog_setup_destroy_handlers (GTK_DIALOG (state->dialog), state->wbcg, GNM_DIALOG_DESTROY_CURRENT_SHEET_REMOVED); texpr = sheet_widget_list_base_get_content_link (so); state->content_entry = init_entry (state, gui, 1, 4, texpr); if (texpr) gnm_expr_top_unref (texpr); texpr = sheet_widget_list_base_get_result_link (so); state->link_entry = init_entry (state, gui, 1, 0, texpr); if (texpr) gnm_expr_top_unref (texpr); state->as_index_radio = go_gtk_builder_get_widget (gui, "as-index-radio"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->as_index_radio), sheet_widget_list_base_result_type_is_index (so)); g_signal_connect (G_OBJECT (state->dialog), "response", G_CALLBACK (cb_so_list_response), state); gnm_init_help_button ( go_gtk_builder_get_widget (gui, "help"), GNUMERIC_HELP_LINK_SO_LIST); /* a candidate for merging into attach guru */ gnm_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), DIALOG_SO_LIST_KEY); g_object_set_data_full (G_OBJECT (state->dialog), "state", state, g_free); go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg), GTK_WINDOW (state->dialog)); wbc_gtk_attach_guru (state->wbcg, state->dialog); gtk_widget_show_all (GTK_WIDGET (state->dialog)); g_object_unref (gui); return FALSE; }
void preferences_dialog_init (void) { // General preferences init_toggle ("echo_checkbutton", PREF_ECHO); init_toggle ("sneak_checkbutton", PREF_AUTO_SNEAK); init_toggle ("log_checkbutton", PREF_AUTO_LOG); init_spin ("text_buffer_size_spinbutton", PREF_TEXT_BUFFER_SIZE); init_spin ("command_size_spinbutton", PREF_COMMAND_SIZE); init_spin ("history_size_spinbutton", PREF_COMMAND_HISTORY_SIZE); init_entry ("script_prefix_entry", PREF_SCRIPT_PREFIX); // Colors init_color ("monster_text_box", PREF_MONSTER_TEXT_COLOR); init_color ("monster_base_box", PREF_MONSTER_BASE_COLOR); init_font ("monster_font_box", PREF_MONSTER_FONT); init_color ("title_text_box", PREF_TITLE_TEXT_COLOR); init_color ("title_base_box", PREF_TITLE_BASE_COLOR); init_font ("title_font_box", PREF_TITLE_FONT); init_color ("echo_text_box", PREF_ECHO_TEXT_COLOR); init_color ("echo_base_box", PREF_ECHO_BASE_COLOR); init_font ("echo_font_box", PREF_ECHO_FONT); init_color ("default_text_box", PREF_DEFAULT_TEXT_COLOR); init_color ("default_base_box", PREF_DEFAULT_BASE_COLOR); init_font ("default_font_box", PREF_DEFAULT_FONT); // Paths init_file ("script_path_filechooserbutton", PREF_SCRIPT_PATH); init_file ("log_path_filechooserbutton", PREF_LOG_PATH); }
void luaT_init (lua_State *L) { int t; L->last_tag = NUM_TAGS-1; luaM_growvector(L, L->IMtable, 0, NUM_TAGS, struct IM, arrEM, MAX_INT); for (t=0; t<=L->last_tag; t++) init_entry(L, t); }
// MS SQL 2012 char *msql2k12 (char *pwd, char *salt) { static char sql2k12[SHA512_DIGEST_LENGTH*2+32]; SHA512_CTX ctx; uint8_t out[SHA512_DIGEST_LENGTH]; uint8_t sbin[4]; size_t salt_len, pwd_len; int i, idx; wchar_t wcs_pwd[128]; idx=init_entry (sql2k12, salt, 2); // convert to unicode pwd_len=mbstowcs (wcs_pwd, pwd, 128); // get salt salt_len=hex2bin (sbin, salt); SHA512_Init (&ctx); SHA512_Update (&ctx, wcs_pwd, pwd_len*2); SHA512_Update (&ctx, sbin, salt_len); SHA512_Final (out, &ctx); idx+=SALT_LEN; for (i=0; i<SHA512_DIGEST_LENGTH; i++) { _snprintf (&sql2k12[(idx+i)*2], 2, "%02X", out[i]); } return sql2k12; }
int32 lua_newtag() { --last_tag; if (-last_tag >= IMtable_size) IMtable_size = luaM_growvector(&IMtable, IMtable_size, struct IM, memEM, MAX_INT); init_entry(last_tag); return last_tag; }
// MS SQL 2000 char *msql2k (char *pwd, char *salt) { static char sql2k[128]; SHA_CTX ctx; char uc[128]; wchar_t wcs[128]; uint8_t sbin[32], out[32]; size_t plen, slen; int i, idx=0; idx=init_entry (sql2k, salt, sbin, 1); // convert to uppercase uppercase (uc, pwd); // convert password to Unicode plen=mbstowcs (wcs, uc, sizeof wcs); // hash with salt SHA1_Init (&ctx); SHA1_Update (&ctx, wcs, plen*2); SHA1_Update (&ctx, sbin, idx - VERSION_LEN); SHA1_Final (out, &ctx); // format to hex for (i=0; i<SHA_DIGEST_LENGTH; i++) { _snprintf (&sql2k[(idx+i)*2], 2, "%02X", out[i]); } return sql2k; }
void luaT_init (lua_State *L) { int t; luaM_growvector(L, L->TMtable, 0, NUM_TAGS, struct TM, "", MAX_INT); L->nblocks += NUM_TAGS*sizeof(struct TM); L->last_tag = NUM_TAGS-1; for (t=0; t<=L->last_tag; t++) init_entry(L, t); }
void luaT_init() { int32 t; IMtable_size = NUM_TAGS * 2; last_tag = -(NUM_TAGS - 1); IMtable = luaM_newvector(IMtable_size, struct IM); for (t = -(IMtable_size - 1); t <= 0; t++) init_entry(t); }
int lua_newtag (void) { --L->last_tag; if ((-L->last_tag) >= L->IMtable_size) L->IMtable_size = luaM_growvector(&L->IMtable, L->IMtable_size, struct IM, memEM, MAX_INT); init_entry(L->last_tag); return L->last_tag; }
void luaT_init (void) { int t; L->IMtable_size = NUM_TAGS*2; L->last_tag = -(NUM_TAGS-1); L->IMtable = luaM_newvector(L->IMtable_size, struct IM); for (t=L->last_tag; t<=0; t++) init_entry(t); }
/* * This assumes the cblock hasn't already been allocated. */ static struct entry *alloc_particular_entry(struct entry_alloc *ea, unsigned i) { struct entry *e = __get_entry(ea->es, ea->begin + i); BUG_ON(e->allocated); l_del(ea->es, &ea->free, e); init_entry(e); ea->nr_allocated++; return e; }
static struct entry *alloc_entry(struct entry_alloc *ea) { struct entry *e; if (l_empty(&ea->free)) return NULL; e = l_pop_tail(ea->es, &ea->free); init_entry(e); ea->nr_allocated++; return e; }
static gboolean data_table_init (GnmDialogDataTable *state, WBCGtk *wbcg) { GtkTable *table; state->gui = gnm_glade_xml_new (GO_CMD_CONTEXT (wbcg), "data-table.glade", NULL, NULL); if (state->gui == NULL) return TRUE; state->dialog = glade_xml_get_widget (state->gui, "DataTable"); table = GTK_TABLE (glade_xml_get_widget (state->gui, "table")); state->row_entry = init_entry (state, "row-entry"); state->col_entry = init_entry (state, "col-entry"); g_signal_connect (G_OBJECT (state->dialog), "response", G_CALLBACK (cb_data_table_response), state); gnumeric_init_help_button ( glade_xml_get_widget (state->gui, "help"), GNUMERIC_HELP_LINK_DATA_TABLE); /* a candidate for merging into attach guru */ gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), DIALOG_DATA_TABLE_KEY); go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg), GTK_WINDOW (state->dialog)); wbc_gtk_attach_guru (state->wbcg, state->dialog); g_object_set_data_full (G_OBJECT (state->dialog), "state", state, (GDestroyNotify)cb_data_table_destroy); gtk_widget_show_all (GTK_WIDGET (state->dialog)); return FALSE; }
/* Similar to search_node() but split bnodes before traversing them. */ static iter_t insert_node(const void *key, const void *data, piojo_btree_t *tree) { int cmpval; bool found_p; size_t idx=0, j; iter_t iter; bnode_t *bnode; if (tree->root->ecnt == tree->cmax - 1){ split_root(tree); } bnode = tree->root; iter.bnode = NULL; while (bnode->ecnt > 0){ idx = bin_search(key, tree, bnode, &found_p); if (found_p){ iter.bnode = bnode; iter.eidx = idx; return iter; }else if (bnode->leaf_p){ break; } if (bnode->children[idx]->ecnt == tree->cmax - 1){ split_bnode(tree, idx, bnode->children[idx], bnode); cmpval = tree->cmp_cb(key, entry_key(idx, bnode, tree)); if (cmpval == 0){ iter.bnode = bnode; iter.eidx = idx; return iter; }else if (cmpval > 0){ ++idx; } } bnode = bnode->children[idx]; } PIOJO_ASSERT(bnode->ecnt < tree->cmax - 1); for (j = bnode->ecnt; j > idx; --j){ copy_bentry(j - 1, bnode, j, bnode, tree); } init_entry(key, data, idx, bnode, tree); ++bnode->ecnt; return iter; }
struct cdfs_entry_struct *create_entry(struct cdfs_entry_struct *parent, const char *name, struct cdfs_inode_struct *inode) { struct cdfs_entry_struct *entry; entry = malloc(sizeof(struct cdfs_entry_struct)); if (entry) { memset(entry, 0, sizeof(struct cdfs_entry_struct)); init_entry(entry); entry->name = strdup(name); if (!entry->name) { free(entry); entry = NULL; } else { entry->parent = parent; if (inode != NULL) { entry->inode = inode; inode->alias=entry; } } } return entry; }
static int emit_rule(struct xswitch *sw, struct flow_table *ft, struct trace_tree *tree, struct match *ma, int priority, struct action *ac_pi) { int i; struct trace_tree_L *tl; struct trace_tree_V *tv; struct trace_tree_T *tt; struct trace_tree_D *td; struct trace_tree_G *tg; struct msgbuf *msg; struct match *maa; struct action *a; char buf[128], buf2[128]; struct expr *move_expr; switch(tree->type) { case TT_L: tl = (struct trace_tree_L *)tree; match_dump(ma, buf, 128); action_dump(tl->ac, buf2, 128); xdebug("tid %d: %2d, %s, %s\n", flow_table_get_tid(ft), priority, buf, buf2); if(tl->index == -1) { tl->index = flow_table_get_entry_index(ft); msg = msg_flow_entry_add(ft, tl->index, priority, ma, tl->ac); } else { msg = msg_flow_entry_mod(ft, tl->index, priority, ma, tl->ac); } xswitch_send(sw, msg); return priority + 1; case TT_V: tv = (struct trace_tree_V *)tree; for(i = 0; i < tv->num_branches; i++) { maa = match_copy(ma); match_add(maa, tv->name, tv->branches[i].value, value_from_64(0xffffffffffffffffull)); priority = emit_rule(sw, ft, tv->branches[i].tree, maa, priority, ac_pi); match_free(maa); } return priority; case TT_T: tt = (struct trace_tree_T *)tree; priority = emit_rule(sw, ft, tt->f, ma, priority, ac_pi); maa = match_copy(ma); match_add(maa, tt->name, tt->value, value_from_64(0xffffffffffffffffull)); action_dump(ac_pi, buf, 128); xdebug("tid %d: %2d, BARRIER, %s\n", flow_table_get_tid(ft), priority, buf); if(tt->barrier_index == -1) { tt->barrier_index = flow_table_get_entry_index(ft); msg = msg_flow_entry_add(ft, tt->barrier_index, priority, maa, ac_pi); } else { msg = msg_flow_entry_mod(ft, tt->barrier_index, priority, maa, ac_pi); } xswitch_send(sw, msg); priority = emit_rule(sw, ft, tt->t, maa, priority + 1, ac_pi); match_free(maa); return priority; case TT_G: tg = (struct trace_tree_G *)tree; if(tg->ft == NULL) { int tid = sw->next_table_id++; // add a new table tg->ft = header_make_flow_table(tg->new_spec, tid); msg = msg_flow_table_add(tg->ft); xswitch_send(sw, msg); init_entry(sw, tg->ft); } // insert GOTO_TABLE into orig table a = action(); if(tg->old_spec) move_expr = header_get_length(tg->old_spec); else move_expr = expr_value(0); expr_generate_action(move_expr, tg->old_spec, tg->ft, tg->stack_base, a); match_dump(ma, buf, 128); action_dump(a, buf2, 128); xdebug("tid %d: %2d, %s, %s\n", flow_table_get_tid(ft), priority, buf, buf2); if(tg->index == -1) { tg->index = flow_table_get_entry_index(ft); msg = msg_flow_entry_add(ft, tg->index, priority, ma, a); } else { msg = msg_flow_entry_mod(ft, tg->index, priority, ma, a); } xswitch_send(sw, msg); action_free(a); maa = match(); emit_rule(sw, tg->ft, tg->t, maa, 1, ac_pi); match_free(maa); return priority + 1; case TT_D: td = (struct trace_tree_D *)tree; return emit_rule(sw, ft, td->t, ma, priority, ac_pi); case TT_E: return priority; } assert(0); }
//------------------------------------------------------------------------------ // MethodHandles::generate_method_handle_stub // // Generate an "entry" field for a method handle. // This determines how the method handle will respond to calls. void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) { // Here is the register state during an interpreted call, // as set up by generate_method_handle_interpreter_entry(): // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused) // - rcx: receiver method handle // - rax: method handle type (only used by the check_mtype entry point) // - rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted) // - rdx: garbage temp, can blow away const Register rcx_recv = rcx; const Register rax_argslot = rax; const Register rbx_temp = rbx; const Register rdx_temp = rdx; // This guy is set up by prepare_to_jump_from_interpreted (from interpreted calls) // and gen_c2i_adapter (from compiled calls): const Register saved_last_sp = LP64_ONLY(r13) NOT_LP64(rsi); // Argument registers for _raise_exception. // 32-bit: Pass first two oop/int args in registers ECX and EDX. const Register rarg0_code = LP64_ONLY(j_rarg0) NOT_LP64(rcx); const Register rarg1_actual = LP64_ONLY(j_rarg1) NOT_LP64(rdx); const Register rarg2_required = LP64_ONLY(j_rarg2) NOT_LP64(rdi); assert_different_registers(rarg0_code, rarg1_actual, rarg2_required, saved_last_sp); guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); // some handy addresses Address rbx_method_fie( rbx, methodOopDesc::from_interpreted_offset() ); Address rbx_method_fce( rbx, methodOopDesc::from_compiled_offset() ); Address rcx_mh_vmtarget( rcx_recv, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes() ); Address rcx_dmh_vmindex( rcx_recv, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes() ); Address rcx_bmh_vmargslot( rcx_recv, java_lang_invoke_BoundMethodHandle::vmargslot_offset_in_bytes() ); Address rcx_bmh_argument( rcx_recv, java_lang_invoke_BoundMethodHandle::argument_offset_in_bytes() ); Address rcx_amh_vmargslot( rcx_recv, java_lang_invoke_AdapterMethodHandle::vmargslot_offset_in_bytes() ); Address rcx_amh_argument( rcx_recv, java_lang_invoke_AdapterMethodHandle::argument_offset_in_bytes() ); Address rcx_amh_conversion( rcx_recv, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes() ); Address vmarg; // __ argument_address(vmargslot) const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes(); if (have_entry(ek)) { __ nop(); // empty stubs make SG sick return; } address interp_entry = __ pc(); trace_method_handle(_masm, entry_name(ek)); BLOCK_COMMENT(entry_name(ek)); switch ((int) ek) { case _raise_exception: { // Not a real MH entry, but rather shared code for raising an // exception. Since we use the compiled entry, arguments are // expected in compiler argument registers. assert(raise_exception_method(), "must be set"); assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); const Register rdi_pc = rax; __ pop(rdi_pc); // caller PC __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started Register rbx_method = rbx_temp; Label L_no_method; // FIXME: fill in _raise_exception_method with a suitable java.lang.invoke method __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method)); __ testptr(rbx_method, rbx_method); __ jccb(Assembler::zero, L_no_method); const int jobject_oop_offset = 0; __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject __ testptr(rbx_method, rbx_method); __ jccb(Assembler::zero, L_no_method); __ verify_oop(rbx_method); NOT_LP64(__ push(rarg2_required)); __ push(rdi_pc); // restore caller PC __ jmp(rbx_method_fce); // jump to compiled entry // Do something that is at least causes a valid throw from the interpreter. __ bind(L_no_method); __ push(rarg2_required); __ push(rarg1_actual); __ jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry())); } break; case _invokestatic_mh: case _invokespecial_mh: { Register rbx_method = rbx_temp; __ load_heap_oop(rbx_method, rcx_mh_vmtarget); // target is a methodOop __ verify_oop(rbx_method); // same as TemplateTable::invokestatic or invokespecial, // minus the CP setup and profiling: if (ek == _invokespecial_mh) { // Must load & check the first argument before entering the target method. __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); __ null_check(rcx_recv); __ verify_oop(rcx_recv); } __ jmp(rbx_method_fie); } break; case _invokevirtual_mh: { // same as TemplateTable::invokevirtual, // minus the CP setup and profiling: // pick out the vtable index and receiver offset from the MH, // and then we can discard it: __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); Register rbx_index = rbx_temp; __ movl(rbx_index, rcx_dmh_vmindex); // Note: The verifier allows us to ignore rcx_mh_vmtarget. __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); __ null_check(rcx_recv, oopDesc::klass_offset_in_bytes()); // get receiver klass Register rax_klass = rax_argslot; __ load_klass(rax_klass, rcx_recv); __ verify_oop(rax_klass); // get target methodOop & entry point const int base = instanceKlass::vtable_start_offset() * wordSize; assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); Address vtable_entry_addr(rax_klass, rbx_index, Address::times_ptr, base + vtableEntry::method_offset_in_bytes()); Register rbx_method = rbx_temp; __ movptr(rbx_method, vtable_entry_addr); __ verify_oop(rbx_method); __ jmp(rbx_method_fie); } break; case _invokeinterface_mh: { // same as TemplateTable::invokeinterface, // minus the CP setup and profiling: // pick out the interface and itable index from the MH. __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); Register rdx_intf = rdx_temp; Register rbx_index = rbx_temp; __ load_heap_oop(rdx_intf, rcx_mh_vmtarget); __ movl(rbx_index, rcx_dmh_vmindex); __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); __ null_check(rcx_recv, oopDesc::klass_offset_in_bytes()); // get receiver klass Register rax_klass = rax_argslot; __ load_klass(rax_klass, rcx_recv); __ verify_oop(rax_klass); Register rdi_temp = rdi; Register rbx_method = rbx_index; // get interface klass Label no_such_interface; __ verify_oop(rdx_intf); __ lookup_interface_method(rax_klass, rdx_intf, // note: next two args must be the same: rbx_index, rbx_method, rdi_temp, no_such_interface); __ verify_oop(rbx_method); __ jmp(rbx_method_fie); __ hlt(); __ bind(no_such_interface); // Throw an exception. // For historical reasons, it will be IncompatibleClassChangeError. __ mov(rbx_temp, rcx_recv); // rarg2_required might be RCX assert_different_registers(rarg2_required, rbx_temp); __ movptr(rarg2_required, Address(rdx_intf, java_mirror_offset)); // required interface __ mov( rarg1_actual, rbx_temp); // bad receiver __ movl( rarg0_code, (int) Bytecodes::_invokeinterface); // who is complaining? __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); } break; case _bound_ref_mh: case _bound_int_mh: case _bound_long_mh: case _bound_ref_direct_mh: case _bound_int_direct_mh: case _bound_long_direct_mh: { bool direct_to_method = (ek >= _bound_ref_direct_mh); BasicType arg_type = T_ILLEGAL; int arg_mask = _INSERT_NO_MASK; int arg_slots = -1; get_ek_bound_mh_info(ek, arg_type, arg_mask, arg_slots); // make room for the new argument: __ movl(rax_argslot, rcx_bmh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot)); insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask, rax_argslot, rbx_temp, rdx_temp); // store bound argument into the new stack slot: __ load_heap_oop(rbx_temp, rcx_bmh_argument); if (arg_type == T_OBJECT) { __ movptr(Address(rax_argslot, 0), rbx_temp); } else { Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type)); const int arg_size = type2aelembytes(arg_type); __ load_sized_value(rdx_temp, prim_value_addr, arg_size, is_signed_subword_type(arg_type), rbx_temp); __ store_sized_value(Address(rax_argslot, 0), rdx_temp, arg_size, rbx_temp); } if (direct_to_method) { Register rbx_method = rbx_temp; __ load_heap_oop(rbx_method, rcx_mh_vmtarget); __ verify_oop(rbx_method); __ jmp(rbx_method_fie); } else { __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ verify_oop(rcx_recv); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } } break; case _adapter_retype_only: case _adapter_retype_raw: // immediately jump to the next MH layer: __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ verify_oop(rcx_recv); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); // This is OK when all parameter types widen. // It is also OK when a return type narrows. break; case _adapter_check_cast: { // temps: Register rbx_klass = rbx_temp; // interesting AMH data // check a reference argument before jumping to the next layer of MH: __ movl(rax_argslot, rcx_amh_vmargslot); vmarg = __ argument_address(rax_argslot); // What class are we casting to? __ load_heap_oop(rbx_klass, rcx_amh_argument); // this is a Class object! __ load_heap_oop(rbx_klass, Address(rbx_klass, java_lang_Class::klass_offset_in_bytes())); Label done; __ movptr(rdx_temp, vmarg); __ testptr(rdx_temp, rdx_temp); __ jcc(Assembler::zero, done); // no cast if null __ load_klass(rdx_temp, rdx_temp); // live at this point: // - rbx_klass: klass required by the target method // - rdx_temp: argument klass to test // - rcx_recv: adapter method handle __ check_klass_subtype(rdx_temp, rbx_klass, rax_argslot, done); // If we get here, the type check failed! // Call the wrong_method_type stub, passing the failing argument type in rax. Register rax_mtype = rax_argslot; __ movl(rax_argslot, rcx_amh_vmargslot); // reload argslot field __ movptr(rdx_temp, vmarg); assert_different_registers(rarg2_required, rdx_temp); __ load_heap_oop(rarg2_required, rcx_amh_argument); // required class __ mov( rarg1_actual, rdx_temp); // bad object __ movl( rarg0_code, (int) Bytecodes::_checkcast); // who is complaining? __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); __ bind(done); // get the new MH: __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_prim_to_prim: case _adapter_ref_to_prim: // handled completely by optimized cases __ stop("init_AdapterMethodHandle should not issue this"); break; case _adapter_opt_i2i: // optimized subcase of adapt_prim_to_prim //case _adapter_opt_f2i: // optimized subcase of adapt_prim_to_prim case _adapter_opt_l2i: // optimized subcase of adapt_prim_to_prim case _adapter_opt_unboxi: // optimized subcase of adapt_ref_to_prim { // perform an in-place conversion to int or an int subword __ movl(rax_argslot, rcx_amh_vmargslot); vmarg = __ argument_address(rax_argslot); switch (ek) { case _adapter_opt_i2i: __ movl(rdx_temp, vmarg); break; case _adapter_opt_l2i: { // just delete the extra slot; on a little-endian machine we keep the first __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); remove_arg_slots(_masm, -stack_move_unit(), rax_argslot, rbx_temp, rdx_temp); vmarg = Address(rax_argslot, -Interpreter::stackElementSize); __ movl(rdx_temp, vmarg); } break; case _adapter_opt_unboxi: { // Load the value up from the heap. __ movptr(rdx_temp, vmarg); int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_INT); #ifdef ASSERT for (int bt = T_BOOLEAN; bt < T_INT; bt++) { if (is_subword_type(BasicType(bt))) assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(BasicType(bt)), ""); } #endif __ null_check(rdx_temp, value_offset); __ movl(rdx_temp, Address(rdx_temp, value_offset)); // We load this as a word. Because we are little-endian, // the low bits will be correct, but the high bits may need cleaning. // The vminfo will guide us to clean those bits. } break; default: ShouldNotReachHere(); } // Do the requested conversion and store the value. Register rbx_vminfo = rbx_temp; __ movl(rbx_vminfo, rcx_amh_conversion); assert(CONV_VMINFO_SHIFT == 0, "preshifted"); // get the new MH: __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); // (now we are done with the old MH) // original 32-bit vmdata word must be of this form: // | MBZ:6 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 | __ xchgptr(rcx, rbx_vminfo); // free rcx for shifts __ shll(rdx_temp /*, rcx*/); Label zero_extend, done; __ testl(rcx, CONV_VMINFO_SIGN_FLAG); __ jccb(Assembler::zero, zero_extend); // this path is taken for int->byte, int->short __ sarl(rdx_temp /*, rcx*/); __ jmpb(done); __ bind(zero_extend); // this is taken for int->char __ shrl(rdx_temp /*, rcx*/); __ bind(done); __ movl(vmarg, rdx_temp); // Store the value. __ xchgptr(rcx, rbx_vminfo); // restore rcx_recv __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_opt_i2l: // optimized subcase of adapt_prim_to_prim case _adapter_opt_unboxl: // optimized subcase of adapt_ref_to_prim { // perform an in-place int-to-long or ref-to-long conversion __ movl(rax_argslot, rcx_amh_vmargslot); // on a little-endian machine we keep the first slot and add another after __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); insert_arg_slots(_masm, stack_move_unit(), _INSERT_INT_MASK, rax_argslot, rbx_temp, rdx_temp); Address vmarg1(rax_argslot, -Interpreter::stackElementSize); Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize); switch (ek) { case _adapter_opt_i2l: { #ifdef _LP64 __ movslq(rdx_temp, vmarg1); // Load sign-extended __ movq(vmarg1, rdx_temp); // Store into first slot #else __ movl(rdx_temp, vmarg1); __ sarl(rdx_temp, BitsPerInt - 1); // __ extend_sign() __ movl(vmarg2, rdx_temp); // store second word #endif } break; case _adapter_opt_unboxl: { // Load the value up from the heap. __ movptr(rdx_temp, vmarg1); int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG); assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), ""); __ null_check(rdx_temp, value_offset); #ifdef _LP64 __ movq(rbx_temp, Address(rdx_temp, value_offset)); __ movq(vmarg1, rbx_temp); #else __ movl(rbx_temp, Address(rdx_temp, value_offset + 0*BytesPerInt)); __ movl(rdx_temp, Address(rdx_temp, value_offset + 1*BytesPerInt)); __ movl(vmarg1, rbx_temp); __ movl(vmarg2, rdx_temp); #endif } break; default: ShouldNotReachHere(); } __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_opt_f2d: // optimized subcase of adapt_prim_to_prim case _adapter_opt_d2f: // optimized subcase of adapt_prim_to_prim { // perform an in-place floating primitive conversion __ movl(rax_argslot, rcx_amh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); if (ek == _adapter_opt_f2d) { insert_arg_slots(_masm, stack_move_unit(), _INSERT_INT_MASK, rax_argslot, rbx_temp, rdx_temp); } Address vmarg(rax_argslot, -Interpreter::stackElementSize); #ifdef _LP64 if (ek == _adapter_opt_f2d) { __ movflt(xmm0, vmarg); __ cvtss2sd(xmm0, xmm0); __ movdbl(vmarg, xmm0); } else { __ movdbl(xmm0, vmarg); __ cvtsd2ss(xmm0, xmm0); __ movflt(vmarg, xmm0); } #else //_LP64 if (ek == _adapter_opt_f2d) { __ fld_s(vmarg); // load float to ST0 __ fstp_s(vmarg); // store single } else { __ fld_d(vmarg); // load double to ST0 __ fstp_s(vmarg); // store single } #endif //_LP64 if (ek == _adapter_opt_d2f) { remove_arg_slots(_masm, -stack_move_unit(), rax_argslot, rbx_temp, rdx_temp); } __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_prim_to_ref: __ unimplemented(entry_name(ek)); // %%% FIXME: NYI break; case _adapter_swap_args: case _adapter_rot_args: // handled completely by optimized cases __ stop("init_AdapterMethodHandle should not issue this"); break; case _adapter_opt_swap_1: case _adapter_opt_swap_2: case _adapter_opt_rot_1_up: case _adapter_opt_rot_1_down: case _adapter_opt_rot_2_up: case _adapter_opt_rot_2_down: { int swap_bytes = 0, rotate = 0; get_ek_adapter_opt_swap_rot_info(ek, swap_bytes, rotate); // 'argslot' is the position of the first argument to swap __ movl(rax_argslot, rcx_amh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot)); // 'vminfo' is the second Register rbx_destslot = rbx_temp; __ movl(rbx_destslot, rcx_amh_conversion); assert(CONV_VMINFO_SHIFT == 0, "preshifted"); __ andl(rbx_destslot, CONV_VMINFO_MASK); __ lea(rbx_destslot, __ argument_address(rbx_destslot)); DEBUG_ONLY(verify_argslot(_masm, rbx_destslot, "swap point must fall within current frame")); if (!rotate) { for (int i = 0; i < swap_bytes; i += wordSize) { __ movptr(rdx_temp, Address(rax_argslot , i)); __ push(rdx_temp); __ movptr(rdx_temp, Address(rbx_destslot, i)); __ movptr(Address(rax_argslot, i), rdx_temp); __ pop(rdx_temp); __ movptr(Address(rbx_destslot, i), rdx_temp); } } else { // push the first chunk, which is going to get overwritten for (int i = swap_bytes; (i -= wordSize) >= 0; ) { __ movptr(rdx_temp, Address(rax_argslot, i)); __ push(rdx_temp); } if (rotate > 0) { // rotate upward __ subptr(rax_argslot, swap_bytes); #ifdef ASSERT { // Verify that argslot > destslot, by at least swap_bytes. Label L_ok; __ cmpptr(rax_argslot, rbx_destslot); __ jccb(Assembler::aboveEqual, L_ok); __ stop("source must be above destination (upward rotation)"); __ bind(L_ok); } #endif // work argslot down to destslot, copying contiguous data upwards // pseudo-code: // rax = src_addr - swap_bytes // rbx = dest_addr // while (rax >= rbx) *(rax + swap_bytes) = *(rax + 0), rax--; Label loop; __ bind(loop); __ movptr(rdx_temp, Address(rax_argslot, 0)); __ movptr(Address(rax_argslot, swap_bytes), rdx_temp); __ addptr(rax_argslot, -wordSize); __ cmpptr(rax_argslot, rbx_destslot); __ jccb(Assembler::aboveEqual, loop); } else { __ addptr(rax_argslot, swap_bytes); #ifdef ASSERT { // Verify that argslot < destslot, by at least swap_bytes. Label L_ok; __ cmpptr(rax_argslot, rbx_destslot); __ jccb(Assembler::belowEqual, L_ok); __ stop("source must be below destination (downward rotation)"); __ bind(L_ok); } #endif // work argslot up to destslot, copying contiguous data downwards // pseudo-code: // rax = src_addr + swap_bytes // rbx = dest_addr // while (rax <= rbx) *(rax - swap_bytes) = *(rax + 0), rax++; Label loop; __ bind(loop); __ movptr(rdx_temp, Address(rax_argslot, 0)); __ movptr(Address(rax_argslot, -swap_bytes), rdx_temp); __ addptr(rax_argslot, wordSize); __ cmpptr(rax_argslot, rbx_destslot); __ jccb(Assembler::belowEqual, loop); } // pop the original first chunk into the destination slot, now free for (int i = 0; i < swap_bytes; i += wordSize) { __ pop(rdx_temp); __ movptr(Address(rbx_destslot, i), rdx_temp); } } __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_dup_args: { // 'argslot' is the position of the first argument to duplicate __ movl(rax_argslot, rcx_amh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot)); // 'stack_move' is negative number of words to duplicate Register rdx_stack_move = rdx_temp; __ movl2ptr(rdx_stack_move, rcx_amh_conversion); __ sarptr(rdx_stack_move, CONV_STACK_MOVE_SHIFT); int argslot0_num = 0; Address argslot0 = __ argument_address(RegisterOrConstant(argslot0_num)); assert(argslot0.base() == rsp, ""); int pre_arg_size = argslot0.disp(); assert(pre_arg_size % wordSize == 0, ""); assert(pre_arg_size > 0, "must include PC"); // remember the old rsp+1 (argslot[0]) Register rbx_oldarg = rbx_temp; __ lea(rbx_oldarg, argslot0); // move rsp down to make room for dups __ lea(rsp, Address(rsp, rdx_stack_move, Address::times_ptr)); // compute the new rsp+1 (argslot[0]) Register rdx_newarg = rdx_temp; __ lea(rdx_newarg, argslot0); __ push(rdi); // need a temp // (preceding push must be done after arg addresses are taken!) // pull down the pre_arg_size data (PC) for (int i = -pre_arg_size; i < 0; i += wordSize) { __ movptr(rdi, Address(rbx_oldarg, i)); __ movptr(Address(rdx_newarg, i), rdi); } // copy from rax_argslot[0...] down to new_rsp[1...] // pseudo-code: // rbx = old_rsp+1 // rdx = new_rsp+1 // rax = argslot // while (rdx < rbx) *rdx++ = *rax++ Label loop; __ bind(loop); __ movptr(rdi, Address(rax_argslot, 0)); __ movptr(Address(rdx_newarg, 0), rdi); __ addptr(rax_argslot, wordSize); __ addptr(rdx_newarg, wordSize); __ cmpptr(rdx_newarg, rbx_oldarg); __ jccb(Assembler::less, loop); __ pop(rdi); // restore temp __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_drop_args: { // 'argslot' is the position of the first argument to nuke __ movl(rax_argslot, rcx_amh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot)); __ push(rdi); // need a temp // (must do previous push after argslot address is taken) // 'stack_move' is number of words to drop Register rdi_stack_move = rdi; __ movl2ptr(rdi_stack_move, rcx_amh_conversion); __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT); remove_arg_slots(_masm, rdi_stack_move, rax_argslot, rbx_temp, rdx_temp); __ pop(rdi); // restore temp __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); } break; case _adapter_collect_args: __ unimplemented(entry_name(ek)); // %%% FIXME: NYI break; case _adapter_spread_args: // handled completely by optimized cases __ stop("init_AdapterMethodHandle should not issue this"); break; case _adapter_opt_spread_0: case _adapter_opt_spread_1: case _adapter_opt_spread_more: { // spread an array out into a group of arguments int length_constant = get_ek_adapter_opt_spread_info(ek); // find the address of the array argument __ movl(rax_argslot, rcx_amh_vmargslot); __ lea(rax_argslot, __ argument_address(rax_argslot)); // grab some temps { __ push(rsi); __ push(rdi); } // (preceding pushes must be done after argslot address is taken!) #define UNPUSH_RSI_RDI \ { __ pop(rdi); __ pop(rsi); } // arx_argslot points both to the array and to the first output arg vmarg = Address(rax_argslot, 0); // Get the array value. Register rsi_array = rsi; Register rdx_array_klass = rdx_temp; BasicType elem_type = T_OBJECT; int length_offset = arrayOopDesc::length_offset_in_bytes(); int elem0_offset = arrayOopDesc::base_offset_in_bytes(elem_type); __ movptr(rsi_array, vmarg); Label skip_array_check; if (length_constant == 0) { __ testptr(rsi_array, rsi_array); __ jcc(Assembler::zero, skip_array_check); } __ null_check(rsi_array, oopDesc::klass_offset_in_bytes()); __ load_klass(rdx_array_klass, rsi_array); // Check the array type. Register rbx_klass = rbx_temp; __ load_heap_oop(rbx_klass, rcx_amh_argument); // this is a Class object! __ load_heap_oop(rbx_klass, Address(rbx_klass, java_lang_Class::klass_offset_in_bytes())); Label ok_array_klass, bad_array_klass, bad_array_length; __ check_klass_subtype(rdx_array_klass, rbx_klass, rdi, ok_array_klass); // If we get here, the type check failed! __ jmp(bad_array_klass); __ bind(ok_array_klass); // Check length. if (length_constant >= 0) { __ cmpl(Address(rsi_array, length_offset), length_constant); } else { Register rbx_vminfo = rbx_temp; __ movl(rbx_vminfo, rcx_amh_conversion); assert(CONV_VMINFO_SHIFT == 0, "preshifted"); __ andl(rbx_vminfo, CONV_VMINFO_MASK); __ cmpl(rbx_vminfo, Address(rsi_array, length_offset)); } __ jcc(Assembler::notEqual, bad_array_length); Register rdx_argslot_limit = rdx_temp; // Array length checks out. Now insert any required stack slots. if (length_constant == -1) { // Form a pointer to the end of the affected region. __ lea(rdx_argslot_limit, Address(rax_argslot, Interpreter::stackElementSize)); // 'stack_move' is negative number of words to insert Register rdi_stack_move = rdi; __ movl2ptr(rdi_stack_move, rcx_amh_conversion); __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT); Register rsi_temp = rsi_array; // spill this insert_arg_slots(_masm, rdi_stack_move, -1, rax_argslot, rbx_temp, rsi_temp); // reload the array (since rsi was killed) __ movptr(rsi_array, vmarg); } else if (length_constant > 1) { int arg_mask = 0; int new_slots = (length_constant - 1); for (int i = 0; i < new_slots; i++) { arg_mask <<= 1; arg_mask |= _INSERT_REF_MASK; } insert_arg_slots(_masm, new_slots * stack_move_unit(), arg_mask, rax_argslot, rbx_temp, rdx_temp); } else if (length_constant == 1) { // no stack resizing required } else if (length_constant == 0) { remove_arg_slots(_masm, -stack_move_unit(), rax_argslot, rbx_temp, rdx_temp); } // Copy from the array to the new slots. // Note: Stack change code preserves integrity of rax_argslot pointer. // So even after slot insertions, rax_argslot still points to first argument. if (length_constant == -1) { // [rax_argslot, rdx_argslot_limit) is the area we are inserting into. Register rsi_source = rsi_array; __ lea(rsi_source, Address(rsi_array, elem0_offset)); Label loop; __ bind(loop); __ movptr(rbx_temp, Address(rsi_source, 0)); __ movptr(Address(rax_argslot, 0), rbx_temp); __ addptr(rsi_source, type2aelembytes(elem_type)); __ addptr(rax_argslot, Interpreter::stackElementSize); __ cmpptr(rax_argslot, rdx_argslot_limit); __ jccb(Assembler::less, loop); } else if (length_constant == 0) { __ bind(skip_array_check); // nothing to copy } else { int elem_offset = elem0_offset; int slot_offset = 0; for (int index = 0; index < length_constant; index++) { __ movptr(rbx_temp, Address(rsi_array, elem_offset)); __ movptr(Address(rax_argslot, slot_offset), rbx_temp); elem_offset += type2aelembytes(elem_type); slot_offset += Interpreter::stackElementSize; } } // Arguments are spread. Move to next method handle. UNPUSH_RSI_RDI; __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); __ jump_to_method_handle_entry(rcx_recv, rdx_temp); __ bind(bad_array_klass); UNPUSH_RSI_RDI; assert(!vmarg.uses(rarg2_required), "must be different registers"); __ movptr(rarg2_required, Address(rdx_array_klass, java_mirror_offset)); // required type __ movptr(rarg1_actual, vmarg); // bad array __ movl( rarg0_code, (int) Bytecodes::_aaload); // who is complaining? __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); __ bind(bad_array_length); UNPUSH_RSI_RDI; assert(!vmarg.uses(rarg2_required), "must be different registers"); __ mov (rarg2_required, rcx_recv); // AMH requiring a certain length __ movptr(rarg1_actual, vmarg); // bad array __ movl( rarg0_code, (int) Bytecodes::_arraylength); // who is complaining? __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); #undef UNPUSH_RSI_RDI } break; case _adapter_flyby: case _adapter_ricochet: __ unimplemented(entry_name(ek)); // %%% FIXME: NYI break; default: ShouldNotReachHere(); } __ hlt(); address me_cookie = MethodHandleEntry::start_compiled_entry(_masm, interp_entry); __ unimplemented(entry_name(ek)); // %%% FIXME: NYI init_entry(ek, MethodHandleEntry::finish_compiled_entry(_masm, me_cookie)); }
int hcache_open(char *filename, int update) { FILE *file; char line[500], ipstr[500], hostname[500]; char *l; int line_no, end; unsigned long ip1, ip2, ip3, ip4, ipaddr; cache_entry *entry; file = fopen(filename, update ? "r+" : "r"); if (file == NULL) { if (errno == ENOENT) { debug(2, "Creating new host cache \"%s\"\n", filename); last_filename = filename; return (0); } perror(filename); return (-1); } last_filename = filename; for (line_no = 1; fgets(line, sizeof(line), file) != NULL; line_no++) { if (strlen(line) < 2) { continue; } if (line[strlen(line) - 1] != '\n') { printf("%d: line too long\n", line_no); continue; } l = line; while (isspace((unsigned char)*l)) { l++; } if ((*l == '#') || (*l == '\0')) { continue; } if (sscanf(l, "%s%n", ipstr, &end) != 1) { printf("%d: parse error\n", line_no); continue; } if (sscanf(ipstr, "%lu.%lu.%lu.%lu", &ip1, &ip2, &ip3, &ip4) != 4) { init_entry(0, ipstr, NULL); continue; } if ((ip1 & 0xffffff00) || (ip2 & 0xffffff00) || (ip3 & 0xffffff00) || (ip4 & 0xffffff00)) { printf("%d: invalid IP address \"%s\"\n", line_no, ipstr); continue; } ipaddr = (ip1 << 24) | (ip2 << 16) | (ip3 << 8) | ip4; entry = init_entry(ipaddr, NULL, NULL); while (1) { l += end; while (isspace((unsigned char)*l)) { l++; } if ((*l == '#') || (*l == '\0')) { break; } hostname[0] = '\0'; if (sscanf(l, "%s%n", hostname, &end) != 1) { printf("%d: parse error\n", line_no); continue; } init_entry(ipaddr, hostname, entry); } } fclose(file); return (0); }
int main(int argc,char **argv) { INFO(char *dbg="Main(init): "); native_startup(argc, argv); /*** init modules ***/ INFO(printf("%sSharedMemory\n",dbg)); init_sharedmem(&dope); INFO(printf("%sTimer\n",dbg)); init_timer(&dope); INFO(printf("%sTick\n",dbg)); init_tick(&dope); INFO(printf("%sRelax\n",dbg)); init_relax(&dope); INFO(printf("%sKeymap\n",dbg)); init_keymap(&dope); INFO(printf("%sThread\n",dbg)); init_thread(&dope); INFO(printf("%sCache\n",dbg)); init_cache(&dope); INFO(printf("%sHashTable\n",dbg)); init_hashtable(&dope); INFO(printf("%sApplication Manager\n",dbg)); init_appman(&dope); INFO(printf("%sTokenizer\n",dbg)); init_tokenizer(&dope); INFO(printf("%sMessenger\n",dbg)); init_messenger(&dope); INFO(printf("%sScript\n",dbg)); init_script(&dope); INFO(printf("%sClipping\n",dbg)); init_clipping(&dope); INFO(printf("%sScreen Driver\n",dbg)); init_scrdrv(&dope); INFO(printf("%sInput\n",dbg)); init_input(&dope); INFO(printf("%sViewManager\n",dbg)); init_viewman(&dope); INFO(printf("%sConvertFNT\n",dbg)); init_conv_fnt(&dope); INFO(printf("%sFontManager\n",dbg)); init_fontman(&dope); INFO(printf("%sGfxScreen16\n",dbg)); init_gfxscr16(&dope); INFO(printf("%sGfxImage16\n",dbg)); init_gfximg16(&dope); INFO(printf("%sGfxImage32\n",dbg)); init_gfximg32(&dope); INFO(printf("%sGfxImageYUV420\n",dbg)); init_gfximgyuv420(&dope); INFO(printf("%sGfx\n",dbg)); init_gfx(&dope); INFO(printf("%sRedrawManager\n",dbg)); init_redraw(&dope); INFO(printf("%sUserState\n",dbg)); init_userstate(&dope); INFO(printf("%sWidgetManager\n",dbg)); init_widman(&dope); INFO(printf("%sScope\n",dbg)); init_scope(&dope); INFO(printf("%sButton\n",dbg)); init_button(&dope); INFO(printf("%sEntry\n",dbg)); init_entry(&dope); INFO(printf("%sVariable\n",dbg)); init_variable(&dope); INFO(printf("%sLabel\n",dbg)); init_label(&dope); INFO(printf("%sLoadDisplay\n",dbg)); init_loaddisplay(&dope); INFO(printf("%sBackground\n",dbg)); init_background(&dope); INFO(printf("%sScrollbar\n",dbg)); init_scrollbar(&dope); INFO(printf("%sScale\n",dbg)); init_scale(&dope); INFO(printf("%sFrame\n",dbg)); init_frame(&dope); INFO(printf("%sContainer\n",dbg)); init_container(&dope); INFO(printf("%sGrid\n",dbg)); init_grid(&dope); INFO(printf("%sWinLayout\n",dbg)); init_winlayout(&dope); INFO(printf("%sWindow\n",dbg)); init_window(&dope); INFO(printf("%sScreen\n",dbg)); init_screen(&dope); INFO(printf("%sScheduler\n",dbg)); if (config_don_scheduler) { // init_don_scheduler(&dope); printf("NOOOOOOOOOOOOOOOOOOO\n"); } else init_simple_scheduler(&dope); INFO(printf("%sVScreenServer\n",dbg)); init_vscr_server(&dope); INFO(printf("%sVScreen\n",dbg)); init_vscreen(&dope); INFO(printf("%sVTextScreen\n",dbg)); init_vtextscreen(&dope); INFO(printf("%sServer\n",dbg)); init_server(&dope); INFO(printf("%screate screen\n",dbg)); { static GFX_CONTAINER *scr_ds; gfx = pool_get("Gfx 1.0"); screen = pool_get("Screen 1.0"); userstate = pool_get("UserState 1.0"); scr_ds = gfx->alloc_scr("default"); curr_scr = screen->create(); curr_scr->scr->set_gfx(curr_scr, scr_ds); userstate->set_max_mx(gfx->get_width(scr_ds)); userstate->set_max_my(gfx->get_height(scr_ds)); } INFO(printf("%sstarting server\n",dbg)); if ((server = pool_get("Server 1.0"))) server->start(); INFO(printf("%sstarting scheduler\n",dbg)); if ((sched = pool_get("Scheduler 1.0"))) sched->process_mainloop(); return 0; }
int lua_newtag (lua_State *L) { ++L->last_tag; luaM_growvector(L, L->IMtable, L->last_tag, 1, struct IM, arrEM, MAX_INT); init_entry(L, L->last_tag); return L->last_tag; }