Thursday
Aug122010

Debugging on Snow Leopard: getting task_for_pid() to work

Acquiring debug privileges on Snow Leopard is a bit of a pain. You have to follow the following steps:

  • Create a code signing certificate in your login keychain.
  • Find your .plist file in XCode and add a new entry "SecTaskAccess" and set it to "allowed". Make sure the Info.plist file generated in your bundle actually has this value in it.
  • Make XCode sign the executable during the build process, or sign it yourself manually using the codesign command line utility.
  •  Call the following method before making calls to task_for_pid()
 
int acquireTaskportRight() {
    OSStatus status;
    AuthorizationItem taskport_item[] = {{"system.privilege.taskport"}};
    AuthorizationRights rights = {1, taskport_item}, *out_rights = NULL;
    AuthorizationRef author;
    AuthorizationFlags authorizationFlags = kAuthorizationFlagExtendRights

    | kAuthorizationFlagPreAuthorize
    | kAuthorizationFlagInteractionAllowed
    | (1 << 5);

    status = AuthorizationCreate(NULL,
                                 kAuthorizationEmptyEnvironment,
                                 authorizationFlags,
                                 &author);
    if (status != errAuthorizationSuccess) {
        return 0;
    }

    status = AuthorizationCopyRights(author,
                                     &rights,
                                     kAuthorizationEmptyEnvironment,
                                     authorizationFlags,
                                     &out_rights);
    if (status != errAuthorizationSuccess) {
        return 1;
    }

    return 0;
}

Saturday
Mar272010

SPUR: A Trace-Based JIT Compiler for CIL

We recently published some work on Tracing just-in-time compilers for Microsoft’s Common Intermediate Language CIL:

Tracing just-in-time compilers (TJITs) determine frequently executed traces (hot paths and loops) in running programs and focus their optimization effort by emitting optimized machine code specialized to these traces. Prior work has established this strategy to be especially beneficial for dynamic languages such as JavaScript, where the TJIT interfaces with the interpreter and produces machine code from the JavaScript trace.

This direct coupling with a JavaScript interpreter makes it difficult to harness the power of a TJIT for other components that are not written in JavaScript, e.g., the DOM mplementation or the layout engine inside a browser. Furthermore, if a TJIT is tied to a particular high-level language interpreter, it is difficult to reuse it for other input languages as the optimizations are likely targeted at specific idioms of the source language.

To address these issues, we designed and implemented a TJIT for Microsoft’s Common Intermediate Language CIL (the target language of C#, VisualBasic, F#, and many other languages). Working on CIL enables TJIT optimizations for any program compiled to this platform. In addition, to validate that the performance gains of a TJIT for JavaScript do not depend on specific idioms of JavaScript that are lost in the translation to CIL, we provide a performance evaluation of our JavaScript runtime which translates JavaScript to CIL and then runs on top of our CIL TJIT.

Here is the full Tech Report

Wednesday
Oct282009

Constructing SSA the Easy Way

A few friends of mine asked me about SSA recently, and I figured I'd post my thoughts publicly. So, I started a blog posting on how to construct SSA but I quickly became annoyed with the layout features of Blogger and resorted to Latex, which eventually led to me spending my entire weekend on a blaper (blog-paper), so here it is, Constructing SSA the Easy Way.

Thursday
Apr162009

Maxine JIT vs. Hotpath vs. Hotspot

Here are the latest benchmark numbers for JavaGrande Section 2. There are still some issues running more complicated benchmarks but I'm working on that. Maxine uses a lightweight JIT compiler and an optimizing compiler (OPT). These numbers only refer to the JIT because the OPT is currently broken in my developer build.

 

 

 

The GC is having some locking issues at the moment and I had to turn it off. However, these benchmarks don't do any allocation, so the lack of GC shouldn't skew the results too much.

 

Tuesday
Apr142009

Maxine - Hotpath - Big Picture

We presented some of our work at CGO in Seattle this year, so without further ado ...



The poster focuses on the challenges faced when building a Trace Compiler for non-interpreted execution environments, as is the case with Maxine.

Page 1 2 3