示例#1
0
文件: gc.py 项目: TheDunn/flex-pypy
    def _zeromalloc(self, codewriter, targetvar, size=1, atomic=False,
                    exc_flag=False):
        """ assumes malloc of word size """
        boundary_size = 0

        word = self.db.get_machine_word()
        uword = self.db.get_machine_uword()

        fnname = '%pypy_malloc' + (atomic and '_atomic' or '')

##        XXX (arigo) disabled the ring buffer for comparison purposes
##        XXX until we know if it's a valid optimization or not

##        if self.exc_useringbuf and exc_flag:
##            fnname += '_ringbuffer'
##            # dont clear the ringbuffer data
##            atomic = False 

        # malloc_size is unsigned right now
        sizeu = '%malloc_sizeu' + self.get_count()        
        codewriter.cast(sizeu, word, size, uword)
        codewriter.call(targetvar, 'sbyte*', fnname, [word], [size])

        if atomic:
            codewriter.call(None, 'void', '%llvm.memset' + postfix(),
                            ['sbyte*', 'ubyte', uword, uword],
                            [targetvar, 0, sizeu, boundary_size],
                            cconv='ccc')        
示例#2
0
文件: gc.py 项目: TheDunn/flex-pypy
    def _zeromalloc(self, codewriter, targetvar, size=1, atomic=False,
                    exc_flag=False):
        """ assumes malloc of word size """
        uword = self.db.get_machine_uword()
        boundary_size = 0

        # malloc_size is unsigned right now
        codewriter.malloc(targetvar, "sbyte", size)
        codewriter.call(None, 'void', '%llvm.memset' + postfix(),
                        ['sbyte*', 'ubyte', uword, uword],
                        [targetvar, 0, size, boundary_size],
                        cconv='ccc')               
示例#3
0
文件: gc.py 项目: griels/pypy-sc
    def _zeromalloc(self, codewriter, targetvar, size=1, atomic=False,
                    exc_flag=False):
        """ assumes malloc of word size """
        XXX
        word = self.db.get_machine_word()
        boundary_size = 0

        # malloc_size is unsigned right now
        codewriter.malloc(targetvar, "i8", size)
        codewriter.call(None, 'void', '@llvm.memset' + postfix(),
                        ['i8*', 'i8', word, word],
                        [targetvar, 0, size, boundary_size])
示例#4
0
文件: gc.py 项目: griels/pypy-sc
    def _zeromalloc(self, codewriter, targetvar, size=1, atomic=False,
                    exc_flag=False):
        """ assumes malloc of word size """
        boundary_size = 0
        word = self.db.get_machine_word()
        fnname = '@pypy_malloc' + (atomic and '_atomic' or '')

##        XXX (arigo) disabled the ring buffer for comparison purposes
##        XXX until we know if it's a valid optimization or not

##        if self.exc_useringbuf and exc_flag:
##            fnname += '_ringbuffer'
##            # dont clear the ringbuffer data
##            atomic = False 

        codewriter.call(targetvar, 'i8*', fnname, [word], [size])

        if atomic:
            codewriter.call(None, 'void', '@llvm.memset' + postfix(),
                            ['i8*', 'i8', word, word],
                            [targetvar, 0, size, boundary_size])
示例#5
0
 def _set_wordsize(self, s):
     s = s.replace('UWORD', self.db.get_machine_uword())
     s = s.replace( 'WORD', self.db.get_machine_word())
     s = s.replace('POSTFIX', postfix())
     return s