February 24, 2014, 12:22 pm

I’ve been working on the stub-building JIT for external routines in DWS lately, and I just checked in a bunch of updates. The JIT will currently handle parameters of most basic types, and return values of integer, enumerated, or object types. (Still working on the rest.) So it’s not complete yet, but it’s getting there.

One thing I’ve run into trouble with, though: A JIT produces code as data. The OS has a security feature called DEP (Data Execution Prevention) that’s supposed to keep you from executing data as code accidentally (or as a victim of a hack attempt). When it’s turned on, things mostly work since I’ve marked the resulting code as executable, but if it hits an exception handler, it kills the process.

I’ve checked all the obvious things, (multiple times!) and by everything I can tell, it should be working. And yet DEP still kills the process in this specific case, so there’s something I must be missing.

I asked on Stack Overflow, and didn’t get any useful responses. I asked in the forums, and got one lead I’m still working on running down, but nothing yet. I’ve reached out to compiler guys and OS engineers at Microsoft, and gotten nothing useful. Apparently this is a very difficult problem for some reason.

If anyone reading this has any idea what’s going on, please let me know. (And again, I’ve checked all the obvious things, multiple times. Please don’t tell me to make sure to mark the memory page as executable, for example.)