Re: [swift-dev] JIT-ting Swift

2017-03-10 Thread Alex Denisov via swift-dev
> What exactly does your code that 'passes argc=1 and argv=["foo"]' look like? > Did you null-terminate argv as is required? This is exact code I had initially: auto main = ((int (*)(int, const char **))(intptr_t)mainPointer); const int argc = 1; const char *argv[] = { "some-name", NULL }; auto

Re: [swift-dev] JIT-ting Swift

2017-03-10 Thread Greg Parker via swift-dev
What exactly does your code that 'passes argc=1 and argv=["foo"]' look like? Did you null-terminate argv as is required? > On Mar 10, 2017, at 1:45 AM, Alex Denisov via swift-dev > wrote: > > Thank you everybody for your hints and suggestions. It helped me a lot! > I have found the source of

Re: [swift-dev] JIT-ting Swift

2017-03-10 Thread Alex Denisov via swift-dev
Thank you everybody for your hints and suggestions. It helped me a lot! I have found the source of the crash I’ve been facing recently. I run a program by passing argc=1 and argv=[“foo”]. For some reason the 'program under JIT’ was getting argc=2. Based on this number it creates an array of strin

Re: [swift-dev] JIT-ting Swift

2017-03-06 Thread Robert Widmann via swift-dev
We used to have a callback in the standard library that would set the process arguments, but that approach was fragile and would still have broken here. Instead, we load the Swift standard library (a step we would have had to do anyway) before entering main and call out to platform-specific fun

Re: [swift-dev] JIT-ting Swift

2017-03-06 Thread Alex Denisov via swift-dev
> The `main` entry point ought to be a standard C "main" function. The argv > argument is an UnsafeMutablePointer?>, which ought > to be ABI-compatible with a char** in C. That was my assumption when I started, thank you for confirmation :) > When JIT'ing Swift, the value of argv doesn't matte

Re: [swift-dev] JIT-ting Swift

2017-03-06 Thread Robert Widmann via swift-dev
%Sp is not an argument, it is the space necessary to hold a reference to the CommandLine enumeration's static argv member. When JIT'ing Swift, the value of argv doesn't matter because we replace the process' arguments dynamically https://github.com/apple/swift/blob/master/lib/Immediate/Immedi

Re: [swift-dev] JIT-ting Swift

2017-03-06 Thread Brian Gesiak via swift-dev
I think this is the best mailing list for your question, but as for a mailing list dedicated to swift-corelibs-xctest: swift-corelibs-...@swift.org is for corelibs-libdispatch, corelibs-foundation, and corelibs-xctest. - Brian Gesiak On Mon, Mar 6, 2017 at 12:33 PM, Alex Denisov via swift-dev <

Re: [swift-dev] JIT-ting Swift

2017-03-06 Thread Joe Groff via swift-dev
> > On Mar 6, 2017, at 9:33 AM, Alex Denisov via swift-dev > wrote: > > Hi there, > > I could not find a list for swift-corelibs-xctest so I am posting it here. > > I am trying to run tests based on XCTest > (https://github.com/apple/swift-corelibs-xctest) using LLVM's JIT. > Everything is w

[swift-dev] JIT-ting Swift

2017-03-06 Thread Alex Denisov via swift-dev
Hi there, I could not find a list for swift-corelibs-xctest so I am posting it here. I am trying to run tests based on XCTest (https://github.com/apple/swift-corelibs-xctest) using LLVM's JIT. Everything is working good so far. However, I am getting a crash. Based on a shallow investigation I ca