| 1 |
#line 1 "ah_set/main.cc" |
| 2 |
#ifndef __ac_FIRST__home_Tom_aspectcX43X43__ |
| 3 |
#define __ac_FIRST__home_Tom_aspectcX43X43__ |
| 4 |
#define __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_set_main_cc__ |
| 5 |
#ifndef __ac_have_predefined_includes__ |
| 6 |
#define __ac_have_predefined_includes__ |
| 7 |
#endif // __ac_have_predefined_includes__ |
| 8 |
|
| 9 |
#ifndef __ac_h_ |
| 10 |
#define __ac_h_ |
| 11 |
#ifdef __cplusplus |
| 12 |
namespace AC { |
| 13 |
typedef const char* Type; |
| 14 |
enum JPType { GET = 65536, SET = 131072, REF = 1048576, BUILTIN = 524288, CALL = 262144, EXECUTION = 16777216, CONSTRUCTION = 33554432, DESTRUCTION = 67108864 }; |
| 15 |
enum Protection { PROT_NONE, PROT_PRIVATE, PROT_PROTECTED, PROT_PUBLIC }; |
| 16 |
enum Specifiers { SPEC_NONE = 0x0 , SPEC_STATIC = 0x1, SPEC_MUTABLE = 0x2, SPEC_VIRTUAL = 0x4 }; |
| 17 |
struct Action { |
| 18 |
void **_args; void *_result; void *_entity; void *_array; void **_indices; void *_target; void *_that; void *_fptr; |
| 19 |
void (*_wrapper)(Action &); |
| 20 |
inline void trigger () { _wrapper (*this); } |
| 21 |
}; |
| 22 |
template <typename T> struct ResultBuffer { |
| 23 |
char _data[sizeof (T)]; |
| 24 |
void operator = (const T& t) { *this = (const ResultBuffer &)t; } |
| 25 |
}; |
| 26 |
template <typename T, typename N> struct TL { |
| 27 |
typedef T type; typedef N next; enum { ARGS = next::ARGS + 1 }; |
| 28 |
}; |
| 29 |
struct TLE { enum { ARGS = 0 }; }; |
| 30 |
template <typename T> struct Referred { typedef T type; }; |
| 31 |
template <typename T> struct Referred<T &> { typedef T type; }; |
| 32 |
template <typename TL, int I> struct Arg { |
| 33 |
typedef typename Arg<typename TL::next, I - 1>::Type Type; |
| 34 |
typedef typename Referred<Type>::type ReferredType; |
| 35 |
}; |
| 36 |
template <typename TL> struct Arg<TL, 0> { |
| 37 |
typedef typename TL::type Type; |
| 38 |
typedef typename Referred<Type>::type ReferredType; |
| 39 |
}; |
| 40 |
template <typename T, bool Qual> struct ConstQualify {}; |
| 41 |
template <typename T> struct ConstQualify<T, false> { typedef T type; }; |
| 42 |
template <typename T> struct ConstQualify<T, true> { typedef const T type; }; |
| 43 |
template <typename T> struct ConstQualify<const T, true> { typedef const T type; }; |
| 44 |
template <typename TL, unsigned int FC, int I> struct ArgCQ { |
| 45 |
typedef typename ConstQualify<typename Arg<TL, I>::Type, ( FC >> I ) & 1>::type Type; |
| 46 |
typedef typename Referred<Type>::type ReferredType; |
| 47 |
}; |
| 48 |
template <typename T> int ttest(...); |
| 49 |
template <typename T> char ttest(typename T::__TI const volatile *); |
| 50 |
template<typename T> struct HasTypeInfo { |
| 51 |
enum { RET=((sizeof(ttest<T>(0))==1)?1:0) }; |
| 52 |
}; |
| 53 |
template<typename T, int HAVE = HasTypeInfo<T>::RET> struct TypeInfo { |
| 54 |
enum { AVAILABLE = 0, BASECLASSES = 0, MEMBERS = 0, FUNCTIONS = 0, |
| 55 |
CONSTRUCTORS = 0, DESTRUCTORS = 0 }; |
| 56 |
typedef T That; |
| 57 |
}; |
| 58 |
template<typename T> struct TypeInfo<T, 1> : T::__TI { |
| 59 |
enum { AVAILABLE = 1 }; |
| 60 |
}; |
| 61 |
template<typename T> struct RT {}; |
| 62 |
template<typename T> RT<T> rt_deduce (const T&) { return RT<T>(); } |
| 63 |
template<typename T> RT<T> rt_deduce (const volatile T&) { return RT<T>(); } |
| 64 |
struct Cnv { template<typename T> operator RT<T>() const { return RT<T>(); }}; |
| 65 |
#define __AC_TYPEOF(expr) (1?AC::Cnv():AC::rt_deduce(expr)) |
| 66 |
template <class Aspect, int Index> |
| 67 |
struct CFlow { |
| 68 |
static int &instance () { |
| 69 |
static int counter = 0; |
| 70 |
return counter; |
| 71 |
} |
| 72 |
CFlow () { instance ()++; } |
| 73 |
~CFlow () { instance ()--; } |
| 74 |
static bool active () { return instance () > 0; } |
| 75 |
}; |
| 76 |
template <typename T, typename E, typename O> inline E T::* mptr_castT( E O::*mptr ) { return static_cast< E T::* >( mptr ); } |
| 77 |
template <typename A> struct SpliceT {}; |
| 78 |
template <typename B, unsigned int D> struct SpliceT< B[D] > { |
| 79 |
typedef B Base; |
| 80 |
enum { Dim = D }; |
| 81 |
}; |
| 82 |
template <unsigned int TSize, typename TIdx, typename N> struct DIL : N { |
| 83 |
typedef N Next; |
| 84 |
enum { Count = Next::Count + 1 }; |
| 85 |
enum { Size = TSize }; |
| 86 |
typedef TIdx Idx; |
| 87 |
Idx idx; |
| 88 |
template <typename B> struct Entity { typedef typename SpliceT< typename Next::template Entity<B>::Type >::Base Type; }; |
| 89 |
template <typename E> struct Array { typedef typename Next::template Array<E>::Type Type[Size]; }; |
| 90 |
template <typename E> inline E& apply( typename Array<E>::Type &base ) { return Next::template apply<E>( base[idx] ); } |
| 91 |
template <typename A> struct Append { typedef DIL<Size, Idx, typename Next::template Append<A>::NewList > NewList; }; |
| 92 |
template <typename ONext> inline void copyTo( DIL<Size,Idx,ONext> *target ) { |
| 93 |
target->idx = idx; |
| 94 |
Next::copyTo( static_cast<ONext *>( target ) ); |
| 95 |
}; |
| 96 |
}; |
| 97 |
struct DILE { |
| 98 |
enum { Count = 0 }; |
| 99 |
template <typename B> struct Entity { typedef B Type; }; |
| 100 |
template <typename E> struct Array { typedef E Type; }; |
| 101 |
template <typename E> inline E& apply( typename Array<E>::Type &base ) { return base; } |
| 102 |
template <typename A> struct Append { typedef A NewList; }; |
| 103 |
template <typename O> inline void copyTo( O * ) {}; |
| 104 |
}; |
| 105 |
template <typename L, unsigned int D> struct DIL_Op { |
| 106 |
enum { Size = DIL_Op<typename L::Next, D - 1>::Size }; |
| 107 |
typedef typename DIL_Op<typename L::Next, D - 1>::Idx Idx; |
| 108 |
inline static Idx &idx( L *di ) { return DIL_Op<typename L::Next, D - 1>::idx( di ); } |
| 109 |
}; |
| 110 |
template <typename L> struct DIL_Op<L,0> { |
| 111 |
enum { Size = L::Size }; |
| 112 |
typedef typename L::Idx Idx; |
| 113 |
inline static Idx &idx( L *di ) { return di->idx; } |
| 114 |
}; |
| 115 |
template <typename TEntity> struct BI_Entity { |
| 116 |
typedef TEntity Entity; |
| 117 |
Entity &_ent; |
| 118 |
inline BI_Entity( Entity &ent ) : _ent( ent ) {} |
| 119 |
inline Entity &entity() { return _ent; } |
| 120 |
}; |
| 121 |
template <typename TTarget, typename TEntity> struct BI_Member { |
| 122 |
typedef TEntity Entity; |
| 123 |
typedef TTarget Target; |
| 124 |
typedef Entity Target::*Member; |
| 125 |
Target &_target; |
| 126 |
Member _member; |
| 127 |
inline BI_Member( Target &target, Member mem ) : _target( target ), _member( mem ) {} |
| 128 |
inline Entity &entity() { return _target.*_member; } |
| 129 |
}; |
| 130 |
template <typename TTarget, typename TEntity> struct BI_Static { |
| 131 |
typedef TEntity Entity; |
| 132 |
typedef TTarget Target; |
| 133 |
Entity &_ent; |
| 134 |
Target &_target; |
| 135 |
inline BI_Static( Target &target, Entity &ent ) : _ent( ent ), _target( target ) {} |
| 136 |
inline Entity &entity() { return _ent; } |
| 137 |
}; |
| 138 |
template <typename TBI, typename TDI> struct PackedEntity { |
| 139 |
typedef PackedEntity<TBI, TDI> SELF; |
| 140 |
typedef TBI BI; |
| 141 |
typedef TDI DI; |
| 142 |
BI _base; |
| 143 |
DI _indices; |
| 144 |
inline PackedEntity( BI base ) : _base( base ) {} |
| 145 |
typedef typename BI::Entity Base; |
| 146 |
typedef typename DI::template Entity<Base>::Type Entity; |
| 147 |
inline Base &base() { return _base.entity(); }; |
| 148 |
inline Entity &entity() { return _indices.template apply<Entity>( base() ); } |
| 149 |
enum { DIMS = DI::Count }; |
| 150 |
template <unsigned int D> struct Dim : DIL_Op<DI,D> {}; |
| 151 |
template <unsigned int D> inline typename Dim<D>::Idx &idx() { return Dim<D>::idx( &_indices ); } |
| 152 |
template<typename NextIdx> struct Extend { |
| 153 |
typedef typename SpliceT<Entity>::Base NewEnt; |
| 154 |
enum { NextDim = SpliceT<Entity>::Dim }; |
| 155 |
typedef typename DI::template Append< DIL< NextDim, NextIdx, DILE > >::NewList NewDI; |
| 156 |
typedef PackedEntity< BI, NewDI > NewPacked; |
| 157 |
}; |
| 158 |
template<typename TIdxN> inline typename Extend<TIdxN>::NewPacked operator []( TIdxN idxN ) { |
| 159 |
typedef typename Extend<TIdxN>::NewPacked __PE; |
| 160 |
__PE res( _base ); |
| 161 |
_indices.copyTo( &res._indices ); |
| 162 |
__PE::template Dim<__PE::DIMS - 1>::idx( &res._indices ) = idxN; |
| 163 |
return res; |
| 164 |
} |
| 165 |
inline SELF operator =( Entity arg ) { entity() = arg; return *this; } |
| 166 |
template<typename ARG> inline SELF operator +=( ARG arg ) { entity() += arg; return *this; } |
| 167 |
template<typename ARG> inline SELF operator -=( ARG arg ) { entity() -= arg; return *this; } |
| 168 |
template<typename ARG> inline SELF operator *=( ARG arg ) { entity() *= arg; return *this; } |
| 169 |
template<typename ARG> inline SELF operator /=( ARG arg ) { entity() /= arg; return *this; } |
| 170 |
template<typename ARG> inline SELF operator %=( ARG arg ) { entity() %= arg; return *this; } |
| 171 |
template<typename ARG> inline SELF operator |=( ARG arg ) { entity() |= arg; return *this; } |
| 172 |
template<typename ARG> inline SELF operator ^=( ARG arg ) { entity() ^= arg; return *this; } |
| 173 |
template<typename ARG> inline SELF operator &=( ARG arg ) { entity() &= arg; return *this; } |
| 174 |
template<typename ARG> inline SELF operator <<=( ARG arg ) { entity() <<= arg; return *this; } |
| 175 |
template<typename ARG> inline SELF operator >>=( ARG arg ) { entity() >>= arg; return *this; } |
| 176 |
inline SELF operator ++() { ++entity(); return *this; } |
| 177 |
inline SELF operator --() { --entity(); return *this; } |
| 178 |
}; |
| 179 |
template <typename TEntity> |
| 180 |
inline PackedEntity< BI_Entity<TEntity>, DILE > PEInit( TEntity &ent ) { |
| 181 |
return PackedEntity< BI_Entity<TEntity>, DILE >( BI_Entity<TEntity>( ent ) ); |
| 182 |
} |
| 183 |
template <typename TTarget, typename TEntity> |
| 184 |
inline PackedEntity<BI_Member<TTarget, TEntity>, DILE> PEInit( const TTarget &target, TEntity TTarget::*member ) { |
| 185 |
return PackedEntity< BI_Member<TTarget, TEntity>, DILE >( BI_Member<TTarget, TEntity>( const_cast<TTarget &>( target ), member ) ); |
| 186 |
} |
| 187 |
template <typename TTarget, typename TEntity> |
| 188 |
inline PackedEntity<BI_Static<TTarget, TEntity>, DILE> PEInit( const TTarget &target, TEntity &ent ) { |
| 189 |
return PackedEntity< BI_Static<TTarget, TEntity>, DILE >( BI_Static<TTarget, TEntity>( const_cast<TTarget &>( target ), ent ) ); |
| 190 |
} |
| 191 |
|
| 192 |
#ifdef __acdef_float |
| 193 |
template <typename BASE, int ID=0> struct _FloatN { |
| 194 |
BASE val; |
| 195 |
_FloatN() {} |
| 196 |
_FloatN(const BASE& v) : val(v) {} |
| 197 |
operator BASE() const { return val; } |
| 198 |
}; |
| 199 |
#endif |
| 200 |
} |
| 201 |
|
| 202 |
#ifdef __acdef_float |
| 203 |
typedef AC::_FloatN<float> _Float32; |
| 204 |
typedef AC::_FloatN<double> _Float32x; |
| 205 |
typedef AC::_FloatN<long double, 0> _Float64; |
| 206 |
typedef AC::_FloatN<long double, 1> _Float128; |
| 207 |
typedef AC::_FloatN<long double, 2> _Float64x; |
| 208 |
#endif |
| 209 |
|
| 210 |
#if defined(__acweaving) && defined(__ARM_NEON) |
| 211 |
typedef __attribute__ ((__neon_vector_type__ (4))) float __Float32x4_t; |
| 212 |
typedef __attribute__ ((__neon_vector_type__ (2))) double __Float64x2_t; |
| 213 |
#endif |
| 214 |
#endif // __cplusplus |
| 215 |
#endif // __ac_h_ |
| 216 |
class Example; |
| 217 |
#endif // __ac_FIRST__home_Tom_aspectcX43X43__ |
| 218 |
#line 219 "main.acc" |
| 219 |
|
| 220 |
#ifndef __ac_fwd_Example__ |
| 221 |
#define __ac_fwd_Example__ |
| 222 |
class Example; |
| 223 |
namespace AC { |
| 224 |
__attribute((always_inline)) inline void invoke_Example_Example__a0_after (); |
| 225 |
} |
| 226 |
#endif |
| 227 |
|
| 228 |
#ifndef __ac_need__home_Tom_aspectcX43X43_ah_set_hello_world_ah__ |
| 229 |
#define __ac_need__home_Tom_aspectcX43X43_ah_set_hello_world_ah__ |
| 230 |
#endif |
| 231 |
|
| 232 |
#line 1 "ah_set/main.cc" |
| 233 |
|
| 234 |
#line 1 "ah_set/main.cc" |
| 235 |
int i; |
| 236 |
#line 237 "main.acc" |
| 237 |
|
| 238 |
template <typename TArg0, typename TEntity> |
| 239 |
__attribute__((always_inline)) inline void __Set__Z4mainv_1_0 (TEntity &ent, TArg0 arg0){ |
| 240 |
::i = (arg0); |
| 241 |
AC::invoke_Example_Example__a0_after (); |
| 242 |
} |
| 243 |
|
| 244 |
#line 2 "ah_set/main.cc" |
| 245 |
#line 246 "main.acc" |
| 246 |
|
| 247 |
template <typename TArg0, typename TArg1, typename TResult> |
| 248 |
__attribute__((always_inline)) inline TResult &__Builtin__Z4mainv_0_0 (TArg0 arg0, TArg1 arg1, AC::RT<TResult>){ |
| 249 |
TResult *__result_buffer; |
| 250 |
/* Implicit joinpoint calls */ |
| 251 |
__Set__Z4mainv_1_0< int > (arg0, arg1 ); |
| 252 |
__result_buffer = &arg0; |
| 253 |
return *(TResult *&)__result_buffer; |
| 254 |
} |
| 255 |
|
| 256 |
#line 2 "ah_set/main.cc" |
| 257 |
|
| 258 |
#line 2 "ah_set/main.cc" |
| 259 |
int main(){ |
| 260 |
__Builtin__Z4mainv_0_0< int &, int > (i , 42, __AC_TYPEOF((i = 42)) ); |
| 261 |
return 0; |
| 262 |
} |
| 263 |
#line 264 "main.acc" |
| 264 |
|
| 265 |
#ifndef __ac_have_predefined_includes__ |
| 266 |
/*** begin of aspect includes ***/ |
| 267 |
// commented out by ac++: #include "hello_world.ah" |
| 268 |
/*** end of aspect includes ***/ |
| 269 |
#endif |
| 270 |
#line 6 "ah_set/main.cc" |
| 271 |
|
| 272 |
#line 6 "ah_set/main.cc" |
| 273 |
|
| 274 |
#ifdef __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_set_main_cc__ |
| 275 |
#ifdef __ac_need__home_Tom_aspectcX43X43_ah_set_hello_world_ah__ |
| 276 |
#ifndef __ac_have__home_Tom_aspectcX43X43_ah_set_hello_world_ah__ |
| 277 |
#define __ac_have__home_Tom_aspectcX43X43_ah_set_hello_world_ah__ |
| 278 |
// commented out by ac++: #include "hello_world.ah" |
| 279 |
#line 1 "ah_set/hello_world.ah" |
| 280 |
#ifndef __WORLD_AH__ |
| 281 |
#define __WORLD_AH__ |
| 282 |
|
| 283 |
#include <iostream> |
| 284 |
|
| 285 |
class Example { |
| 286 |
#line 287 "main.acc" |
| 287 |
public: |
| 288 |
template <typename, int = 0> struct __BYPASSExample {}; |
| 289 |
template <typename, int> friend struct __BYPASSExample; |
| 290 |
private: |
| 291 |
#line 6 "ah_set/hello_world.ah" |
| 292 |
|
| 293 |
#line 6 "ah_set/hello_world.ah" |
| 294 |
|
| 295 |
public: __attribute__((always_inline)) inline void __a0_after() { |
| 296 |
//print "Finished" after setting an int |
| 297 |
std::cout << "Finished" << std::endl; |
| 298 |
} |
| 299 |
#line 300 "main.acc" |
| 300 |
|
| 301 |
public: |
| 302 |
static Example *aspectof () { |
| 303 |
static Example __instance; |
| 304 |
return &__instance; |
| 305 |
} |
| 306 |
static Example *aspectOf () { |
| 307 |
return aspectof (); |
| 308 |
} |
| 309 |
private: |
| 310 |
|
| 311 |
#line 11 "ah_set/hello_world.ah" |
| 312 |
|
| 313 |
#line 11 "ah_set/hello_world.ah" |
| 314 |
} |
| 315 |
#line 316 "main.acc" |
| 316 |
; |
| 317 |
namespace AC { |
| 318 |
__attribute((always_inline)) inline void invoke_Example_Example__a0_after () { |
| 319 |
::Example::aspectof()->__a0_after (); |
| 320 |
} |
| 321 |
} |
| 322 |
|
| 323 |
#line 11 "ah_set/hello_world.ah" |
| 324 |
|
| 325 |
#line 11 "ah_set/hello_world.ah" |
| 326 |
; |
| 327 |
|
| 328 |
#endif |
| 329 |
#line 12 "ah_set/main.cc" |
| 330 |
#endif |
| 331 |
#endif |
| 332 |
#undef __ac_FIRST__home_Tom_aspectcX43X43__ |
| 333 |
#undef __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_set_main_cc__ |
| 334 |
#endif // __ac_FIRST_FILE__home_Tom_aspectcX43X43_ah_set_main_cc__ |