Exemple #1
0
void eventNotifier::do_RRNotify (XEvent *eventp)
{
    XRRNotifyEvent *e = (XRRNotifyEvent *) eventp;
    XRRScreenResources *screen_resources;

    XRRUpdateConfiguration (eventp);
    screen_resources = XRRGetScreenResources (m_pDpy, m_screen);
    prologue (eventp, "RRNotify");
    switch (e->subtype) {
      case RRNotify_OutputChange:
        qDebug() << "OutputChange";
//          do_RRNotify_OutputChange (eventp, screen_resources); break;
      break;

      case RRNotify_CrtcChange:
        qDebug() << "CrtcChange";
//         do_RRNotify_CrtcChange (eventp, screen_resources); break;
      break;

      case RRNotify_OutputProperty:
        qDebug() << "OutputProperty";
//          do_RRNotify_OutputProperty (eventp, screen_resources); break;
      break;

      default:
          printf ("    subtype %d\n", e->subtype);
    }
    XRRFreeScreenResources (screen_resources);
}
Exemple #2
0
static int VimRemotingClient_init_internal(VimRemotingClient *client)
{
    prologue(client);

    client->commProperty = XInternAtom(client->dpy, "Comm", False);
    client->vimProperty = XInternAtom(client->dpy, "Vim", False);
    client->registryProperty = XInternAtom(client->dpy, "VimRegistry", False);

    client->window = XCreateSimpleWindow(
            client->dpy, XDefaultRootWindow(client->dpy),
            getpid(), 0, 10, 10, 0,
            WhitePixel(client->dpy, DefaultScreen(client->dpy)),
            WhitePixel(client->dpy, DefaultScreen(client->dpy)));
    XSelectInput(client->dpy, client->window, PropertyChangeMask);

    /* WARNING: Do not step through this while debugging, it will hangup
     * the X server! */
    XGrabServer(client->dpy);
    deleteAnyLingerer(client);
    XUngrabServer(client->dpy);

    /* Make window recognizable as a vim window */
    XChangeProperty(
            client->dpy, client->window,
            client->vimProperty, XA_STRING,
            8, PropModeReplace, (char *)client->vim_version,
            (int)strlen(client->vim_version) + 1);

    XSync(client->dpy, False);

    epilogue(client);
    return client->got_x_error;
}
Exemple #3
0
	X64() : CodeGenerator(true)
	{
		prologue(0);

		static __int64 x;

		// Simple operations
		mov(r10, r11);
		mov(r0, r1);
		mov(r0d, r1d);
		mov(r0b, r1b);
		xor(rax, rax);
		xor(rbx, rbx);
		mov(qword_ptr [&x+rax+4*rbx], 1);
		mov(qword_ptr [&x], 2);   // RIP-relative addressing
		push(r14);
		pop(r14);

		const char *string = "Good luck with your 64-bit processor!";

		mov(rcx, (unsigned int)string);
		call((unsigned int)printf);

		epilogue();
	}
Exemple #4
0
void CodeGen::assignmentCode(realSlotRef* dataRef) {
  prologue(true, 0 );
  move(Temp1, LArgLocation(0));
  assert(!haveStackFrame, "LReceiverReg only for no frame");
  assignment(LReceiverReg, dataRef, Temp1);
  epilogue(LReceiverReg);
}  
Exemple #5
0
void E_Node::set_color(E_Color color) {
    prologue("E_Node", "set_color");
    
    this->color = color;
    
    epilogue("E_Node", "set_color");
    return;
}
Exemple #6
0
E_Color E_Node::get_color() const {
    prologue("E_Node", "get_color");
    
    E_Color return_value = this->color;
    
    epilogue("E_Node", "get_color");
    return return_value;
}
Exemple #7
0
E_Node::E_Node() {
    prologue("E_Node");
    
    this->color = BLANK;
    this->owner = NULL;
    
    epilogue("E_Node");
}
Exemple #8
0
E_Node::E_Node(E_Color color){
    prologue("E_Node", "E_Node");
    
    this->color = color;
    this->owner = NULL;
    
    epilogue("E_Node", "E_Node");
}
Exemple #9
0
int GPT::interpret(const list<string>& ifnames, const string& host, int port) {
  if(!prologue(ifnames)) {
    return false;
  }

  InterpreterWalker interpreter(_stable, host, port);
  int r = interpreter.algoritmo(_astree);

  return r;
}
/* Calling point from Scilab.
* checking args and contruction a wrapper around function call of a foreign function or a Scilab macro.
* this wrapper (in fact, a handle) is then passed to another wrapper that will parallelize the calls.
* the parallel wrapper is independant of Scilab (thanks to this wrapper) and is implemented in parallel_wrapper.hpp.
*
* Calling parallel_run is
* 1 checking args
* 2 constructing wrapper pre allocating result Scilab vars and abstracting arrays of args and results pointers
* (in parallel_wrapper )
* 3 contructing a parallel_wrapper
* 4 calling the parallel_wrapper according to config options (i.e. nb of workers)
* 4.1 for each call to be made, adjusting the args and res ptr
* 4.2 calling the wrapper
*
*/
int sci_parallel_run(char *fname,unsigned long fname_len)
{
    typedef std::vector<scilabVar_t> varsContainer_t;
    currentFname=fname; //get_fname(fname, fname_len); uses a static buffer :(
    currentTop= Rhs;
#ifdef _MSC_VER
    Nbvars = max(Rhs, Top);
#else
    Nbvars = std::max(Rhs, Top);
#endif
    if( !check_args())
    {
        Scierror(999,_("%s: Wrong number of input argument(s).\n"),fname);/* need a better error message */
        return 0;
    }


    int nbArgsToHandle(Rhs);
    /* parameters default values */
    int nbWorkers(0), chunkSize(1);
    bool sharedMemory(false), dynamicScheduling(false);
    char const* prologueName("");
    char const* epilogueName("");
    /* If there is a config parameter, use it to update the parameters value */
    if( getConfigParameters(Rhs, nbWorkers, sharedMemory, dynamicScheduling, chunkSize, prologueName, epilogueName))
    {
        --nbArgsToHandle;
    }
    varsContainer_t stack(nbArgsToHandle);
    for(int i(0); i!= nbArgsToHandle; ++i)
    {
        err= getVarAddressFromPosition(pvApiCtx, i+1, &stack[i]);
    }
    varsContainer_t::iterator functionArg= std::find_if(stack.begin(), stack.end(), &isFunctionOrString);
    wrapper w(stack.begin(), functionArg, stack.end(), Lhs);
    bool const withThreads(w.isForeignFunction() && sharedMemory);

    ConcurrencyState::ScopedUpdater u(concurrencyState.scopedUpdater(withThreads));

    simple_wrapper prologue(prologueName), epilogue(epilogueName);

    make_parallel_wrapper(w.argsDataBegin(), w.argsSizesBegin(), w.argsNbBegin(), w.nbRhs(), w.tasksNb()
                          ,  w.resDataBegin(), w.resSizesBegin()
                          , Lhs, w.getHandle(), prologue, epilogue)(withThreads, nbWorkers, dynamicScheduling, chunkSize);

    for(int i(0); i != Lhs; ++i)
    {
        LhsVar(i + 1) = Rhs + i + 1;
    }

    PutLhsVar(); /* to be moved to gateway */

    return 0;
}
Exemple #11
0
/*Cette fonction est executé par les deux thread créé.
  Elle prend en argument le numéro du thread.
  Chaque thread, en compilant un argument stocké dans le tableau, consomme cette entré
  et y met la valeur NULL afin que le deuxième thread ne recompile ce dernier. 
*/
void * fonction(void * arg){

	/* "commande" est une variable de type "char" qui va servir à stocker la commande a éxécuter*/
	char* commande;

	/* La variable "taille va permettre de stocker la longueur de la chaine de caractères qui compose le nom du fichier à compiler*/		
	int taille;

	/* La variable "test" sert à garder le nom du fichier passé en paramètre
	afin de donner le même nom a l'executable une fois le fichier compilé. */
	char* test;

	/* Tant qu'on à pas compiler tout les fichiers passés en paramètres */ 
	while(k <= nb_arg){

		/*On bloque l'un des threads pour qu'ils ne complilent pas le même fichier. */
		prologue((int) arg);

		/* On teste si l'iterateur globale à depasser le nombre d'arguments */
		if(k > nb_arg){
			exit(0);
		}
		printf("\nJe suis le thread num %d, et je consomme le fichier %s\n\n", (int) arg, tab[k]);

		/*On alloue la taille nécessaire à la variable "commande" */
		commande = (char*) malloc((strlen("gcc -Wall -o ") + strlen(tab[k]) +1) + strlen(tab[k] -2)*sizeof(char));
		strcat(commande, "gcc -Wall ");
		strcat(commande, tab[k]);
		strcat(commande, " -o ");

		/* Cette partie sert à indiquer le nom du fichier exécutable */
		taille = strlen(tab[k]);
		test = (char*)malloc(sizeof(char*)*(taille-2));
		strncpy (test, tab[k], taille - 2);
		strcat(commande, test);

		/* on lance la commande system et on teste si elle a fonctionné */
		if(system(commande) == -1){
			perror("Problème fonction systeme.\n");
			exit(-1);
		}

		/* Une fois un fichier compiler, on le supprime du tableau en y insérent NULL */
		tab[k]=NULL;

		/*On libère toute la mémoire alloué précedemment */
		free(commande);
		free(test);
		k++;
		/* On passe la main pour la prochaine itération. */
		epilogue((int) arg);
	}
	return (0);
}
Exemple #12
0
instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream,
                                                     Symbol* name,
                                                     ClassLoaderData* loader_data,
                                                     Handle protection_domain,
                                                     const Klass* host_klass,
                                                     GrowableArray<Handle>* cp_patches,
                                                     TRAPS) {

  assert(stream != NULL, "invariant");
  assert(loader_data != NULL, "invariant");
  assert(THREAD->is_Java_thread(), "must be a JavaThread");

  bool changed_by_loadhook = false;

  ResourceMark rm;
  HandleMark hm;

  JvmtiCachedClassFileData* cached_class_file = NULL;

  ClassFileStream* old_stream = stream;

  stream = prologue(stream,
                    name,
                    loader_data,
                    protection_domain,
                    &cached_class_file,
                    CHECK_NULL);

  ClassFileParser parser(stream,
                         name,
                         loader_data,
                         protection_domain,
                         host_klass,
                         cp_patches,
                         ClassFileParser::BROADCAST, // publicity level
                         CHECK_NULL);

  instanceKlassHandle result = parser.create_instance_klass(old_stream != stream, CHECK_NULL);
  assert(result == parser.create_instance_klass(old_stream != stream, THREAD), "invariant");

  if (result.is_null()) {
    return NULL;
  }

  if (cached_class_file != NULL) {
    // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
    result->set_cached_class_file(cached_class_file);
  }

  TRACE_KLASS_CREATION(result, parser, THREAD);

  return result;
}
Exemple #13
0
void introduction()
{
    prologue();
    PRINT_TIME("This test target DESFireEV1 cards.");

    PRINT_TIME("You will have 20 seconds to insert a card. Test log below");
    PRINT_TIME("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

    LLA_SUBTEST_REGISTER("Authenticate");
    LLA_SUBTEST_REGISTER("ChangeKey");
    LLA_SUBTEST_REGISTER("WriteRead");
    LLA_SUBTEST_REGISTER("ReadFormat");
}
Exemple #14
0
void emit_header( struct machine_ops* mop, struct emitter* e, struct frame* f ){
	// write data section for strings

	// write epilogue and rem location
	f->epi = e->ops->ec( e );
	epilogue( mop, e, f );

	// write prologue and rem location
	f->pro = e->ops->ec( e );
	prologue( mop, e, f );

	// TODO: check for large immed that take 2 instructions and store some in register if available 
	// load constants
//	const_emit_loadreg( me );
}
int main()
{

    prologue();

    timing_test<unsigned char>();
    timing_test<unsigned short>();
    timing_test<unsigned int>();
    timing_test<unsigned long>();
# ifdef BOOST_HAS_LONG_LONG
    timing_test< ::boost::ulong_long_type>();
# endif

    return boost::exit_success;
}
Exemple #16
0
	TestRegisterAllocator() : CodeGenerator(false)
	{
		x1 = 1;
		x2 = 2;
		x3 = 3;
		x4 = 4;
		x5 = 5;
		x6 = 6;
		x7 = 7;
		x8 = 8;
		x9 = 9;

		prologue(0);

		Int t1;
		Int t2;
		Int t3;
		Int t4;
		Int t5;
		Int t6;
		Int t7;
		Int t8;
		Int t9;

		mov(t1, r32(&x1));
		mov(t2, r32(&x2));
		mov(t3, r32(&x3));
		mov(t4, r32(&x4));
		mov(t5, r32(&x5));
		mov(t6, r32(&x6));
		mov(t7, r32(&x7));
		mov(t8, r32(&x8));
		mov(t9, r32(&x9));

		mov(dword_ptr [&x1], t9);
		mov(dword_ptr [&x2], t8);
		mov(dword_ptr [&x3], t7);
		mov(dword_ptr [&x4], t6);
		mov(dword_ptr [&x5], t5);
		mov(dword_ptr [&x6], t4);
		mov(dword_ptr [&x7], t3);
		mov(dword_ptr [&x8], t2);
		mov(dword_ptr [&x9], t1);

		epilogue();
	}
Exemple #17
0
    void
    thread::_M_run()
    {
        // This mutex is only used as a memory fence
        boost::mutex::scoped_lock lck(_M_mutex);

        try {
            prologue(); // Executed once before body()
            while (!_M_stop) { body(); }
            epilogue(); // Executed once after body()
        } catch (const std::exception& ex) {
            try { on_error(ex); }
            catch (...) { /* We're sorry for your loss. */ }
        } catch (...) { /* Not much to be done ... */ }

        _M_wait();
    }
Exemple #18
0
void eventNotifier::run()
{
    int rr_event_base;
    int rr_error_base;

    XRRQueryExtension (m_pDpy, &rr_event_base, &rr_error_base);
    XRRSelectInput( m_pDpy, m_screen,   RRCrtcChangeNotifyMask   |
                                        RROutputChangeNotifyMask |
                                        RROutputPropertyNotifyMask );
    while (!m_bStop){
        XEvent event;
        XNextEvent (m_pDpy, &event);

        if (event.type == rr_event_base + RRNotify){
            prologue (&event, "RRScreenChangeNotify");
            do_RRNotify(&event);
        }
    }
}
size_t HeapInspection::populate_table(KlassInfoTable* cit,
                                      bool need_prologue,
                                      BoolObjectClosure *filter) {
  ResourceMark rm;

  if (need_prologue) {
    prologue();
  }

  RecordInstanceClosure ric(cit, filter);
  Universe::heap()->object_iterate(&ric);

  // need to run epilogue if we run prologue
  if (need_prologue) {
    epilogue();
  }

  return ric.missed_count();
}
Exemple #20
0
	BackEnd() : CodeGenerator(false)
	{
		prologue(0);

		Int a = 11;
		Int b = 22;
		Int c = 33;
		Int d = 44;
		Int e = 55;
		Int f = 66;
		Int g = 77;
		Int h = 88;
		Int i = 99;

		a = ((g & h) - (b + c - e) * (a - b)) | i * f;

		mov(eax, a);

		epilogue();
	}
Exemple #21
0
void InlinedScope::genCode() {
  _hasBeenGenerated = true;
  prologue();
  // always generate (shared) entry points for ordinary & non-local return
  _returnPoint        = NodeFactory::new_MergeNode(EpilogueBCI);
  _NLReturnPoint      = NodeFactory::new_MergeNode(EpilogueBCI);
  _nlrTestPoint       = NULL;
  _contextInitializer = NULL;
  int nofTemps = method()->number_of_stack_temporaries();
  if (isTop()) {
    _returnPoint->append(NodeFactory::new_ReturnNode(resultPR, EpilogueBCI));
    _NLReturnPoint->append(NodeFactory::new_NLRSetupNode(resultPR, EpilogueBCI));
    Node* first = NodeFactory::new_PrologueNode(key(), nofArguments(), nofTemps);
    theCompiler->firstNode = first;
    gen()->setCurrent(first);
  }
  // allocate space for temporaries - initialization done in the prologue code
  assert(!hasTemporaries(), "should have no temporaries yet\n");
  createTemporaries(nofTemps);
  // allocate space for float temporaries
  int nofFloats = method()->total_number_of_floats();
  if (UseFPUStack) {
    const int FPUStackSize = 8;
    if (method()->float_expression_stack_size() <= FPUStackSize) {
      // float expression stack fits in FPU stack, use it instead
      // and allocate only space for the real float temporaries
      nofFloats = method()->number_of_float_temporaries();
    } else {
      warning("possible performance bug: cannot use FPU stack for float expressions");
    }
  }
  createFloatTemporaries(nofFloats);
  // build the intermediate representation
  assert(gen()->current() != NULL, "current() should have been set before");
  MethodIterator iter(method(), gen());
  if (gen()->aborting()) {
    // ends with dead code -- clean up expression stack
    while (!exprStack()->isEmpty()) exprStack()->pop();
  }
  epilogue();
}
Exemple #22
0
int
cue_code_generator_generate(CueCodeGenerator *cg, CueAstRoot *ast)
{
    int nsdepth = 0;
    CueList *body = ast->v.module.body;
    CueList *package = ast->v.module.package;
    CueList *package_str = cue_list_new(cg->pool);
    CueListNode *cur = cue_list_head(package);

    prelude(cg);
    while (cur != NULL) {
        CueAstExpr *name = cur->data;
        enter_namespace(cg, name->v.name.id);
        cue_list_push(package_str, name->v.name.id);
        cur = cur->next;
        nsdepth++;
    }

    _fmt(cg, "// enter package %s\n\n", _join(cg->pool, ".", package_str));

    cur = body->head;
    while (cur != NULL) {
        compile_stmt(cg, (CueAstStmt*)cur->data);
        cur = cur->next;
    }

    while (nsdepth > 0) {
        leave_namespace(cg);
        nsdepth--;
    }

    _fmt(cg, "// leave package %s\n\n", _join(cg->pool, ".", package_str));

    prologue(cg);

    return 0;
}
Exemple #23
0
bool GPT::translate2C(const list<string>& ifnames) {
  bool success = false;
  stringstream s;

  if(!prologue(ifnames)) {
    return false;
  }

  string ofname = _outputfile;
  if(!_useOutputFile) {
     ofname += ".c";
  }

  try{
  	Portugol2CWalker pt2c(_stable);
	string c_src = pt2c.algoritmo(_astree);

	ofstream fo;
	fo.open(ofname.c_str(), ios_base::out);
	if(!fo) {
	  s << PACKAGE << ": não foi possível abrir o arquivo: \"" << ofname << "\"" << endl;
      GPTDisplay::self()->showError(s);
	  goto bail;
	}
	fo << c_src;
	fo.close();

	success = true;

	bail:
	  return success;
  } catch(SymbolTableException& e) {
      s << PACKAGE << ": erro interno: " << e.getMessage() << endl;
      GPTDisplay::self()->showError(s);
  }
}
Exemple #24
0
static void VimRemotingClient_destory(VimRemotingClient *client)
{
    prologue(client);
    XDestroyWindow(client->dpy, client->window);
    epilogue(client);
}
Exemple #25
0
newfunc ()
{
        char    n[NAMESIZE], *ptr;
        fexitlab = getlabel();

        if (!symname (n) ) {
                error ("illegal function or declaration");
                kill ();
                return;
        }
        if (ptr = findglb (n)) {
                if (ptr[IDENT] != FUNCTION)
                        multidef (n);
                else if (ptr[OFFSET] == FUNCTION)
                        multidef (n);
                else
                        ptr[OFFSET] = FUNCTION;
        } else
                addglb (n, FUNCTION, CINT, FUNCTION, PUBLIC);
        prologue ();
        if (!match ("("))
                error ("missing open paren");
        prefix ();
        outstr (n);
        col ();
        nl ();
        locptr = STARTLOC;
        argstk = 0;
        while (!match (")")) {
                if (symname (n)) {
                        if (findloc (n))
                                multidef (n);
                        else {
                                addloc (n, 0, 0, argstk, AUTO);
                                argstk = argstk + intsize();
                        }
                } else {
                        error ("illegal argument name");
                        junk ();
                }
                blanks ();
                if (!streq (line + lptr, ")")) {
                        if (!match (","))
                                error ("expected comma");
                }
                if (endst ())
                        break;
        }
        stkp = 0;
        argtop = argstk;
        while (argstk) {
                if (amatch ("register", 8)) {
                        if (amatch("char", 4))
                                getarg(CCHAR);
                        else if (amatch ("int", 3))
                                getarg(CINT);
                        else
                                getarg(CINT);
                        ns();
                } else if (amatch ("char", 4)) {
                        getarg (CCHAR);
                        ns ();
                } else if (amatch ("int", 3)) {
                        getarg (CINT);
                        ns ();
                } else {
                        error ("wrong number args");
                        break;
                }
        }
        statement(YES);
        printlabel(fexitlab);
        col();
        nl();
        modstk (0);
        gret ();
        stkp = 0;
        locptr = STARTLOC;

}
Exemple #26
0
 void CodeGen::assignmentCode(realSlotRef* dataRef) {
   prologue(true, 0);
   move(Temp2, ReceiverReg);
   assignment(ReceiverReg, dataRef, ArgLocation(0));
   epilogue(Temp2);
 }
Exemple #27
0
bool GPT::compile(const list<string>& ifnames, bool genBinary){  
  bool success = false;
  stringstream s;

  if(!prologue(ifnames)) {
    return false;
  }

  string ofname = _outputfile;
  if(!_useOutputFile) {
    if(!genBinary) {
      ofname += ".asm";
    } 
    #ifdef WIN32
    else
    {      
      ofname += ".exe";      
    }
    #endif
  }

  try{
    X86Walker x86(_stable);
    string asmsrc = x86.algoritmo(_astree);

    string ftmpname = createTmpFile();
    ofstream fo;

    if(!genBinary) { //salva assembly code
      fo.open(ofname.c_str(), ios_base::out);
      if(!fo) {
        s << PACKAGE << ": não foi possível abrir o arquivo: \"" << ofname << "\"" << endl;
        GPTDisplay::self()->showError(s);
        goto bail;
      }
      fo << asmsrc;
      fo.close();
    } else { //compile
      fo.open(ftmpname.c_str(), ios_base::out);
      if(!fo) {
        s << PACKAGE << ": erro ao processar arquivo temporário" << endl;
        GPTDisplay::self()->showError(s);
        goto bail;
      }
      fo << asmsrc;
      fo.close();

      stringstream cmd;
      cmd << "nasm -O1 -fbin -o \"" << ofname << "\" " << ftmpname;

      if(system(cmd.str().c_str()) == -1) {
        s << PACKAGE << ": não foi possível invocar o nasm." << endl;
        GPTDisplay::self()->showError(s);
        goto bail;
      }

      #ifndef WIN32
        cmd.str("");
        cmd << "chmod +x " << ofname;
        system(cmd.str().c_str());
      #endif
    }
  
    success = true;

    bail:
      if(ftmpname.length()>0) {
         unlink(ftmpname.c_str());
      }
    return success;
  } catch(SymbolTableException& e) {
      s << PACKAGE << ": erro interno: " << e.getMessage() << endl;
      GPTDisplay::self()->showError(s);
  }
}
Exemple #28
0
E_Node::~E_Node(){
    prologue("E_Node", "~E_Node");
    epilogue("E_Node", "~E_Node");
}
Exemple #29
0
E_Owner* E_Node::get_owner() const {
    prologue("E_Node", "get_owner");
    epilogue("E_Node", "get_owner");
    return owner;
}
Exemple #30
0
void E_Node::set_owner(E_Owner* owner) {
    prologue("E_Node", "set_owner");
    this->owner = owner;
    epilogue("E_Node", "set_owner");
}