search for: singleton_iterator

Displaying 7 results from an estimated 7 matches for "singleton_iterator".

2012 Apr 08
0
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...like roughly what I would expect the code to be. I'd have to see the LLVM IR it generated to be sure. But it looks okay to me. (And if it's working for you, all the better. ;-) ) A snippet of the IR code is: > entry: > %add_it = alloca %add_iterator, align 8 > %y_it = alloca %singleton_iterator, align 8 > %x_it = alloca %singleton_iterator, align 8 > %y = alloca %item, align 8 > %x = alloca %item, align 8 > %exception_caught_flag = alloca i8, align 1 > store i8 0, i8* %exception_caught_flag, align 1 > %caught_result_storage = alloca %0, align 8 > store %...
2012 Apr 08
2
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
On Apr 4, 2012, at 9:32 PM, Paul J. Lucas wrote: > On Mar 23, 2012, at 4:46 PM, Bill Wendling wrote: [...] > This all seems to work just fine. I can throw a C++ exception either in a C++ object's constructor or in an ordinary member function and the stack unwinds correctly (the object's destructors are called) and the exception is propagated back up the C++ code that called the
2012 Mar 15
3
[LLVMdev] Using JIT code to code a program to call C++
...#39;d to call functions in said library. For the sake of simplicity, assume the library has classes like: class item { public: item(); item( int ); ~item(); // ... }; class item_iterator { public: virtual ~item_iterator(); virtual bool next( item *result ) = 0; }; class singleton_iterator : public item_iterator { public: singleton_iterator( item const &i ); // ... }; I'm aware that LLVM doesn't know anything about C++ and that one way to call C++ functions is to wrap them in C thunks: extern "C" { void thunk_item_M_new( item *addr ) { new( a...
2012 Mar 23
0
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...is *not* constructed by a normal function, but a JIT'd function. Since LLVM knows nothing about C++ or destructors, I certainly have to call the destructor manually, e.g., obj->~Class();, for the case where no exception is thrown. My JIT'd code looks like: %item = type { [16 x i8] } %singleton_iterator = type { [24 x i8] } %add_iterator = type { [24 x i8] } define void @program(void* %result) { entry: ; alloc raw space for x on the stack %x = alloca %item, align 8 ; alloc raw space for y on the stack %y = alloca %item, align 8 ; call item::item(1) constructor for x as new(%0) item(1)...
2012 Apr 09
5
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...it generated to be sure. But it looks okay to me. (And if it's working for you, all the better. ;-) ) > > A snippet of the IR code is: > The code is good, except for one comment (see below). >> entry: >> %add_it = alloca %add_iterator, align 8 >> %y_it = alloca %singleton_iterator, align 8 >> %x_it = alloca %singleton_iterator, align 8 >> %y = alloca %item, align 8 >> %x = alloca %item, align 8 >> %exception_caught_flag = alloca i8, align 1 >> store i8 0, i8* %exception_caught_flag, align 1 >> %caught_result_storage = alloca %0, alig...
2012 Mar 23
2
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
On Mar 23, 2012, at 6:27 AM, Paul J. Lucas wrote: > On Mar 22, 2012, at 5:29 PM, Bill Wendling wrote: > >> On Mar 22, 2012, at 11:40 AM, Paul J. Lucas <paul at lucasmail.org> wrote: >> >>> Unfortunately, I'm not following. How is having the code that catches all exceptions in a separate function different from what I proposed (putting the try/catch in the
2012 Mar 23
2
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...ructed by a normal function, but a JIT'd function. Since LLVM knows nothing about C++ or destructors, I certainly have to call the destructor manually, e.g., obj->~Class();, for the case where no exception is thrown. My JIT'd code looks like: > > %item = type { [16 x i8] } > %singleton_iterator = type { [24 x i8] } > %add_iterator = type { [24 x i8] } > > define void @program(void* %result) { > entry: > ; alloc raw space for x on the stack > %x = alloca %item, align 8 > > ; alloc raw space for y on the stack > %y = alloca %item, align 8 > > ; call...