Integrating the Habanero Java Race Detector into DrJava

Jarred, Vincent and the guys of the Habanero Java group are planning to add a race detector to the Habanero Java compiler adapter in DrJava. I won’t have much time to help them with this, but I gave them some pointers.

Adding a race detector pane

I would probably use a panel that is shown in the “Tabbed Panes” part at the bottom of DrJava. You could look at JUnitPanel (extending ErrorPanel, which has a list of errors with file-and-line location information) or at BreakpointsPanel (extending RegionsTreePanel, which has a tree of documents, each having line numbers in them).

Specialized handler for race condition runtime exceptions

Right now, we have special treatment for [cci lang=”java”]OutOfMemoryError[/cci] exceptions. This portion is in MainFrame.java:

[cc lang=”java”]else if (lastError.startsWith(“java.lang.OutOfMemoryError”)) {
askToIncreaseSlaveMaxHeap();
}[/cc]

I don’t think this is the perfect place to put it, and we should probably refactor the code at some point so it doesn’t fill up [cci lang=”java”]MainFrame[/cci] even more, but this is the simplest place to extend DrJava. That’s where you could display the race condition pane.

There is one problem: Since the exception is thrown in another JVM (interpreter JVM) and then passed to the JVM where the main DrJava IDE is running (main JVM), the exception would have to be serializable. Right now, we just pass a string, not the exception itself. Unless you want to change the current design, you probably have to put the file and line number information into the string and then parse it again in the IDE.

Compilation options for the Habanero Java compiler adapter

You can create a panel in the Preferences pane in ConfigFrame.java and add options in OptionConstants.java. Then, in
[cci lang=”java”]HjCompiler.transformHJCommand[/cci], you can check the state of those options, e.g. using
[cci lang=”java”]DrJava.getConfig().getSetting(HJ_USE_RACE_DETECTION)[/cci] or something like that, to create the appropriate command line.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

DrJava Listed in Overview of Java IDEs

DrJava was included in this overview of Java IDEs:

Dr. Java- This is a lightweight IDE geared towards students in introductory level classes, including the Advanced Placement Computer Science course. Dr. Java has support for evaluating snippets of code without compiling them. In addition, Dr. Java supports the AP Computer Science GridWorld API, having features to aid developers in getting it setup as well as some basic GridWorld tutorials.

One commenter even listed DrJava as his favorite. I agree, but I’ve probably made DrJava organically grow around me.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

DrJava Preferences Stored in Project Files

I told myself I wouldn’t work on DrJava anymore, but here I go again. I Implemented feature request 3081586, Store Preferences within Projects, mainly because this was something I had wanted for a long time (I kept going back and forth between indent levels of 2 and 4), and because Corky had requested the language level setting to be stored in project files. This feature request was more general than what he wanted, but I think it was what DrJava needed.

There now is an “Advanced” button on the “Project Properties” dialog that takes the user to a secondary window. In that window, the user can list (by name, using predictive input)
those preferences that should be saved in the project file.

Note that for simplicity, the actual values are still configured in the “Preferences” window (Edit menu). This list only names the preferences whose values should be stored in the project file when the project is saved, and restored when the project is loaded again.

By default and for new projects, the language level and the indent level are saved in the project file and restored upon loading of the project.

For existing projects, you can cause DrJava to store the language level in the project file by going to Project Properties, clicking the new “Advanced” button in the bottom left corner, pressing the “Add” button underneath the list, and entering “Language Level”. Once you press OK to add that preference to the list, and OK to close the “Advanced” window, and then “OK” to close the Project Properties window, DrJava will store the language level in the project file.

Now I can set the indent level to 2 for DrJava and to 4 for most other projects. So can you if you grab the latest weekly build of DrJava.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Turing Completeness and the Halting Problem for Sexbots

Mathias: Now, a computer is Turing complete if and only if it can compute everything that can be computed with such a Turing machine, i.e. with a device that has a read/write tape and a finite state automaton. And that’s really it.

Friend: So the sex bot would have states. So why care if a sexbot is Turing complete?

Mathias: Because you want sex with a lot of variety. Not always just “in-out-in-out-done.

Friend: I guess.

Mathias: It’s still predictable (otherwise it wouldn’t be computable), but it’s a lot more difficult. In fact, you can’t even know before you start having sex if the sexbot will ever finish. You might be having sex forever. That’s called the “Sex Halting Problem.”

Friend: What?

Mathias: The only way to find out if the sexbot’s program will ever finish is to have sex with the sexbot, but that might take an eternity.

Friend: [cci]While (1) doSexyTimes()[/cci]. I am still confused as to why this matters.

Mathias: Maybe you want to make sure that you are done by the time your girlfriend comes home. With a Turing-complete sexbot, you generally can’t find that out before you start having sex.

Share
Posted in Uncategorized | Leave a comment

Print This Post Print This Post  

Working on a Recent Plane Trip

I just received two pictures from a recent plane trip. One of them even shows me diligently working on my MacBook and studying my quad-ruled paper notebook. You can see DrJava open on the MacBook.

Working on the plane

Working on the plane

On the plane. I've been flying a lot this year.

On the plane. I've been flying a lot this year.

Share
Posted in Pictures | 1 Comment

Print This Post Print This Post  

AdBlock Plus and Gmail, And Other Issues

I’m experiencing an AdBlock Plus problem in Gmail. At least now I’m sure it’s not a more severe display problem, because I’ve just witnessed it on a second machine. Both are Macs, though.

AdBlock Plus Problem in Gmail

AdBlock Plus Problem in Gmail

The columns for some emails are messed up. The :: and the checkbox on the very left of the marked row are missing, the title goes in the column where the star normally is, and that column is too narrow, of course.

Has someone else seen this? I don’t know AdBlock Plus well enough anymore to figure this out myself, so I just reported the issue. Let’s hope this gets fixed soon.

In other news, Mac OS 10.6 Snow Leopard is nice, but they still didn’t fix the problem of Java GUI programs, particularly when run in a JUnit suite, stealing the focus. Setting up Spaces does not help, which is very lame. I had to set up a second user account again and then do the Fast User Switching.

Also annoying is the fact that MacPorts doesn’t seem to have some of the programs I got used to in Fink, but Fink doesn’t have binaries for Snow Leopard yet… And dedicated keys to control keyboard illumination brightness? Is that really necessary?

Share
Posted in Ramblings | Leave a comment

Print This Post Print This Post  

Spam on the DrJava SourceForge Trackers

We’ve been getting tons of pharmaceutical spam on the DrJava trackers (bug reports, feature requests, support requests) today. Unfortunately, when it comes to limiting the amount of spam from automated bots, the only mechanism that SourceForge provides is requiring users to register for a SourceForge account.

I don’t like doing this, but at this point, it seems like it’s the only simple action we can take. There are more advanced “hosted apps” that can be used for bug tracking, but I have not evaluated any of them.

If you feel strongly that we should allow anonymous postings again, please let me know.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Paging Stuff Back Into My Brain

I gave the second lecture as Corky’s substitute in COMP 311 today. We talked about object-oriented languages in general, and Java in particular.

I didn’t talk about the historical perspective on OO (slide 5), and I only mentioned multiple inheritance and prototype-based OO languages briefly. Other than that, I finished slides 1-7, i.e. including “Java Implementation I”. I also talked a bit about static and dynamic chains, how Java doesn’t have a static chain, and why.

I’m always happy when I get the opportunity to do a lecture.

Now I’m loading stuff back into my brain that I had paged out into swap space a few months ago…

Share
Posted in Concurrent Unit Testing, Teaching | Leave a comment

Print This Post Print This Post  

New Mint Release: r15952

I made a new release of Mint and DrJava with Mint yesterday: October 19, 2010 (r15952). The latest release is, as always, available from the Mint implementation page:

There were several bug fixes regarding assignment to variables declared as CodeFree, the places where SafeCode is required, treatment of type variables with bounds in escapes, and array types, which were erroneously printed as ‘[Lfoo/bar;’ or ‘[B’.

The version of DrJava with Mint is based on the current trunk (and therefore is newer than the updated stable release of DrJava that was recently made available).

(Re-posted from The Java Mint Blog.)

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

A Nice Monday

I had a very nice Monday today. Corky asked me to take over his lecture in COMP 311 today while he is at SPLASH/OOPSLA. I handed out the exam and reviewed the sample midterm. I’m quite happy about how the class period went.

I ran out of time towards the end, so I didn’t do the hand evaluation or parameter passing in detail, but I think I communicated the gist of it. I think on Wednesday I’ll ask if anyone has already taken the exam, and if not, review a bit more.

After that, I headed over to my customer meeting with the COMP 410 students. I was a bit late, and they apparently were hoping I hadn’t made it back from Europe yet, because they needed a few more days for their prototype.

And after that I went to yoga. I needed that hour. Now I’ll see if I can get to bed before it’s Tuesday.

Share
Posted in Teaching, Uncategorized | Leave a comment

Print This Post Print This Post  

Another DrJava User Site: University of Western Ontario

I found another university that uses DrJava in its CS curriculum: The University of Western Ontario teaches CS 1026: Computer Science Fundamentals I using DrJava.

The course is based on Mark Guzdial’s and Barbara Ericson’s Media Computation textbook. Having had Georgia Tech as clients has certainly been most beneficial for DrJava.

I have added UWO to the list of DrJava user sites.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Back from GPCE 2010

After a rather long return journey and more than enough time at the Amsterdam-Schiphol airport, I’m back from my trip to GPCE 2010 in Eindhoven. It was fun.

Eddy and I presented a tutorial on DSL implementation in Mint. Of course, I don’t have a picture of that, but Eelco might. But here’s Sukyoung Ryu presenting her tutorial on Fortress.

Sukyoung Ryu's GPCE 2010 Tutorial on Fortress

Sukyoung Ryu's GPCE 2010 Tutorial on Fortress

The auditorium for GPCE was nice, but it didn’t have power outlets. After 10 years in Texas, I guess that’s how I generally feel about Europe: quaint, a bit cramped and underpowered ;-)

GPCE Auditorium in Eindhoven

GPCE Auditorium in Eindhoven

Also very European: Train, bike, landscape with canals.

Train, bike, landscape with canals

Train, bike, landscape with canals

Some more pictures from the trip:

Eindhoven train station, for a quick escape

Eindhoven train station, for a quick escape

Landscape from the train

Landscape from the train

Ready to leave Amsterdam-Schiphol airport

Ready to leave Amsterdam-Schiphol airport

And here are some more pictures that Eddy took. Proof that I exist!

At the Amsterdam-Schiphol airport train station

At the Amsterdam-Schiphol airport train station

"Looking very European" with my scarf

"Looking very European" with my scarf

Share
Posted in Mint, Pictures | Leave a comment

Print This Post Print This Post  

Benoît Mandelbrot Died at Age 85

Just after Eddy and I used the Mandelbrot set as benchmark in our DSL tutorial, Benoît Mandelbrot died. The Franco-American mathematician, who is most well-known for popularizing fractal geometry, died at the age of 85.

Thank you for giving us such a visually appealing way of demonstrating our optimization for embarrassingly parallel loops.

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

Tutorial Lecture: Agile and Efficient Domain-Specific Languages using Multi-stage Programming in Java Mint

Agile and Efficient Domain-Specific Languages using Multi-stage Programming in Java Mint (PowerPoint, PDF, view embedded)

Tutorial Proposal
(PDF, view embedded)
Source code (ZIP file)

Mathias Ricken, Edwin Westbrook and Walid Taha

A tutorial lecture presented at the

Ninth International Conference on
Generative Programming and Component Engineering (GPCE’10)

October 10-13, 2010
Eindhoven, The Netherlands

Abstract

Domain-specific languages (DSLs) are a powerful productivity tool
because they allow domain experts, who are not necessarily programming
experts, to quickly develop programs. DSL implementations have unique
constraints for programming languages because they must be efficient,
in order to ensure high productivity, but they must also be agile, in
order to meet the rapidly changing demands of their domains. In this
tutorial we show how multi-stage programming (MSP) can be used to
build staged interpreters, which combine the agility of interpreters
with the efficiency of compilers. The tutorial is conducted in Java
Mint, an multi-stage Java based on recent work incorporating MSP into
imperative object-oriented languages. In the first half of
the tutorial, we introduce MSP by demonstrating how to write a staged
interpreter for a number of basic language constructs, such as
recursive functions, conditionals, and let expressions. In the second
half, we extend our staged interpreter to take advantage of several
well-known compiler optimizations, including type inference, constant
folding, and static parallel loop scheduling. We highlight the opportunities
afforded by using MSP with object-oriented design to quickly create
efficient DSL implementations.

Presenter Biographies

Mathias Ricken is a doctoral candidate in the Programming Languages
Team at Rice University and one of the principal developers of the
DrJava integrated development environment. His research interests
include concurrent programming, extending the Java language, and
computer science education. He is the developer of the Concutest
concurrent unit testing framework and has created various experimental
extensions of Java to address, for instance, programming with
meta-data. Currently, Mathias is contributing to Java Mint, a
multi-stage extension of Java that allows safe and expressive
statically typed program generation and specialization in an
imperative language setting.

Edwin Westbrook is a post-doctoral researcher at Rice University. His
primary interests are in developing techniques for implementing and
verifying properties of domain-specific languages (DSLs). He has
worked on a number of projects in this area, including: Cinic, a type
theory for building machine-checked proofs of properties of DSLs using
a new approach to higher-order abstract syntax; Java Mint, a
multi-stage version of Java used for efficient implementations of
DSLs; and Acumen, a DSL for designing cyber-physical systems.

Walid Taha is an professor at Halmstad University. His current interest is in modeling and simulation of cyberphysical systems. He was the principal investigator on a number of research awards and contracts from the National Science Foundation (NSF), Semi-conductor Research Consortium (SRC), and Texas Advanced Technology Program (ATP). He received an NSF CAREER award to develop Java Mint. He is the principle designer Java Mint, Acumen, MetaOCaml, and the Verilog Preprocessor. He founded the ACM Conference on Generative Programming and Component Engineering (GPCE), the IFIP Working Group on Program Generation (WG 2.11), and the Middle Earth Programming Languages Seminar (MEPLS). In 2009, he chaired the IFIP Working Conference on Domain Specific Languages (DSLs).

Share
Posted in Publications | 1 Comment

Print This Post Print This Post  

Another Image Processing Example in Our Staged DSL

Last night, we implemented a Mandelbrot example in the image processing DSL that we created for our GPCE tutorial. Here’s a screenshot.

Screen Capture of Mandelbrot in our Staged DSL

Screen Capture of Mandelbrot in our Staged DSL

Share
Posted in Mint | 1 Comment

Print This Post Print This Post  

GPCE’10 Tutorial Slides

The slides for our GPCE 2010 tutorial presentation “Agile and Efficient Domain-Specific Languages using Multi-Stage Programming in Java Mint” are available now as PowerPoint and PDF file.

The zip file with the source code for our GPCE 2010 tutorial is available too.

The simplest way to experiment with Mint is to download the latest version of DrJava with Mint.

(Re-posted from The Java Mint Blog.)

Share
Posted in Mint | 1 Comment

Print This Post Print This Post  

GPCE’10 Tutorial Source

Here is a zip file with the source code for our GPCE 2010 tutorial.

The simplest way to experiment with Mint is to download the latest version of DrJava with Mint.

(Re-posted from The Java Mint Blog.)

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

Rice Graduate-Undergraduate Research Mixer

I’m glad that I went to the Graduate-Undergraduate Research Mixer organized by the SA and GSA at Rice with my poster today: I was the only computer scientist there.

Rice Grad/Undergrad Research Mixer Java PLT Poster

Rice Grad/Undergrad Research Mixer Java PLT Poster

Rice Grad/Undergrad Research Mixer

Rice Grad/Undergrad Research Mixer

The Central Quad started to fill up a little after 6 PM, and I had interested students standing by my poster and asking questions for about an hour. I was able to do some good advertisement for computer science in general and the programming languages group in particular. I think making DrJava a centerpiece of several research projects, which Corky and I have begun to do, is a good strategy. I told students they can work on DrJava and use COMP 402 to fulfill their BS CAP requirement and get involved in Habanero Java, for example, if they are interested in parallel programming.

Hopefully we’ll have some undergraduates in our production programming class next semester, or students interested in independent study.

Share
Posted in DrJava, Pictures, Research | Leave a comment

Print This Post Print This Post  

Poster: Java Programming Language Team

Research Summary: Java Programming Language Team

Where: Rice University Undergraduate-Graduate Research Mixer 2010
When: October 7, 2010

This poster shows a summary of my work in the Java Programming Languages Team in the Department of Computer Science at Rice University. Generally, my efforts can be grouped into the four categories of (1) testing concurrent programs, (2) multi-stage programming, (3) computer science education, and (4) developing DrJava. The poster also shows how these four areas are interconnected.

Share
Posted in Publications | 1 Comment

Print This Post Print This Post  

Gaussian Blur Implemented in Our DSL

Sexy!

Gaussian Blur in DSL Screenshot

Gaussian Blur in DSL Screenshot

A screenshot showing an original image of random grayscale values, and a blurred version of the image, with the source code in our example DSL for the GPCE tutorial in the background.

Share
Posted in Mint | Leave a comment

Print This Post Print This Post