[pypy-commit] pypy llvm-translation-backend: Implement field offset calculation for FixedSizeArrays.
mjacob
noreply at buildbot.pypy.org
Sun Nov 22 07:23:07 EST 2015
Author: Manuel Jacob <me at manueljacob.de>
Branch: llvm-translation-backend
Changeset: r80829:2980f62bc491
Date: 2015-11-22 11:55 +0100
http://bitbucket.org/pypy/pypy/changeset/2980f62bc491/
Log: Implement field offset calculation for FixedSizeArrays.
diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -237,9 +237,14 @@
indices.append('i64 0')
if isinstance(offset, llmemory.FieldOffset):
type = database.get_type(offset.TYPE)
- indices.append('i32 {}'.format(
- type.fldnames_wo_voids.index(offset.fldname)))
- return offset.TYPE._flds[offset.fldname]
+ if isinstance(type, BareArrayType):
+ assert offset.fldname.startswith('item')
+ indices.append('i32 {}'.format(int(offset.fldname[4:])))
+ return offset.TYPE.OF
+ else:
+ indices.append('i32 {}'.format(
+ type.fldnames_wo_voids.index(offset.fldname)))
+ return offset.TYPE._flds[offset.fldname]
if isinstance(offset, llmemory.ArrayLengthOffset):
if offset.TYPE._gckind == 'gc':
indices.append('i32 1')
More information about the pypy-commit
mailing list