Coder Social home page Coder Social logo

adobe_source_libraries's People

Contributors

ahmedcharles avatar alexk7 avatar bheath-adobe avatar bobarcher avatar camio avatar casparkielwein avatar fosterbrereton avatar g-217 avatar ilelann avatar jaredadobe avatar jaredwy avatar jbakamovic avatar kingsawyer avatar nikolai3d avatar ramankumarguptaadobe avatar sean-parent avatar thinlang avatar tluxon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adobe_source_libraries's Issues

Question about `adobe::capture_allocator`.

Hello!

When exploring the use of adobe::capture_allocator, I ran into an edge-case.

When creating a vector as such:

// An example object, who's only notable trait is the use of new/delete.
struct BoundryTest_t
{
	BoundryTest_t()
	{
		p = new char[128];
	}

	~BoundryTest_t()
	{
		delete p;
	}

	char* p = NULLPTR;
};

// This function exists in another DLL (bar.dll), not the current DLL (foo.dll).
// Simply calls push_back with default constructor arguments a few times.
void MyFunction(std::vector<BoundryTest_t, adobe::capture_allocator<BoundryTest_t>>& vecTestObjects);

If I'm understanding this correctly - due to the object BoundryTest_t invoking new within the constructor, this causes a memory leak. When MyFunction in foo.dll allocates new instances of BoundryTestVec_t and the constructor is invoked, the construct_at function is run inside the bar.dll. This results in heap corruption in the current foo.dll scope upon the occasion of foo.dll attempting to clean up the vector.

What is the expected workaround for this behavior?

Thank you for your time!

Triage all open PRs and issues in stlab/adobe_source_libraries

Acceptance Criteria

  • All pull requests in a 'review-required' state before 5/25 receive a code review.
  • All outstanding issues created before 5/25 are triaged (either scheduled, closed, "contributions welcome", or have some kind of correspondence)

Use after free detected

assemblage.hpp has assemblage_cleanup_connection member function, which Xcode's Product > Analyze identifies as culpable for use after free, as called within TBindingBehavior<Widget, T>::IBindingBehavior's in its adobe::attach_view_function_to_model<value_type> call.

Unfortunately, this analysis is not easy to copy-and-paste. It's all presented as overlays in the Xcode code editor.

The "action item" here is to run ASL through Xcode's Product > Analyze (the Clang Static Analyzer).

Possible overflow of priority_high_m in sheet

Considering in an automated UI test, (only) a text entry is frequently updated, the priority_m of the backed cell is continuously increased(assigned from priority_high_m++), and will finally overflow.

Possible solutions are:

  1. Declare priority_t as int64_t
  2. Reset priorities:
void sheet_t::implementation_t::flow(cell_bits_t& priority_accessed) {
    ...
    sort(cells, less(), &cell_t::priority);
    ...
    priority_high_m = priority_low_m = 0; // reset priority_high_m & priority_low_m
    for (vector<cell_t*>::iterator f = cells.begin(), l = cells.end(); f != l; ++f) {
        priority_accessed.set((*f)->interface_input_m->cell_set_pos_m);

        // Vacuum "the priority sequence"
        ++priority_high_m;
        (*f)->interface_input_m->priority_m = priority_high_m;
    ...

How about maintaining a priority list of (interface)cell_t?

The Ideas will be:

  1. In add_interface(): prepend an entry to the priority list, and keep the returned iterator as cell_t:priority_m
  2. In touch(), do erase and reinsert to the begin() of priority list
  • Pros:
    • No sort is needed in flow
    • No overflow
  • Cons:
    • Rarely seen using iterator as a member filed? Iterator is a temporary stuff?? Not sure iterator is suitable or may introduce a new type. But considering in raw C, here priority_m is just a pointer to a link node, i.e. a pointer to { link_node *prev; link_node *next; void *data }
    • touch() a batch of cells. The relative priority sequence of cells in the batch is unknown - may need to go through the priority list, and for each node in the batch, erase & reinsert.

Build Issues for clang toolset for linux and windows

The issue occurs when call for build.sh.. I tried to disable std=c++11 but it is not happening
../boost_libraries/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found

include

       ^~~~~~~~~

1 error generated.

"clang++" -c -x c++ -std=c++11 -fconstexpr-depth=1024 -ftemplate-depth=1024 -stdlib=libc++ -std=c++14 -O0 -g -fno-inline -Wall -g -pthread -std=c++11 -fconstexpr-depth=1024 -ftemplate-depth=1024 -stdlib=libc++ -std=c++14 -DADOBE_SERIALIZATION -DADOBE_STD_SERIALIZATION -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_NO_CXX11_NUMERIC_LIMITS=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB -DBOOST_THREAD_USE_LIB=1 -I"." -I".." -I"../boost_libraries" -o "/home/nathbh/adobe/built_artifacts/fccaf884b85829048d264073f9341a53/source/string_pool.o" "source/string_pool.cpp"

adobe_source_libraries CMake build broken on multiple platforms

The CMake build is broken on multiple platforms for what seems to be several reasons.

Acceptance Criteria

  • A successful continuous integration using Github actions for the same windows, Mac, and Linux configurations that stlab/libraries supports

Note that #93 could be used as a start for continuous integration support.

Original Report

Here is my run of ./configure.sh and ./build.sh on MacOS 12.1

$ ./configure.sh
INFO : double-conversion found: skipping setup.
INFO : boost_libraries found: skipping setup.
INFO : No patchfile found for this version of Boost. Skipping.
INFO : b2 found: skipping boostrap.
...
INFO : You are ready to go!

$ ./build.sh
INFO : Make sure you run the configure script before this one to ensure dependencies are
in place.
ERRR : BUILDTOOL unknown. Goodbye.

./cmake_build_all.sh made some progress but then failed with a missing boost include

/Users/ajafri/code/adobe_source_libraries/../boost_libraries/libs/type_i
ndex/include/boost/type_index/type_index_facade.hpp:13:10: fatal error:
'boost/container_hash/hash_fwd.hpp' file not found
#include <boost/container_hash/hash_fwd.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  7%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/fixed-dtoa.cc.o
1 error generated.
make[2]: *** [CMakeFiles/boost_unit_test.dir/Users/ajafri/code/boost_lib
raries/libs/test/src/debug.cpp.o] Error 1
make[1]: *** [CMakeFiles/boost_unit_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  7%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/string-to-double.cc.o
[  8%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/strtod.cc.o
In file included from /Users/ajafri/code/boost_libraries/libs/filesystem
/src/exception.cpp:15:
/Users/ajafri/code/adobe_source_libraries/../boost_libraries/libs/filesy
stem/include/boost/filesystem/path.hpp:33:10: fatal error: 'boost/functi
onal/hash_fwd.hpp' file not found
#include <boost/functional/hash_fwd.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/boost_glob.dir/Users/ajafri/code/boost_librarie
s/libs/filesystem/src/exception.cpp.o] Error 1
make[1]: *** [CMakeFiles/boost_glob.dir/all] Error 2
[  8%] Linking CXX static library libdouble-conversion.a
[  8%] Built target double-conversion
make: *** [all] Error 2

Adobe Begin fails to link in Release Mode

This issue existed in the legacy/ repo and was not migrated here. Adobe Begin's Xcode project fails to link the binary when compiling in release mode. There are several unit test cases that exhibit the same linker error, and I have been able to work around them by turning off optimizations.

Add stlab as a dependency to build

The stlab libraries are already a dependency to support the old copy_on_write which has migrated. We'll take a similar approach to the now migrated forest library, but this requires adding the dependency to the cmake build system for CI.

Build errors when using the USE_SYSTEM_BOOST cmake option.

In CMakeLists.txt, target_link_boost function the correct target names for Boost libraries found by FindBoost()
are Boost::system, Boost::filesystem and Boost::thread.

The current values used ${Boost_XXX_LIBRARY} are not defined and as a result boost includes and libraries are not added to the compiler command line.

Forest constructor exception safety

The code below does the same test with both forest and list. They should produce the same output, but they don't, because the forest copy constructor does not handle exceptions appropriately.

#include "adobe/forest.hpp"

#include <iostream>
#include <list>

bool activate = false;

class test {
public:
  test(int d) : data_(d) { std::cout << "create " << data_ << std::endl; }
  test(const test& o) : data_(o.data_) {
    std::cout << "copy c " << data_ << std::endl;
    if (activate && data_ == 2) {
      std::cout << "throw " << data_ << std::endl;
      throw 0;
    }
  }
  test& operator=(const test& o) {
    data_ = o.data_;
    std::cout << "copy = " << data_ << std::endl;
    return *this;
  }
  ~test() { std::cout << "delete " << data_ << std::endl; }
private:
  friend std::ostream& operator<<(std::ostream& out, const test& o);

  int data_;
};

std::ostream& operator<<(std::ostream& out, const test& o) {
  out << o.data_;
  return out;
}

template<class T>
void x() try {
  using forest = T;

  forest f1;
  f1.push_back(1);
  f1.push_back(2);
  f1.push_back(3);

  activate = true;

  forest f(f1);
} catch(...) { activate = false; }

int main() {
  std::cout << "adobe::forest" << std::endl;
  x<adobe::forest<test>>();
  std::cout << "std::list" << std::endl;
  x<std::list<test>>();
}
adobe::forest
create 1
copy c 1
delete 1
create 2
copy c 2
delete 2
create 3
copy c 3
delete 3
copy c 1 // never gets deleted below.
copy c 2
throw 2
delete 1
delete 2
delete 3
std::list
create 1
copy c 1
delete 1
create 2
copy c 2
delete 2
create 3
copy c 3
delete 3
copy c 1
copy c 2
throw 2
delete 1
delete 1
delete 2
delete 3

Cleanup old unit tests

Work for this issue is taking place on the test_cleanup branch.

A lot of older unit tests are no longer relevant given the most recent migration to c++11 and the removal of the ABI-safe library elements.

The current structures that have been removed are:

  • adobe::vector
  • adobe::string_t
  • adobe::type_info
  • adobe::move
  • ...?

There are unit tests that depended on these old sources that will have to be updated:

  • test/copy_on_write
  • test/any_iterator
  • test/closed_hash
  • test/move
  • test/poly
  • test/serialization

adobe::poly and SOO question

Good day all,

I was looking at adobe::poly and remember the Small Object Optimization post done by Sean Parent https://stlab.cc/tip/2017/12/23/small-object-optimizations.html

In reading the poly.hpp implementation it seem like it suffers from the same undefined behavior of casting the stored object to its base when the base was never stored.

When you do:
template
explicit poly_base(T x,
typename boost::disable_if<boost::is_base_of<poly_base, T>>::type* = 0) {
::new (storage()) implementation::poly_instance<Instance>(std::move(x));
}

You're storing a poly_instance, that will be a class derived from optimized_storage_type, derived from either poly_state_local or poly_state_remote, that finally derives from the interface.

Then when you do
interface_type& interface_ref() { return static_cast<interface_type>(storage()); }

We are just casting a typedef double storage_t[2]; to the interface class, when it was never stored there because a poly_instance was, granted the only ones that have data are poly_state_local and poly_state_remote, bu the interface is virtual and that is the first violation mention by Sean Parent

Did I missed something or understood the issue wrong, if so please ignore this and accept my apologies.

adobe::rotate for forward iterators

adobe::rotate calls overloaded rotate function template best suited for iterator type in hand through tag dispatch.

template <typename I> // I models Forward Iterator
std::pair<I, I> rotate(I f, I m, I l) {
    typedef typename std::iterator_traits<I>::iterator_category iterator_category;
    return rotate(f, m, l, iterator_category());
}

In rotate.hpp there is only one other rotate overload which is overloaded for bidirectional iterators.
Where is the std::forward_iterator_tag overload? I couldn't find it in included headers.

Fix or remove broken poly_regular.hpp and related headers

Acceptance Criteria

  • Determine whether or not poly_regular.hpp belongs in this library.
  • If it does belong, a) add a test case that ensures that this functionality is being included and tested, and b) fix any related issues.

Original Issue: Missing adobe::move_from

The master branch used move_from but I am unable to find it in the source code. Is this an error or been replace?

/*!
Move constructor
*/
poly_regular_instance(move_from<poly_regular_instance> x)
: base_t(move_from<base_t>(x.source)) {}

Unable to build trunk

I may well be missing something, but I am unable to build trunk. I am using Ubuntu Server 14.04.1 and clang version 4.0.0. clang++ is working fine.

Here's what I did:

svn co https://github.com/stlab/adobe_source_libraries.git
cd adobe_source_libraries.git/trunk
./configure.sh

This succeeds with:
INFO : You are ready to go!

./build.sh
ERRR : BUILDTOOL unknown. Goodbye.

I add BUILDTOOL=bjam to build.sh

Running ./build.sh now results in clang++ being unable to find any of the standard headers:
E.g.:
../boost_libraries/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found

Migrate from boost to std where possible

There are a number of boost classes which can now be migrated over to the standard.

  • boost::bind -> std::bind or lambdas
  • boost::reference_wrapper -> std::reference_wrapper
  • boost::any -> std::any
  • boost::equality_comparable and other concepts could be moved to their std equivalent
  • The various boost::mpl::xxx have the potential to be migrated to similar constructs in std
  • boost::remove_reference/remove_const/is_reference/etc... type traits could be migrated to their std equivalent
  • boost::is_pod/is_integral/etc... have std equivalents
  • boost::enable_if and other similar metaprogramming templates could be moved to their std equivalents
  • boost::begin/end/prev/next have equivalents in std
  • boost::iteratorxxx types/helpers could be investigated to see if they can be replaced with std or range-based for loops
  • boost::mem_fn -> std::mem_fn
  • boost::size -> std::size
  • boost::range related types and helpers could have equivalents in the standard based on the situation
  • boost::posix_time could potentially be migrated to std::chrono
  • boost::filesystem -> std::filesystem

adobe::size on adobe::selection_t

For your information,

https://github.com/stlab/adobe_source_libraries/blob/master/test/stable_partition_selection/main.cpp#L81

On my setup (GCC 5.1 or Clang 3.5 Fedora Boost 1.57),
Expression "adobe::size(selection)" in line above does not compile because adobe::selection_t has no non-const begin/end and Boost concept check requires both versions.

I defined -DBOOST_RANGE_ENABLE_CONCEPT_ASSERT=0 to fix my build.

/usr/include/boost/range/concepts.hpp

    BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
    {
        // This has been modified from assigning to this->i
        // (where i was a member variable) to improve
        // compatibility with Boost.Lambda
        iterator i1 = boost::begin(*m_range);
        iterator i2 = boost::end(*m_range);

        boost::ignore_unused_variable_warning(i1);
        boost::ignore_unused_variable_warning(i2);

        const_constraints(*m_range);
    }

Slack team participation

Hi,

could you add me to the ASL's Slack team?
I would like to add Windows support for the ASL and discuss/see, if some one else is already working on this, whom I could support in case?

Thanks and regards,
Felix

Unable to open adobe_source.vcxproj using MS VS 2015.

Hello, it looks like the readme is a little out of date for building, so I tried loading the vcxproj in the msvc_ide directory. It looks like there is a property sheet missing, because I get the error:


Microsoft Visual Studio


Unable to read the project file "adobe_source.vcxproj".
G:\asl\msvc_ide\boost_all.props(5,5): The imported project "G:\asl\msvc_ide\asl_client_config.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.


OK


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.