Esempio n. 1
0
 def _store_away_exception(self):
     # etype, evalue: ty_char_ptr
     etype = llvm_rffi.LLVMBuildLoad(self.builder, self.cpu.const_exc_type,
                                     "")
     llvm_rffi.LLVMBuildStore(self.builder, self.cpu.const_null_charptr,
                              self.cpu.const_exc_type)
     llvm_rffi.LLVMBuildStore(self.builder, etype,
                              self.cpu.const_backup_exc_type)
     evalue = llvm_rffi.LLVMBuildLoad(self.builder,
                                      self.cpu.const_exc_value, "")
     llvm_rffi.LLVMBuildStore(self.builder, self.cpu.const_null_charptr,
                              self.cpu.const_exc_value)
     llvm_rffi.LLVMBuildStore(self.builder, evalue,
                              self.cpu.const_backup_exc_value)
Esempio n. 2
0
 def generate_NEW_WITH_VTABLE(self, op):
     sizedescr = self.cpu.class_sizes[op.args[0].getint()]
     res = self._generate_new(self.cpu._make_const_int(sizedescr.size))
     self.vars[op.result] = res
     loc = self._generate_field_gep(op.result, self.cpu.vtable_descr)
     value_ref = self.getintarg(op.args[0])
     llvm_rffi.LLVMBuildStore(self.builder, value_ref, loc, "")
Esempio n. 3
0
 def generate_SETARRAYITEM_GC(self, op):
     loc = self._generate_array_gep(op)
     arraydescr = op.descr
     assert isinstance(arraydescr, ArrayDescr)
     getarg = self.cpu.getarg_by_index[arraydescr.itemsize_index]
     value_ref = getarg(self, op.args[2])
     llvm_rffi.LLVMBuildStore(self.builder, value_ref, loc, "")
Esempio n. 4
0
 def generate_SETFIELD_GC(self, op):
     fielddescr = op.descr
     loc = self._generate_field_gep(op.args[0], fielddescr)
     assert isinstance(fielddescr, FieldDescr)
     getarg = self.cpu.getarg_by_index[fielddescr.size_index]
     value_ref = getarg(self, op.args[1])
     llvm_rffi.LLVMBuildStore(self.builder, value_ref, loc, "")
Esempio n. 5
0
 def _generate_fail(self, args, index):
     self.cpu._ensure_out_args(len(args))
     for i in range(len(args)):
         v = args[i]
         if v.type == INT:
             value_ref = self.getintarg(v)
             ty = self.cpu.ty_int_ptr
         else:
             value_ref = self.getptrarg(v)
             ty = self.cpu.ty_char_ptr_ptr
         llvmconstptr = self.cpu._make_const(self.cpu.in_out_args[i], ty)
         llvm_rffi.LLVMBuildStore(self.builder, value_ref, llvmconstptr)
     llvm_rffi.LLVMBuildRet(self.builder, self.cpu._make_const_int(index))
Esempio n. 6
0
 def _generate_new_array(self, op, ty_array, const_item_size,
                         const_index_array, const_index_length):
     length_ref = self.getintarg(op.args[0])
     if const_item_size == self.cpu.const_one:
         arraysize_ref = length_ref
     else:
         arraysize_ref = llvm_rffi.LLVMBuildMul(self.builder, length_ref,
                                                const_item_size, "")
     size_ref = llvm_rffi.LLVMBuildAdd(self.builder, const_index_array,
                                       arraysize_ref, "")
     res = self._generate_new(size_ref)
     loc = self._generate_len_gep(res, ty_array, const_index_length)
     llvm_rffi.LLVMBuildStore(self.builder, length_ref, loc, "")
     self.vars[op.result] = res
Esempio n. 7
0
 def generate_UNICODESETITEM(self, op):
     loc = self._generate_gep(op, self.cpu.ty_unicode_ptr,
                              self.cpu.const_unicode_index_array)
     value_ref = self.getunichararg(op.args[2])
     llvm_rffi.LLVMBuildStore(self.builder, value_ref, loc, "")
Esempio n. 8
0
 def generate_STRSETITEM(self, op):
     loc = self._generate_gep(op, self.cpu.ty_string_ptr,
                              self.cpu.const_string_index_array)
     value_ref = self.getchararg(op.args[2])
     llvm_rffi.LLVMBuildStore(self.builder, value_ref, loc, "")