History log of /frameworks/compile/slang/slang_rs_export_type.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
277fd5e6545c8ba1272027ee6e6bc55a96316dc0 14-Jan-2016 David Gross <dgross@google.com> Add Java reflection for "#pragma rs reduce".

- test.py now recognizes "Script*.java.expect" files as masters for comparing
reflected code the same way "stderr.txt.expect" and "stdout.txt.expect" are
masters for comparing compiler stderr and stdout.
- gReflectionTypes[] now has a '"common name" in script (C99)' column (e.g., "short" is
the common name by which a type appears in script code, in contrast with "int16_t"
which is the name by which a type is reflected in NDK code).

Bug: 23535724
Change-Id: I7960968bb98a17e33fe23415f7927cac537b72a3
2907b2a2768bc32f75867513528c8d7419e44780 22-Dec-2015 David Gross <dgross@google.com> Minor miscellaneous cleanup to type export facility.

(This is needed by general reduction.)


Make certain functions const-clean.

TypeExportable() needs to recognize that it cannot export function
types, rather than asserting if it sees them.

Add comments to gReflectionTypes[] for readability.

When attempting RSExportType::Create(), allow a variable "containing"
the type (not "of" the type) to be specified. This is important
because certain error message reporting absolutely requires the
variable to be known -- such as when
ConstantArrayTypeExportableHelper() wants to report something like
"multidimensional arrays cannot be exported".

Change-Id: Iff49effdf7cb71184af5846217fde5a493ce61e9
048eb8a363270f088ee8e6879bc6620cfe97392d 17-Dec-2015 David Gross <dgross@google.com> Merge "Cleanup: RSExportType::getSize() has inconsistent semantics."
657d20afa621219c1eed72178d1325fd4409f458 17-Dec-2015 David Gross <dgross@google.com> Cleanup: RSExportType::getSize() has inconsistent semantics.

This is a virtual method with different semantics for different
classes in the type hierarchy:
RSExportPrimitiveType: Returns number of bytes occupied by type
RSExportPointerType: Returns 1
RSExportVectorType: Returns number of bytes occupied by one element
(i.e., of the component type)
RSExportMatrixType: Returns 1
RSExportConstantArrayType: Returns the number of array elements
RSExportRecordType: Returns 1

The fix is to replace this method with methods whose names
indicate their actual semantics.

Bug: 26235282
Change-Id: Ic7c5cfd1b73a0b6e7e6fd4ed0495de3877adf0e8
13fad85b3c99a37c17d8acfec72f46b8ee64e912 24-Nov-2015 Stephen Hines <srhines@google.com> Void pointers can't be exported.

Bug: http://b/25853842

Change-Id: I5b11fd14b6cd57a06522e921c62ed033488aa08e
7682b663581dd8f67b422f6f2f31692ab2f870e3 31-Jul-2015 Matt Wala <wala@google.com> Add Java reflection for reduce-style kernels in slang.

Bug: 22631253

Change-Id: I43de647a45c02d51cb256d206b64e159daf13864
ab94bccca64c9b126cbd1b732aa5e681d8639b99 12-Jun-2015 Stephen Hines <srhines@google.com> Move the error for pointers in structures earlier in the compile.

Bug: 21597073

This fixes an issue where a function argument is not checked for
compatibility until the reflected code generation (at which point the
message is far more cryptic). We do this by checking parameters for
externally-visible functions and externally-visible globals in our
ValidateType() routine.

Change-Id: I5ab9db1a11ed0e395c7623f1c9997632da057269
fe41c8da501e5a742f1aa6fade2592b4b80bca3b 06-Sep-2014 Stephen Hines <srhines@google.com> am 340b5550: Fix dangling reference to a local std::string.

* commit '340b5550cf63b6beae3b12c2e91377bce7704c34':
Fix dangling reference to a local std::string.
340b5550cf63b6beae3b12c2e91377bce7704c34 05-Sep-2014 Stephen Hines <srhines@google.com> Fix dangling reference to a local std::string.

Bug: 16031597

llvm::StringRefs are just lightweight wrappers around strings, and don't
retain/own any of the storage for the actual underlying string. This causes
lifetime issues if any local std::string objects that are then wrapped by
llvm::StringRef ever escape. When the local object goes out of scope, we are
left with a dangling reference.

Valgrind helped us to catch this happening for constant array exports, which
only ever use a statically named "<ConstantArray>" reference, so we can
simply replace it with static C string (wrapped by llvm::StringRef).

Change-Id: I0a9fae2687bc9f53d091d56cf15f99bb75ca46e4
5abbe0e9ca2508260b627ffef2bf01e2554e8357 13-Aug-2014 Chris Wailes <chriswailes@google.com> Replace the NULL macro with nullptr literal.

Change-Id: I33609969cd0d7aa55eaa83fb2c65f5faa6d55fa0
a6bce2db689b1ad086860ed3f5845a00489e3a49 05-Aug-2014 Tim Murray <timmurray@google.com> Fix two bugs for 64-bit slang.

The first is to handle structs in invoke parameter lists by assuming struct and
not struct*. The second is to not cache LLVM types for RS object types because
it breaks on 64-bit compilation.

Cherry-pick of d56a92fc2b1d417ce53d9550548fe1661fa37d40

Change-Id: I26d7dd7395ef0146eb84d43cbec5cf8d49d09697
d56a92fc2b1d417ce53d9550548fe1661fa37d40 05-Aug-2014 Tim Murray <timmurray@google.com> Fix two bugs for 64-bit slang.

The first is to handle structs in invoke parameter lists by assuming struct and not struct*. The second is to not cache LLVM types for RS object types because it breaks on 64-bit compilation.

Change-Id: I26d7dd7395ef0146eb84d43cbec5cf8d49d09697
796e7b1400d3f3f7c07496d88bb48129ea925bb9 27-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Remove useless "return;" statements.

More cleanups to follow...

Change-Id: Ib8348255273771c1e9ff07e79bd7fbc8f2795a5b
b095e05fef8f0230ab42eaed7a06c3b2d698189a 17-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Replace macros with equivalent inline functions.

Change-Id: Ibb9db8ffe20513ca1ec56403c632e10e82a4fe86
01321838204e213b314f7d6fa5bfc1f94dbf347e 23-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Remove obsolete comments

Change-Id: I30ca59ef860fbc976b8fe6bc21cbd50146b19a6a
eca0534a31b6185d6ab758f5e97acd7a4cb21e8e 15-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Add details to the TODO, simplify dummy names

Change-Id: I37451d8217c3d61ea76db377785045edb2d5c4b0
c95381a2c3b6e9117901eef0687e861e4d533bfe 15-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Make virtual getTypeStoreSize and getTypeAllocSize

Change-Id: I898d7b21d7856559e75d80c6147fc4b4229c75dd
cec9b65aa890dea58e39951900ae13efb8d11703 15-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Move DataType enum out of RSExportPrimitiveDataType.

It applies to more than just Primitives and should not have been in there.

Change-Id: If2b6a9d2a87a05176a74bcf7212f65cf1cdf67fe
2354442e34a47e27dad019df96062c7f620e853a 15-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Remove obsolete unused code

Change-Id: Iead651dc9e0321d36bb653bc178ac1a9af6d34f9
474655a402e70cb329e1bcd4ebbe00bdc5be4206 29-Apr-2014 Jean-Luc Brouillet <jeanluc@google.com> Remove rs_spec_gen and associated macros.

Also, enable new data types to be defined, out of order.
More CLs are coming to continue refactoring the code and removing

modified: Android.mk
deleted: RSSpec.mk
modified: slang_rs_export_element.cpp
modified: slang_rs_export_type.cpp
modified: slang_rs_export_type.h
modified: slang_rs_metadata_spec_encoder.cpp
modified: slang_rs_object_ref_count.cpp
modified: slang_rs_object_ref_count.h
deleted: slang_rs_spec_table.cpp
modified: slang_rs_type_spec.h

Change-Id: I3eb3e4357bbe9af26011df714795de8e495fec68
ee4016d1247d3fbe50822de279d3da273d8aef4c 11-Apr-2014 Tim Murray <timmurray@google.com> Update Slang for Clang/LLVM 3.5a.

Change-Id: Icd59efa1197098076555c505c31939866e504a83
d3f7527b105d21f1c69d3473eb88a762f2c3ab5a 17-Jan-2014 Jean-Luc Brouillet <jeanluc@google.com> Add ReportErrror/Warning to RSContext.

Remove a lot of boilerplate code by adding error reporting methods to RSContext. There are still a few additional files that could be cleaned. That will be for another CL someday.

Change-Id: I6a261735720227ac87d94dbdea5ce4a7b8ef6cca
48d893dc7794b3cfb74f35955ca763ee4170f9ad 07-Dec-2013 Stephen Hines <srhines@google.com> Support reflection of enums.

Prior versions would just crash when attempting to reflect an enum type.
This patch maps enums to integers for reflection in Java.

Change-Id: I5b278d670564ceb606a6b96804f76a798bedc89c
11274a7324b478ec13e1d10a1b81350b34a65ab1 27-Sep-2012 Stephen Hines <srhines@google.com> Validate FS (and RS) ASTs.

This change adds a new RSCheckAST class that is used to handle validation
of the final AST. The checks include existing RS checks (for accepted types)
and new checks for Filterscript (like disallowing pointers, unions and
> 32 bit types completely). The refactoring also fixes a subtle union bug
that existed in prior versions of llvm-rs-cc. We also add an implicit
pragma for "rs_fp_relaxed" by default on Filterscript.

Bug: 7166741

Change-Id: Ia077783b4caba0bbd89df2ab3827e9f4d1009eea
1f6c331d622ac645ab68a016aa4c577998547373 04-Jul-2012 Stephen Hines <srhines@google.com> Fix reflection of setters for unsigned primitive types.


We now generate set_*() functions for unsigned types by creating a single
element FieldPacker and stuffing it with the larger Dalvik type. Reusing
FieldPacker in this way allows us to validate that the input is non-negative
and within the appropriate range (i.e. not really using more bits than the
unsigned C type should).

This change also fixes a subtle race where the Dalvik and script side can
disagree about a variable's value. All set_*() methods need to be synchronized,
and we must do the Dalvik update after validating the input data.

Change-Id: I7b2371206848ebbf0b0752779cb6c98cec1ab5f6
0d26cef64debfaa6862a27587c1fd0d30baa3b1d 02-May-2012 Stephen Hines <srhines@google.com> Refactor using genSetExportVariable().


Change-Id: I3c830b84c6f863faed8e36da625447bdf416579e
a6b54146b93eec68f6daa4b1877639cdc34801dc 10-Apr-2012 Stephen Hines <srhines@google.com> Reflect element/dim information for FieldPacker.


Change-Id: Ie24b3ce17817b98e8b651f7ec1304dcd18c8c062
d5a84f6d49d64738e4bb7c9dea7242e48acad959 05-Apr-2012 Stephen Hines <srhines@google.com> Generate an error when exporting RS objects in structs/arrays.


Note that this error triggers when the following conditions are met:
1) We are running with a pre-JB target API.
2) We detect an RS object type inside another composite (struct/array) type.
3) The variable is going to be exported (i.e. non-static).
4) The variable must also be of a non-pointer type, since pointers only
reflect a bind() routine that does not use FieldPacker.

Change-Id: Id7ca47a4affed2a8774d1c9644e11d4ab02ff27f
5bfec8dd08b3bde9ba3b331e2115210b0e910eae 04-Apr-2012 Stephen Hines <srhines@google.com> Revert "Generate an error for exporting rs_objects in structs/arrays."

This reverts commit f5abb503e67587ad89bcec99ed925d4a75448dcd
f5abb503e67587ad89bcec99ed925d4a75448dcd 04-Apr-2012 Stephen Hines <srhines@google.com> Generate an error for exporting rs_objects in structs/arrays.


This is only an error in pre-JB builds that can't support proper ref-counting
within a FieldPacker.

Change-Id: Ib96b5ec2befa48ec44890391e518ad557e9a9117
1b6a0883cd6984e11e59b0c847fb334df1f41afc 12-Mar-2012 Jason Sams <jsams@google.com> start cpp reflection


Change-Id: Iede58fde457d16293345e741f80109f89e653ad5
2b8fb64be3047df940a219872b331eb11de2758d 09-Mar-2012 Stephen Hines <srhines@google.com> Removing DataKind completely from llvm-rs-cc.


Change-Id: I76fdb98fa60bd70468d088f9034acf00e443d6c8
fdd1ba13a69501a1b91fdc9be31413215d467497 09-Mar-2012 Stephen Hines <srhines@google.com> Add getRSReflectionType to facilitate new C++ code.


Change-Id: I5d1efdbde6eb0b7bb139bdf672a056a4aa5f26e1
9207a2e495c8363606861e4f034504ec5c153dab 21-Oct-2011 Logan Chien <loganchien@google.com> Apply changes to migrate to LLVM upstream Oct 20th 2011.

- StructType::isAnonymous is renamed to StructType::isLiteral.

- PassManagerBuilder has been moved from
llvm/Support/PassManagerBuilder.h to

- Include llvm/Transforms/IPO.h for llvm::createInternalizePass.

- clang::DiagClient has be renamed to clang::DiagnosticConsumer.
Besides, we have to implement one additional pure virtual method
'clone' for create a clone of slang::DiagnosticBuffer.

- llvm::Linker::LinkModules comes with one additional parameter.
Passing llvm::Linker::DestroySource should be equivalent to
the old code we were using.

- slang::Slang is now derived from clang::ModuleLoader and implemented
loadModule pure virtual method (though we will always return NULL.)

- clang::Preprocessor is taking one additional parameter for

- clang::Diagnostic has been changed. A lot of the method has been
moved to clang::DiagnosticsEngine, and we can no longer 'Report' a
diagnostic from clang::Diagnostic. We have to use
clang::DiagnosticEngine instead.

- llvm::setCodeModel has been removed.

Change-Id: I1f2a4cbeaf61a8ed1d0d635a5a0e1baa90d99d07
ecddee364d731c09c77b4c3fa647fa4f50e26756 21-Jul-2011 Stephen Hines <srhines@google.com> Fix style issues.

Change-Id: I646b5232cfac772c5a310b62f435a2cc79b2c831
7c67e578c760408dba0c2f64da6e074dd8b56fd9 19-Jul-2011 Shih-wei Liao <sliao@google.com> Apply changes to migrate to upstream API.

Change-Id: Ibe6060a0d1c42b9725524de7f4cb95551b711717
78e69cb06b9b0683b2ac9dcafde87b867690ef2f 23-Apr-2011 Stephen Hines <srhines@google.com> Forbid RS objects from being contained in unions.

This change also refactors variable validation in general for RS.

Change-Id: I4527986a07c9cf2babdc5b855cdb1f00e3535d5b
f2174cfd6a556b51aadf2b8765e50df080e8f18e 10-Feb-2011 Stephen Hines <srhines@google.com> Handle struct reference counting.

Bug: 3092382

Change-Id: I215bd8245324ec2b7752a7c40817e3e5cd1c0e00
feaca06fcb0772e9e972a0d61b17259fc5124d50 04-Feb-2011 Stephen Hines <srhines@google.com> Zero-initialize structs containing RS objects.

Bug: 3092382
Change-Id: I2fd80777db7ed52d8c0a1a598567399e08ce06a2
b3a12fe7c18a06f99201dc491a932a90ab7d975c 27-Jan-2011 Stephen Hines <srhines@google.com> Add Slang support for rs_object_slots metadata.

This is added to support proper cleanup of RS resources. We were leaking some
global resources because there was no way to tell which slots to clear.

Change-Id: Ib452facb1b83d1f2aecd9686f46ef726e427161d
b: 3381615
2ef9bc0cfbca2152d972c0975005f8c897c2a42c 14-Dec-2010 Stephen Hines <srhines@google.com> Convert fprintf -> diagnostic messages.

Proper support/test for multi-level pointer types.
Proper diagnostics for bit fields, which are currently
not supported.

Bug: 2954471
Change-Id: I347f14f02fcf7fbef9f6e5dde5b4e948391a0691
dd6206bb61bf8df2ed6b643abe8a29c48a315685 10-Dec-2010 Stephen Hines <srhines@google.com> Arrays of width 3 vector types cannot be exported.

Bug: 3171195
Change-Id: I7deab4ab9c7f8650bce7c597fae2a0dc013f6f71
e5e64432476a44b59c61ded233b1149109c7a7c3 03-Dec-2010 Stephen Hines <srhines@google.com> Improved error messages for structs.

This change also adds two new tests for anonymous structures (both with and
without an associated typedef). I have also updated test.py to support a more
verbose output for dumping the actual test commands that are executed.

Change-Id: Ic1edc8d4e98c2017611430eb581c335146ccc927
c808a99831115928b4648f4c8b86dc682594217a 30-Nov-2010 Stephen Hines <srhines@google.com> Add prelim error check for pointers in structs.

Bug: 2954471
Change-Id: Icacf67dd3eeb3dda67e1eae3d54e11f7efa6c680
e639eb5caa2c386b4a60659a4929e8a6141a2cbe 09-Nov-2010 Stephen Hines <srhines@google.com> Improve code style.

Change-Id: I26e043849bce2a4b41ae132fbe0c882f4a6f112f
b1771ef128b10c4d4575634828006bfba20b1d9c 22-Oct-2010 Zonr Chang <zonr@google.com> Exclude rs_matrixNxN from being RS object type.

rs_matrix{2x2, 3x3, 4x4} (RS matrix type) is very different than RS
object type like rs_allocation. This commit teaches llvm-rs-cc to learn

NOTE: Currenrly RS matrix type + RS object type = RS specific type.
a7a828d1ff95c5a8f2327f56a137a2bcb3a9a8fa 21-Oct-2010 Zonr Chang <zonr@google.com> Add convertToSpecType() for every RSExportType derivative.

convertToSpecType() can convert a RSExportType (used by llvm-rs-cc
internally for reflection engine) into union RSType (used by external
source such as libbcc) defined in the slang_rs_type_spec.h.
3cd3dd327445fcfa49f0e96cb2de2055bce541e9 21-Oct-2010 Zonr Chang <zonr@google.com> Bug fix: support self-referential struct type.
7363d8430db732c42d392fcab47cf0e3f8eb4515 21-Oct-2010 Zonr Chang <zonr@google.com> Revert "Bug fix: support self-referential struct type."

This reverts commit af5cef07b48a678a416d554b037e0d6dbe958eb4.
d6f9fedf1b32c27c0bcaddd13d7b741ab5ad74b8 21-Oct-2010 Zonr Chang <zonr@google.com> Bug fix: support self-referential struct type.
a65ec168e41e3ee9c6e8ac04cde694bbbfc2590a 16-Oct-2010 Zonr Chang <zonr@google.com> Unify type spec by creating rs-spec-gen.

rs-spec-gen (slang_rs_spec_table.cpp) will help llvm-rs-cc to share
the RS spec it used across the other projects. This will makes code
cleaner and therefore easier to add new spec/synchronize the spec
between other project (e.g., libbcc and libRS).

This CL is the first part. It eliminated the needs of
slang_rs_export_element_support.inc and
641558f02fe6ce0ee3ae5076eb366c25e2ad5903 12-Oct-2010 Zonr Chang <zonr@google.com> Implement one-definition-rule (ODR) feature.

When compiling multiple RS files, we say two RS files A and B break ODR

1. They have at least one common struct named [S] and [S] will be reflected
to ScriptField_[S].java, and
2. [S] defined in A is not *exactly the same* (number of fields, field
type and field name) as the one defined in B.

This CL detects such error.
c383a500aa59423264811be3874461bf8adbfea0 11-Oct-2010 Zonr Chang <zonr@google.com> Prepend legal announcement in all files.

Release libslang/llvm-rs-cc/llvm-rs-link under Apache 2.0 license.
a5d2c232d56b04292cb51c8fb343aef990f7970f 12-Oct-2010 Stephen Hines <srhines@google.com> Support for unsigned long and unsigned long long.

Change-Id: I8e3b6a90fa9119f3d98c5f276df2590b7690d22b
a41ce1d98094da84643995d40d71c529905123fc 05-Oct-2010 Zonr Chang <zonr@google.com> Fix memory leak of RSExport* object create in processExport(). Now, they will
properly be freed after their associated RSContext was destroyed.
6b6320ad5faee29e0f75fe937e40156746ef9e80 05-Oct-2010 Zonr Chang <zonr@google.com> De-virtualize the RSExportType::getClass().
2e1dba6c779a0ae55c76d36a3c03553e16725ab7 05-Oct-2010 Zonr Chang <zonr@google.com> Rewrite the RSExportConstantArrayType to better support reflecting
constant-sized array variable.
0da0a7dc51c25943fe31d0bfccbdfee326a3199c 05-Oct-2010 Zonr Chang <zonr@google.com> 1. Rewrite reflection of parameter packet in RSExportFunc. In order to
generate the correct call (i.e., all parameters in the call instruction
must match the target function signature) regardless of ABI, we construct type
of parameter packet directly from target function prototype (which may not be
the same as the one declared in the source since Clang may modified it to
the type which is better supported by the target ABI.)
2. Rewrite reflection of RSExportRecordType to use clang::ASTRecordLayout. This
corrects the reflection of struct type when tail padding and field alignment
involve. This improves stability of RSExportRecordType reflection.
92b344a51c6c4934e96882bd401e4b13d6d03db8 05-Oct-2010 Zonr Chang <zonr@google.com> Create RSExportMatrixType which is a subclass of RSExportType
to support rs_matrix{2x2,3x3,4x4} explicitly.
6315f76e3cc6ff2d012d1183a0b030d4ff0dc808 05-Oct-2010 zonr <zonr@google.com> More coding style fixing to improve the readability. No actual semantics
changed. This also makes cpplint happy.