History log of /frameworks/compile/slang/slang_rs_object_ref_count.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
31d2ea3cb95fde60862e7032148c36f6edfbec5c 15-Apr-2017 Yang Ni <yangni@google.com> Fixed reference counting for function parameters

Bug: 25233132

For each function parameter that is object-typed or object-containing,
introduces a local variable and sets its value to the parameter.
This way, the sys ref counts of objects in the parameter are
incremented, preventing the objects being deleted if the parameter
is overwritten inside the function.

rsClearObj() is called on the rs_object-typed or -containing parameters
at the end of the function and at exiting points of the function.

This CL also fixes missed cases of returning structs that contain
rs objects, with an enhanced lit test to cover that.

Test: slang lit tests + RSTest and CTS on x86_64 emulator

Change-Id: Ic271c5e279b1f398ff233771b28d0acc5ac47c34
/frameworks/compile/slang/slang_rs_object_ref_count.h
d9ed6b51a3fe997aefdcd360f8bfc40b17c9ab91 31-Mar-2016 Stephen Hines <srhines@google.com> Use empty list initializers to construct all zero-initialized variables.

Bug: http://b/24008889

In the past, we always tried to construct appropriate full
zero-initializers for uninitialized variables that contained any RS
object types (like rs_allocation) or any RS matrix types. For some
structures containing rs_matrix* types, we would insert an initializer
that uses just a single raw 0. While this is almost correct, it leads to
an invalid AST (that Clang is still happy to do the right thing with, for
now). Instead, we can rely on a supported extension that allows
zero-initialization with empty initializer lists (like in C++11, but for
older versions of C too). Switching to the empty list allows us to
remove a particularly tricky (and incomplete) section of code.

Change-Id: Id2e4ff88289af8b1e95cc9660b97c5c5e64f79ff
/frameworks/compile/slang/slang_rs_object_ref_count.h
5767c359bac779b5d76d668ca5699fd5a0e3efc5 23-Mar-2016 Yang Ni <yangni@google.com> Initialize temp var for a return value

Bug: 27698337

This is the temporary variable introduced for the expression used in
a return statement.

We use rsSetObject() to set the value of the temporary variable to
the original expression from the return statement, and to bump up
the sysRefCount of the temp.

However, to have rsSetObject() work properly, the temp has to be zero
initialized.

Change-Id: I0efb83fc7d54e95bb4d7a956f3f82b6d85188390
/frameworks/compile/slang/slang_rs_object_ref_count.h
b478c3dd0a47dc4c0c884d911819c9cf53c46649 16-Jan-2016 Yang Ni <yangni@google.com> Handle return values of rsObject type

Bug: 25570907
Bug: 25777125

This made further improvements over a previous fix on return
values of rsObject type.

1) The temp variable created for a return expression is now set using
rsSetObject() rather than directly put in the initializer of the temp.
This way, the returned rsObject would have a sys ref count of at least
1 and won't become invalid on the return for the caller.

2) On the caller side, introduced another temp variable .rs.tmpXXX for
the result of any function call that returns an rsObject. This temp
is set in the initializer upon declaration, without using rsSetObject().
A destructor is inserted at the end of the enclosing scope for the temp.

3) Both temp variables above are now named with a unique suffix (that is
a unique integer, which starts from 0 and increases monotonically within
the function currently being analyzed and transformed.)

4) Fixed an issue in the previous fix, when there are multiple rsObjects
defined in a block, we will only introduce one temp variable for a
return statement. The previous CL would introduce one temp for each
rsObject, mistakenly.

Change-Id: Id3604f93b166089e3aca896d1c6c509b3ea19bcf
/frameworks/compile/slang/slang_rs_object_ref_count.h
65f23ed862e1a1e16477ba740f295ff4a83ac822 08-Jan-2016 David Gross <dgross@google.com> Add semantic analysis of "#pragma rs reduce" script functions.

Also:
- Make initializer() optional.
- Swap initializer and accumulator in metadata.
- Expose new slang::HasRSObjectType() interface from reference counting engine.

Bug: 23535724
Change-Id: If042e227a1af87c231c867ef20ed4c2082bb1871
/frameworks/compile/slang/slang_rs_object_ref_count.h
5abbe0e9ca2508260b627ffef2bf01e2554e8357 13-Aug-2014 Chris Wailes <chriswailes@google.com> Replace the NULL macro with nullptr literal.

Change-Id: I33609969cd0d7aa55eaa83fb2c65f5faa6d55fa0
/frameworks/compile/slang/slang_rs_object_ref_count.h
796e7b1400d3f3f7c07496d88bb48129ea925bb9 27-May-2014 Jean-Luc Brouillet <jeanluc@google.com> Remove useless "return;" statements.

More cleanups to follow...

Change-Id: Ib8348255273771c1e9ff07e79bd7fbc8f2795a5b
/frameworks/compile/slang/slang_rs_object_ref_count.h
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
/frameworks/compile/slang/slang_rs_object_ref_count.h
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
duplication.

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
/frameworks/compile/slang/slang_rs_object_ref_count.h
3f175af8a0644fb5fc53aa90e01c24f75855c5f7 17-Sep-2011 Stephen Hines <srhines@google.com> Fix .rs.dtor scoping bug.

BUG=5267595

This change makes sure to scope any helper variables (like rsIntIter) to the
enclosing function (and not make them global). Prior to this change, if an
array iterator was created, it would be marked as a global symbol. The
libbcc library then sometimes removed this global as it was not able to
determine that it was actually used (.rs.dtor is not guaranteed to be called).
A fix should be made to libbcc as well, but the proper fix for llvm-rs-cc is
to scope any helper variable declarations to the calling function.

Change-Id: Ia46654cb0a114f6f5495e32ad1508d7d01e2084b
/frameworks/compile/slang/slang_rs_object_ref_count.h
688e64b2d56e4218c680b9d6523c5de672f55757 24-Aug-2011 Stephen Hines <srhines@google.com> Generate .rs.dtor() to clean up globals.

BUG=5186750

Change-Id: I9d1996153fe774a5ce95646a8a2e07aa6e7fa85f
/frameworks/compile/slang/slang_rs_object_ref_count.h
d0b5edd02be5f09c1d8d211f4a06b031a7b66510 19-Apr-2011 Stephen Hines <srhines@google.com> Disallow union copies that contain RS object types

This also cleans up RSObjectRefCount's usage of ASTContext a bit.

BUG=4283858

Change-Id: I9ca61e27fc5d6eb1befc2da4fe2d157f5936a56f
/frameworks/compile/slang/slang_rs_object_ref_count.h
292e00a0259ac28cac1055cb6077cf6fc7c6743c 19-Mar-2011 Stephen Hines <srhines@google.com> Add support for RSASTReplace for ref-counting.

BUG=3092382

Change-Id: Ia17d40753952e4a021b39549a082cc4b3f20916c
/frameworks/compile/slang/slang_rs_object_ref_count.h
a0611e66bec148b176404cf6afe4c9ec9b960414 12-Feb-2011 Stephen Hines <srhines@google.com> Initialize structs.

Bug: 3092382
Change-Id: I4b9596c686205bbbc38505ed5dd33d1b968d2fd6
/frameworks/compile/slang/slang_rs_object_ref_count.h
2bb67db8364162b30e6920baddf6c2e890b3ce79 11-Feb-2011 Stephen Hines <srhines@google.com> Replace struct assignments with rsSetObject calls.

Bug: 3092382
Change-Id: I63f16a7dac02eb348b87a6225944d48faa615899
/frameworks/compile/slang/slang_rs_object_ref_count.h
f2174cfd6a556b51aadf2b8765e50df080e8f18e 10-Feb-2011 Stephen Hines <srhines@google.com> Handle struct reference counting.

Bug: 3092382

Change-Id: I215bd8245324ec2b7752a7c40817e3e5cd1c0e00
/frameworks/compile/slang/slang_rs_object_ref_count.h
e79fb5ec220e20bd04cd6f6059cbc9748181ce21 02-Feb-2011 Stephen Hines <srhines@google.com> Handle local RS object initialization properly.

This change properly reference counts local RS object types when they are
statically initialized.

Change-Id: Ib21e8715cf63d2bcba01d332b592516262efb41e
Bug: 3092382
/frameworks/compile/slang/slang_rs_object_ref_count.h
c202d2d64fe0172bcc3999b515a14d3d88532420 26-Jan-2011 Stephen Hines <srhines@google.com> Replace RS object assignments with rsSetObject().

Reference counting works now for all scalar/array types. It still needs to be
modified slightly to support structs, initializers and break/continue.

Change-Id: I6e531df86508f261b784932fca930bc666cb0084
b: 3092382
/frameworks/compile/slang/slang_rs_object_ref_count.h
d5f9d6c8b6944dfc30d4fea68479c2fcc250a62c 16-Dec-2010 Stephen Hines <srhines@google.com> Convert from use of Expr -> Stmt.

This will facilitate rs* array destructors (which use CompoundStmt).

Bug: 3092382
Change-Id: I17d86ccedfb6f40c49a491a80dbced55ed917c8f
/frameworks/compile/slang/slang_rs_object_ref_count.h
4464d825c11349068f2917f9ebee86b721423f3c 12-Nov-2010 Stephen Hines <srhines@google.com> Support local destructor for many return stmts.

This allows us to insert destructor calls to rsClearObject() for all local
variables at the end of their scope (closing curly brace), as well as before
any enclosed return statement. Note that proper support for a local destructor
with break/continue is still unimplemented.

Change-Id: I7c0633d2901b9bc7e1bac8e211b9eae2ac9f6e92
/frameworks/compile/slang/slang_rs_object_ref_count.h
e639eb5caa2c386b4a60659a4929e8a6141a2cbe 09-Nov-2010 Stephen Hines <srhines@google.com> Improve code style.

Change-Id: I26e043849bce2a4b41ae132fbe0c882f4a6f112f
/frameworks/compile/slang/slang_rs_object_ref_count.h
1bdd4978caabcdc9489bdcb7f1cd6087340699e8 09-Nov-2010 Stephen Hines <srhines@google.com> Add simple destructors to local RS objects.

Change-Id: Ie4aa964840b25c3aa8eed257d4ff0a1e4f6ef22a
/frameworks/compile/slang/slang_rs_object_ref_count.h
4b32ffdfc1ac766f8932e7effbcdf7484e804a8e 06-Nov-2010 Stephen Hines <srhines@google.com> Factor out RSObjectRefCount for destructor work.

Change-Id: Ibdacc9e9f15401680bc54747664e187a05f62e25
/frameworks/compile/slang/slang_rs_object_ref_count.h