Re: Building a wasm library, need to override .object._d_newitemT!T
On Sunday, 24 December 2023 at 10:50:41 UTC, Johan wrote: _d_newitemT!T is fairly new, what compiler version are you using? -Johan Nevermind, I managed to get it working but I had to compile without including druntime and phobos and move everything into the library. I'm using ldc 1.36.0-beta1
Re: Lazy and GC Allocations
On Monday, 20 February 2023 at 19:58:32 UTC, Steven Schveighoffer wrote: On 2/20/23 1:50 PM, Etienne wrote: On Monday, 20 February 2023 at 02:50:20 UTC, Steven Schveighoffer wrote: See Adam's bug report: https://issues.dlang.org/show_bug.cgi?id=23627 So, according to this bug report, the implementation is allocating a closure on the GC even though the spec says it shouldn't? The opposite, the delegate doesn't force a closure, and so when the variable goes out of scope, memory corruption ensues. I've been writing some betterC and the lazy parameter was prohibited because it allocates on the GC, so I'm wondering what the situation is currently It shouldn't. Now, lazy can't be `@nogc` (because that's just what the compiler dictates), but it won't actually *use* the GC if you don't allocate in the function call. I just tested and you can use lazy parameters with betterC. -Steve The @nogc issue might be what might be why it didn't work for me. I use it because it's easier to work with betterC but perhaps I should avoid writing @nogc code altogether Thanks for the info! Etienne
Re: Lazy and GC Allocations
On Monday, 20 February 2023 at 02:50:20 UTC, Steven Schveighoffer wrote: See Adam's bug report: https://issues.dlang.org/show_bug.cgi?id=23627 -Steve So, according to this bug report, the implementation is allocating a closure on the GC even though the spec says it shouldn't? I've been writing some betterC and the lazy parameter was prohibited because it allocates on the GC, so I'm wondering what the situation is currently Etienne
Lazy and GC Allocations
Hello, I'm wondering at which moment the following would make an allocation of the scope variables on the GC. Should I assume that the second parameter of enforce being lazy, we would get a delegate/literal that saves the current scope on the GC even if it's not needed? I'm asking purely for a performance perspective of avoiding GC allocations. ``` void main() { int a = 5; enforce(true, format("a: %d", a)); } ``` Thanks Etienne
mscoff x86 invalid pointers
I'm trying to compile a library that I think used to work with -m32mscoff flag before I reset my machine configurations. https://github.com/etcimon/memutils Whenever I run `dub test --config=32mscoff` it gives me an assertion failure, which is a global variable that already has a pointer value for some reason.. I'm wondering if someone here could test this out on their machine with v2.067.1? There's no reason why this shouldn't work, it runs fine in DMD32/optlink and DMD64/mscoff, just not in DMD32/mscoff. Thanks!
Re: build vibe-d-0.7.23 error on win7 x86?
On Monday, 20 April 2015 at 07:58:40 UTC, mzf wrote: win 7 x86,3GB ram: 1. dmd 2.066 vibe-d-0.7.23, it's ok. 2. dmd 2.067 vibe-d-0.7.23, show error msg out of memory why? http://forum.dlang.org/thread/mghqlf$10l2$1...@digitalmars.com#post-ybrtcxrcmrrsoaaksdbj:40forum.dlang.org
Internal symbols?
Is there a way to prevent DMD from exporting a symbol? Basically, I would need an attribute like extern(none) because my library makes heavy use of CTFE and the linker takes 13 seconds, while OMF is also off the table for me and this is creating tons of problems... Thanks in advance!
Re: DMD 64 bit on Windows
On Tuesday, 14 April 2015 at 09:57:55 UTC, wobbles wrote: On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote: I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows? I've been having this same issue. Over-use of CTFE is what's causing it on my part, to fix it, I've had to split my CTFE functions out into a seperate runtime tool (to make use of GC goodness. See people, GC is good! :)) The tool will print the code that my CTFE functions would normally generate to a file, and then use import to get it back into my main application. Bit of a mess, but it works. Dunno if this will help with your situation, as not sure if CTFE is causing it. It's actually a pretty big program, I'm compiling Botan with 80k lines of code, libasync, libhttp2, memutils, vibe.d together. I intend to build a pretty big library on top of it all, so i pretty much need the memory. It takes about 3gb on x86, although i setup mscoff to link the high amount of symbols. So, any idea if dmd can be moved to 64 bit anytime soon?
Re: DMD 64 bit on Windows
On 4/14/2015 3:47 PM, Kai Nacke wrote: Short recipe: Download VisualStudio 2013 Community Edition Download the DMD source OR clone from GitHub repository. Start VS 2013. Open solution dmd_msc_vs10.sln (in folser src) Right click solution dmd_msc_vs10 and select Properties. Change Configuration to Release and Platform to x64. Right click solution dmd_msc_vs10 and select Rebuild. Result is 64bit exex dmd_msc.exe in folder src. Regards, Kai Woa, you're awesome, thanks!
DMD 64 bit on Windows
I'm currently experiencing Out Of Memory errors when compiling in DMD on Windows Has anyone found a way to compile a DMD x86_64 compiler on Windows?
Re: DMD 64 bit on Windows
On 4/13/2015 9:42 PM, Dennis Ritchie wrote: Main article here: http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29 I think this might be about the -m64 option in the d compiler. I'm actually having the Out Of Memory error with the -m64 option, because DMD crashes at 4gb of ram What I need is DMD compiled with 64 bit pointer size
Re: How to connect asynchronously (non block) with kqueue?
On 3/24/2015 5:50 AM, zhmt wrote: I am using kqueue on macosx, I know how to write a simple server. But don't know which event will be triggered in kqueue when connected successfully , which event when failed? EVFILT_READ or EVFILT_WRITE? I have googled this question, got no examples, any suggestions are welcome, Thanks. Look into libasync for an abstraction to kqueue https://github.com/etcimon/libasync Also, this is what you're looking for: https://github.com/etcimon/libasync/blob/628850e8a6020298612e8a35229f5539d7385bae/source/libasync/posix.d#L1826
Re: OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format
On 3/20/2015 1:35 PM, Koi wrote: Hello, after some coding i needed to update some external libraries like DerelictSDL2. As we all know, one update isn't enough, so i updated my whole d-environment at the end of the day (current dmd version, VisualD). After getting rid of some linking errors (symbols undefined) i have only one error left: Optlink: Error 45: Too Much DEBUG Data for Old CodeView format i googled, but really can't figure out what this error is about. This is due to a high amount of symbols in your code. I fixed this almost a year ago in the optlink repository: https://github.com/DigitalMars/optlink/pull/15 You should be able to download it on the digitalmars.com website under: Digital Mars C/C++ Compiler Version 8.57 (3662658 bytes) The link.exe file in the bin folder is up-to-date.
Re: State of Windows x64 COFF support?
On 2015-02-19 1:41 PM, ketmar wrote: i remember that DMD creates one section for each function (to allow smartlink feature). with templates this can be alot. maybe it needs new cli flag --collapse-sections or something like it. I watched the section names and discovered over 20,000 sections named : .debug$S According to the code, a new .debug$S section is created every time it is searched with the flag IMAGE_SCN_LNK_COMDAT in: https://github.com/D-Programming-Language/dmd/blob/de6fccf8391b1dfdb959fa0f089920c2c8e6aff8/src/backend/mscoffobj.c#L1724 I deleted this flag and now the program links correctly with COFF with 50k sections. It would have been easier to debug with an error in mscoffobj.c:1591: assert(scnhdr_cnt 65536, Too many symbols for COFF format); https://github.com/D-Programming-Language/dmd/blob/de6fccf8391b1dfdb959fa0f089920c2c8e6aff8/src/backend/mscoffobj.c#L1591 With this simple patch on the compiler, there are stil some errors compiling Botan on win64, but they are not related to the COFF format anymore.
Re: State of Windows x64 COFF support?
On 2015-02-19 11:39 AM, Etienne wrote: I'm having corrupt symbol table errors on a Win64 build of a big application, I can't find a way around it. I'm wondering if the COFF support is still experimental in DMD? Thanks! I just counted 67k sections using a printf in DMD... The limit is 65k so that explains that.
State of Windows x64 COFF support?
I'm having corrupt symbol table errors on a Win64 build of a big application, I can't find a way around it. I'm wondering if the COFF support is still experimental in DMD? Thanks!
Re: vibe.d problem
On 2014-11-18 8:37 AM, Lázaro Armando via Digitalmars-d-learn wrote: How could I do that using dub? You must download the most recent version of dub from http://code.dlang.org Run the commands: dub remove vibe-d --force-remove dub fetch vibe-d --version=0.7.21-rc.4 The list of versions you can use is here: https://github.com/rejectedsoftware/vibe.d/releases
Re: Precise TLS GC
I realize this shouldn't belong in D.learn :) http://forum.dlang.org/thread/m4aahr$25qd$2...@digitalmars.com#post-m4aahr:2425qd:242:40digitalmars.com
Precise TLS GC
I always wondered why we would use the shared keyword on GC allocations if only the stack can be optimized for TLS Storage. After thinking about how shared objects should work with the GC, it's become obvious that the GC should be optimized for local data. Anything shared would have to be manually managed, because the biggest slowdown of all is stopping the world to facilitate concurrency. With a precise GC on the way, it's become easy to filter out allocations from shared objects. Simply proxy them through malloc and get right of the locks. Make the GC thread-local, and you can expect it to scale with the number of processors. Any thread-local data should already have to be duplicated into a shared object to be used from another thread, and the lifetime is easy to manage manually. SomeTLS variable = new SomeTLS(Data); shared SomeTLS variable2 = cast(shared) variable.dupShared(); Tid tid = spawn(doSomething, variable2); variable = receive!variable2(tid).dupLocal(); delete variable2; Programming with a syntax that makes use of shared objects, and forces manual management on those, seems to make stop the world a thing of the past. Any thoughts?
Strictness of language styling
I'm translating the library Botan and I'm at a point where I have to ask myself if I'm going to change functions and object names respectively from snake_case and Camel_Case to camelCase and CamelCase. Same goes for file names. Is this a strict rule for D libraries?
Re: Strictness of language styling
On 2014-11-10 11:16 AM, Adam D. Ruppe wrote: Personally, I don't really care about naming conventions. I prefer the camelCase and it seems most D people do, but if you're translating another library, there's value it keeping it the same for ease of documentation lookups from the original etc. I was thinking the same but sure am glad to hear you say it :D
Re: Memory usage of dmd
On 2014-11-10 11:32 AM, Xavier Bigand wrote: Is there some options can help me to reduce the memory consumption? As it's for production purpose I don't think that is a good idea to remove compiler optimizations. The memory issues are probably related to diet templates. LDC and GDC won't help. You should definitely work and build on a machine with 4GB of ram. The server application could use as low as 8mb of ram, but compiling requires a workstation. Perhaps renting an amazon instance a few minutes for compilation would be a better idea?
Re: Memory usage of dmd
On 2014-11-10 12:02 PM, Xavier Bigand wrote: As I know to be able to have no down time with vibe we need to be able to build directly on the server where the program runs. Maybe I just need to wait that I have some users to pay a better server with more memory. With a low number of users, there's no reason to worry about a 1 second downtime from closing the process and replacing the application file. You should use a bash script to keep the process open though: # monitor.sh nohup ./autostart.sh stdout.log 2 crash.log /dev/null # autostart.sh while true ; do if ! pgrep -f '{processname}' /dev/null ; then sh /home/{mysitefolder}/start.sh fi sleep 1 done # start.sh nohup ./{yourapplication} --uid={user} --gid={group} stdout.log 2 crash.log stdout.log # install.sh pkill -f '{processname}' /bin/cp -rf {yourapplication} /home/{mysitefolder}/ Using a console, run monitor.sh and the autostart.sh script will re-launch your server through start.sh into a daemon. Verifications will be made every second to ensure your server is never down because of a badly placed assert. If you need to replace your server application with an update, run the install.sh script from the folder where the update is.
Re: Memory usage of dmd
On 2014-11-10 2:52 PM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: If your server runs systemd, I would strongly recommend to use that instead of a shell script. You can use Restart=always or Restart=on-failure in the unit file. It also provides socket activation, which will allow you to restart the program without downtime. I totally agree, I couldn't find a good resource about this though. The shell script method is quite literally rudimentary but it took me a few minutes to put together and it's been working great during 6 months so far. I'll go out and read a systemd tutorial eventually to get this done the right way, if anyone had anything ready and compatible with vibe.d apps I'd be happy about it. For the install script, I guess the best way would be to put together an RPM script and upgrade through that. I'd have to explore that solution, it's quite a lot more than 2 lines of code though :)
Re: Access Violation Tracking
On 2014-11-05 6:09 AM, Bauss wrote: Is there any way to track down access violations, instead of me having to look through my source code manually. I have a pretty big source code and an access violation happens at runtime, but it's going to be a nightmare looking through it all to find the access violation. Not to mention all the tests I have to run. So if there is a way to catch an access violation and find out where it occured it would be appreciated! I've seen a lot more invalid memory operation errors since the GC calls destructors. Letting the GC destroy objects out of order can be the issue. We might have to make an associative array of static global flags (debug bool[void*]) for each object to see if it was destroyed, and use asserts in the destructors / update the associative array, as a new idiom.
Equivalent in D for .p2align 4,,15 ?
I'm looking for the D inline assembler equivalent of the .p2align 4,,15 directive to optimize a loop. Here's more information: http://stackoverflow.com/questions/21546946/what-p2align-does-in-asm-code I tried searching through a turbo assembler tutorial (because D's is based on it) and found nothing except a few hints here: http://www.csn.ul.ie/~darkstar/assembler/manual/a10.txt There might be a way through segments, directives, but I'm not sure at all if D supports it. Does anyone have any idea if/how I can align my code this way or if the compiler handles it?
Re: Equivalent in D for .p2align 4,,15 ?
On 2014-10-29 1:44 PM, anonymous wrote: D inline assembler has an 'align' directive [1]. Aligning to a 16 byte boundary in D: `align 16;`. [1] http://dlang.org/iasm.html -- align IntegerExpression, near the top Of course, align directive works on instructions in asm. Thanks anonymous, that was a very simple explanation.
Using imm8 through inline assembler
I'm trying to write (in DMD) the assembler that handles the function : __m256i _mm256_permute4x64_epi64(__m256i a, in int M); This translates to vpermq The closest thing I could find in DMD assembly is VPERMILPS, which is called with: asm { vpermilps YMM0, YMM1, IMM8; } However, I cannot find out how to make IMM8 with `in int M`. I can convert int - short[4] - ubyte, but I can't move it into imm8 asm { mov imm8, ub; } -- Fails. Does anyone have an idea of what this is and how to define it? Thanks in advance.
Translating inline ASM from C++
I'm translating some library from C++ and I'd need some help with assembler translations. I've read the guides on D inline assembler but it's fairly thin. I don't understand what =r, =a, %0, %1 should be in D. Is this some sort of register? https://github.com/etcimon/botan/blob/master/source/botan/entropy/hres_timer.d#L107 I currently only need to translate these commented statements. If anyone could donate some code for it I'd be grateful, and it would help us all move towards a completely native crypto/ssl library ;)
Re: How do I write __simd(void16*, void16) ?
On 2014-10-10 4:12 AM, ketmar via Digitalmars-d-learn wrote: actually, importing it works like a trigger, and then programmer has access to GCC builtins defined in GCC source. one can read GCC documentation to find more information about 'em. Hi ketmar, Which type would have to be sent to the corresponding functions? I have a hard time figuring out how to use the __m128i with the proper mangling. Does it use core.simd's Vector!x types there?
Re: How do I write __simd(void16*, void16) ?
On 2014-10-10 9:01 AM, ketmar via Digitalmars-d-learn wrote: import core.simd; import gcc.builtins; void main () { float4 a, b; auto tmp = __builtin_ia32_mulps(a, b); // a*b } i don't know what the hell this means, but at least it accepts types from core.simd. ;-) so i assume that other such builtins will accept other types too. Nice! Nobody knows simd but they all know how to make it work. Go figure =)
Using inline assembler
I'm a bit new to the inline assembler, I'm trying to use the `movdqu` operation to move a 128 bit double quadword from a pointer location into another location like this: align(16) union __m128i { ubyte[16] data }; void store(__m128i* src, __m128i* dst) { asm { movdqu [dst], src; } } The compiler complains about a bad type/size of operands 'movdqu', but these two data segments are 16 byte align so they should be in an XMM# register? Is there something I'm missing here?
Re: Using inline assembler
On 2014-10-09 8:54 AM, anonymous wrote: This compiles: align(16) union __m128i { ubyte[16] data; } /* note the position of the semicolon */ void store(__m128i* src, __m128i* dst) { asm { movdqu XMM0, [src]; /* note: [src] */ movdqu [dst], XMM0; } } Yes, this does compile, but the value from src never ends up stored in dst. void main() { __m128i src; src.data[0] = 255; __m128i dst; writeln(src.data); // shows 255 at offset 0 store(src, dst); writeln(dst.data); // remains set as the initial array } http://x86.renejeschke.de/html/file_module_x86_id_184.html Is this how it's meant to be used?
Re: Using inline assembler
Maybe someone can help with the more specific problem. I'm translating a crypto engine here: https://github.com/etcimon/botan/blob/master/source/botan/block/aes_ni/aes_ni.d But I need this to work on DMD, LDC and GDC. I decided to write the assembler code directly for the functions in this module: https://github.com/etcimon/botan/blob/master/source/botan/utils/simd/xmmintrin.d If there's anything someone can tell me about this, I'd be thankful. I'm very experienced in every aspect of programming, but still at my first baby steps in assembler.
Re: Using inline assembler
On 2014-10-09 9:46 AM, anonymous wrote: I'm out of my knowledge zone here, but it seems to work when you move the pointers to registers first: void store(__m128i* src, __m128i* dst) { asm { mov RAX, src; mov RBX, dst; movdqu XMM0, [RAX]; movdqu [RBX], XMM0; } } Absolutely incredible! My first useful working assembler code. You save the day. Now I can probably write a whole SIMD library ;)
Re: How do I write __simd(void16*, void16) ?
On 2014-10-09 2:32 PM, Benjamin Thaut wrote: I know that GDC stopped supporting D style inline asm a while ago. If you need inline asm with GDC you have to use the gcc style inline assembly. I don't know about ldc though. But generally you want to use the official intrinsics with gdc and ldc because they won't perform any optimizations on inline assembly. Kind Regards Benjamin Thaut Any idea where I can find the headers in D for it?
Re: How do I write __simd(void16*, void16) ?
On 2014-10-09 4:29 PM, Benjamin Thaut wrote: I think a good starting point would be Manu's std.simd module. I don't know if he is still working on it, but a old version can be found here: https://github.com/TurkeyMan/simd/blob/master/std/simd.d That's a great reference! I can do a lot from that. I wish it wasn't an EDSL, makes it really hard to translate the simd code to D. You can also find the druntime versions of ldc and gdc on github. For example: https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/simd.di https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/builtins.d Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module. OK, thanks !
Re: How do I write __simd(void16*, void16) ?
On 2014-10-09 5:05 PM, David Nadlinger wrote: On Thursday, 9 October 2014 at 20:29:44 UTC, Benjamin Thaut wrote: Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module. By the way, LDC has ldc.gccbuiltins_x86 too. LLVM doesn't export all the GCC-style intrinsics, though, if they are easily representable in normal LLVM IR (thus ldc.simd). Daivd That's very helpful, the problem remains that the API is unfamiliar. I think most of the time, simd code will only need to be translated from basic function calls, it would've been nice to have equivalents :-p
How do I write __simd(void16*, void16) ?
I can't seem to find this function anywhere: __simd(void16*, void16) The mangling seems to go through to dmd's glue.lib This is for SSE2 operations: MOVDQU = void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU = __m128i _mm_loadu_si128 ( __m128i *p) Would I have to write this with ASM?
Re: How do I write __simd(void16*, void16) ?
On 2014-10-08 3:04 PM, Benjamin Thaut wrote: I strongly advise to not use core.simd at this point. It is in a horribly broken state and generates code that is far from efficient. If I think I'll have to re-write the xmmintrin.h functions I need as string mixins to inline the assembly. Is that supposed to be compatible with LDC/GDC anyways?
Re: vibe.d https_server example fails
Yes, the ssl_stream should be defined outside the if clause. The FreeLostRef refcount goes to 0 when it goes out of scope in http/server.d On Monday, 29 September 2014 at 21:39:03 UTC, Nordlöw wrote: On Monday, 29 September 2014 at 18:37:28 UTC, Martin Nowak wrote: Please report it https://github.com/rejectedsoftware/vibe.d/issues, there seems to be some issue with interface/class casting and manual class allocation. This time I got: Handling of connection failed: Failed to accept SSL tunnel: (336027804) Handling of connection failed: Failed to accept SSL tunnel: fPu: (336027804) Handling of connection failed: Failed to accept SSL tunnel: fPu: (336027804) Error executing command run: Program exited with code -11 I know nothing about https. Do I have to tell my browser about certificates?
Segfault in DMD OSX
I'm having issues with DMD returning exit code -11 rather than compiling my project. I have no idea how to debug this, I'm using Mac OS X 10.9.4 with latest git DMD tagged 2.066, and this project: https://github.com/etcimon/event.d When I hit `dub run`, I get the exit code. Not sure why or where the problem comes from, I can't get GDB to run on the mac (something about Mach task port error in gdb), and dmd DEBUG gives no additional info. Any ideas?
Re: Segfault in DMD OSX
I managed to get gdb running, here's what I get: Starting program: /bin/dmd -lib -m64 -g source/event/internals/epoll.d source/event/internals/kqueue.d source/event/internals/path.d source/event/internals/validator.d source/event/internals/hashmap.d source/event/internals/memory.d source/event/internals/socket_compat.d source/event/internals/win32.d source/event/file.d source/event/tcp.d source/event/timer.d source/event/watcher.d source/event/dns.d source/event/types.d source/event/windows.d source/event/events.d source/event/notifier.d source/event/signal.d source/event/threads.d source/event/udp.d source/event/d.d source/event/posix2.d source/event/posix.d source/event/test.d Using FreeBSD KQueue for events Program received signal SIGSEGV, Segmentation fault. 0x0001000d818b in TemplateInstance::findBestMatch(Scope*, ArrayExpression**) () (gdb) show registers Undefined show command: registers. Try help show. (gdb) registers Undefined command: registers. Try help. (gdb) info registers rax 0x1093fb750 4450137936 rbx 0x0 0 rcx 0x0 0 rdx 0x7fff5fbfebf0 140734799801328 rsi 0x12048d950 4836612432 rdi 0x0 0 rbp 0x7fff5fbfed60 0x7fff5fbfed60 rsp 0x7fff5fbfecb0 0x7fff5fbfecb0 r8 0x106117660 4396775008 r9 0x7fff5fbfed00 140734799801600 r10 0x7fff5fbfed00 140734799801600 r11 0x1a340b60 439618400 r12 0x0 0 r13 0x1001b14cf 4296742095 r14 0x0 0 r15 0x101a34050 4322443344 rip 0x1000d818b 0x1000d818b TemplateInstance::findBestMatch(Scope*, ArrayExpression**)+1339 eflags 0x10246 [ PF ZF IF RF ] cs 0x2b 43 ss unavailable ds unavailable es unavailable fs 0x0 0 gs 0x93f 155123712 (gdb) On 2014-09-22 12:35 PM, Etienne wrote: I'm having issues with DMD returning exit code -11 rather than compiling my project. I have no idea how to debug this, I'm using Mac OS X 10.9.4 with latest git DMD tagged 2.066, and this project: https://github.com/etcimon/event.d When I hit `dub run`, I get the exit code. Not sure why or where the problem comes from, I can't get GDB to run on the mac (something about Mach task port error in gdb), and dmd DEBUG gives no additional info. Any ideas?
Re: Segfault in DMD OSX
Here's with debug symbols in DMD Program received signal SIGSEGV, Segmentation fault. 0x00010013c4d0 in TemplateInstance::findBestMatch (this=0x101c34050, sc=0x12058d740, fargs=0x0) at template.c:7329 7329 tempdecl-kind(), tempdecl-parent-toPrettyChars(), tempdecl-ident-toChars()); (gdb) print havetempdecl $1 = false (gdb) print tempdecl-kind() $2 = 0x100290149 overload alias (gdb) print tempdecl-parent-toPrettyChars() Cannot access memory at address 0x0 (gdb) print tempdecl-ident-toChars() $3 = 0x100515bd8 Array (gdb) print tempdel-parent No symbol tempdel in current context. (gdb) print tempdecl-parent $4 = (Dsymbol *) 0x0 (gdb) print tempdecl $5 = (Dsymbol *) 0x1095fbc50 (gdb) The tempdecl-parent is being accessed even though it may be null in :7329 : ::error(loc, %s %s.%s does not match any template declaration, tempdecl-kind(), tempdecl-parent-toPrettyChars(), tempdecl-ident-toChars());
std.container.array linker error on OS X
Hello, Can anyone help me? Maybe someone has seen this before. I'm getting a (strange) error when testing on OSX with dmd 2.066, the build works with the same compiler/library versions on linux x64 and windows x86 but for some reason it's not working here. The repos are: https://github.com/etcimon/event.d https://github.com/etcimon/vibe.d Both repos must be cloned in the same directory, and I use `dub run` in `vibe.d/examples/http_server` Thanks in advance Here's the error: Linking... Undefined symbols for architecture x86_64: _D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range7opSliceMFZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range, referenced from: _D4vibe4core7drivers6native17NativeManualEvent6__dtorMFZv in libvibe-d.a(native_31a0_6c7.o) _D4vibe4core7drivers6native17NativeManualEvent4emitMFZv in libvibe-d.a(native_31a0_6c7.o) _D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range7opSliceMFmmZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range, referenced from: _D3std9algorithm157__T4copyTS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeTS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZ4copyFS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZ11genericImplFS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range in libvibe-d.a(algorithm_f43_653.o) _D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array7opSliceMFZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range, referenced from: _D4vibe4core7drivers6native17NativeManualEvent6__dtorMFZv in libvibe-d.a(native_31a0_6c7.o) _D4vibe4core7drivers6native17NativeManualEvent4emitMFZv in libvibe-d.a(native_31a0_6c7.o) _D4vibe4core7drivers6native17NativeManualEvent14removeMySignalMFZv in libvibe-d.a(native_31a0_6c7.o) _D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array7opSliceMFmmZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range, referenced from: _D4vibe4core7drivers6native17NativeManualEvent14removeMySignalMFZv in libvibe-d.a(native_31a0_6c7.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) --- errorlevel 1 FAIL .dub/build/application-debug-posix.osx-x86_64-dmd-8B9608AA5A28F1D92DA07A70A9BFD1B2/ http-server-example executable
Re: std.container.array linker error on OS X
I have to specify that AsyncSignal is defined as a final shared class, and the array is defined as a Array!AsyncSignal I'm not sure if the compiler on OSX could act different and add the shared symbols there?
Re: std.container.array linker error on OS X
On 2014-09-09 4:11 PM, Etienne wrote: On 2014-09-09 3:58 PM, Etienne wrote: I have to specify that AsyncSignal is defined as a final shared class, and the array is defined as a Array!AsyncSignal I'm not sure if the compiler on OSX could act different and add the shared symbols there? Meh, I answered my own question. Substituting it from Array!AsyncSignal to Array!(void*) and casting away worked. Looks like dmd-osx has templating problems with shared declarations. I really had to Think Different on that one.
Re: std.container.array linker error on OS X
On 2014-09-09 3:58 PM, Etienne wrote: I have to specify that AsyncSignal is defined as a final shared class, and the array is defined as a Array!AsyncSignal I'm not sure if the compiler on OSX could act different and add the shared symbols there? Meh, I answered my own question. Substituting it from Array!AsyncSignal to Array!(void*) and casting away worked. Looks like dmd-osx has templating problems with shared declarations.
Both shared local classes, method selection
Hey, I'm trying to build a driver for my native event implementation in vibe (https://github.com/etcimon/event.d/ and https://github.com/etcimon/vibe.d/blob/native-events/source/vibe/core/drivers/native.d) I currently have 2 ways of signaling an event loop to wake up, the AsyncNotifier (event loop is local, this is lock-less) and the AsyncSignal (event loop in another thread, this one locks). I must modify LibevManualEvent and rename it to NativeManualEvent in the native.d file, this class inherits ManualEvent. What I'd like to do is be able to have : shared NativeManualEvent m_signal; // uses AsyncSignal as implementation NativeManualEvent m_notifier; // uses AsyncNotifier as implementation I'd like to be able to do `static if (is(typeof(this) == shared))` to implement these two versions differently, but I'm not sure if this event works or if it is the best way. Ideally, I'd like to have the same class redefined with and without `shared`. e.g. final shared class NativeManualEvent; final class NativeManualEvent; so the compiler can choose the right one. Is there a defined way of dealing with this problem?
Re: Both shared local classes, method selection
On 2014-08-29 9:39 AM, Dicebot wrote: based on shared qualified I'd call it a smart ass one and never accepted it through code review :) Such things really need to be explicit, magic is worst enemy of multi-threading The other option is to keep `__gshared ThreadSlot[Thread] gs_signals;` member and add a `NotifierSlot[] m_notifiers;` member, based on a boolean in the constructor `this(bool makeShared = true)`. I wouldn't really want to make another class in the vibe.d interface and make this one forcefully shared, or should I?
Using the delete Keyword /w GC
People have been saying for quite a long time not to use the `delete` keyword on GC-allocated pointers. I've looked extensively through the code inside the engine and even made a few modifications on it/benchmarked it for weeks and I still can't see why it would be wrong. Wouldn't it help avoid collections and make a good hybrid of manual management/collected code? The free lists in the GC engine look quite convenient to use. Any ideas?
COFF32 limitations?
I'm wondering about the COFF on windows x86, if I compile a C++ library in Mingw (gcc 4.9), using the new extern(C++, a.b.c) will I be able to statically link it through DMD?
delegates GC allocations
I've been hearing that delegates get a context pointer which will be allocated on the GC. Is this also true for delegates which stay in scope? e.g. void addThree() { int val; void addOne() { val++; } addOne(); addOne(); addOne(); return val; } Will the above function allocate on the GC?
Re: delegates GC allocations
On 2014-08-20 5:25 PM, Ola Fosheim Gr wrote: Well, I guess simple recursion could be solved easily too by having a wrapper function that puts the frame pointer in a free callee save register... So, my question inspired a new optimization? :-p
Re: extern (c++) std::function?
On 2014-08-15 6:12 AM, Rémy Mouëza wrote: assignments of anonymous/inline ones. You may want to add a layer of abstraction to the API you expose in D so that user D delegates are used from a second extern (C) delegate itself used by the C++ wrapper: Thanks for the detailed answer, this is the direction I'm going to be taking!
Re: Deploying Vibe.d applications to OpenShift
On 2014-07-24 3:45 AM, Nikolay wrote: Please let me know how you did it, because I know it's possible with the DIY-cartridge they provide you(atleast it should be). I tried it some time ago. It is possible but: - vibe.d requires a lot of memory for project compilation - it is hard to install additional libraries (it is not usual Linux distrib) You should compile and test on a CentOS 6.3 machine first and then write the cartridge using the wget command to move the same libevent package and the compiled vibe.d binary. You won't be able to compile on a cartridge. Your cartridge would look like this: https://github.com/Filirom1/openshift-cartridge-nodejs/blob/master/bin/setup
Re: Windows DLL / Windows service
On Saturday, 7 June 2014 at 16:07:47 UTC, Adam D. Ruppe wrote: On Saturday, 7 June 2014 at 14:41:15 UTC, Etienne Cimon wrote: no documentation though. Any idea how to attach/detach with a known example? I'd also like to create a windows DLL that compiles through DMD/GDC/LDC with extern(c) so that folks from C++ can link with it . Check this out: http://wiki.dlang.org/Win32_DLLs_in_D should help you get started. Looks good ! I couldn't find a more recent example for a service but it should be similar I guess
asserts and release
Are asserts supposed to be evaluated in DMD release? I was getting a privileged instructions error 0xC096 which was caused by an assert, when doing some gc programming in druntime