TweetFollow Us on Twitter

Sep 97 Factory Floor

Volume Number: 13 (1997)
Issue Number: 9
Column Tag: From The Factory Floor

A CodeWarrior Java Update

by Dave Mark, ©1997 by Metrowerks, Inc., all rights reserved.

Tim Freehill is the Engineering Manager for the Java Tools team, with technical responsibilities for the compiler, linker and preference panel plugins. He also concentrates on developing his pointy hair style.

Greg Bolsinga writes Class Wrangler, worked on porting the 1.1.1 javac compiler, and enjoys relieving the TX heat at the local swimming holes while not coding. He is a Scorpio, and his favorite color is purple.

Clinton Popetz just can't keep his hands out of the Java pot, and has the burns to prove it. When not engaged in mind-meld with his Mac, he is a typical slap-happy father of two, and a practioner of Kuk Sool Won, a martial art in which he serves as a chew toy for evil black belts.

Scott Kovatch is a software engineer who lives in Round Rock, Texas with his wife Sandy, and their two cats Star and Shadow. He has been working on Macintosh applications for five years, and is currently working on the native implementations for the Metrowerks 1.1 Java virtual machine and Metrowerks Java.

Kevin Buettner is the JIT compiler lead. He concentrates on the overall JIT architecture, performance enhancements, and the PowerPC code generator.

Laurent Visconti is a "virtual" Metrowerks engineer living in Boston. He spans the bridge between the Java and compiler groups at Metrowerks while working on the Java bytecode compiler and the Java to native compiler.

It's hard to believe, but it was just last year that Java first made its appearance on the Mac. Since then, lots has changed. This month's interview is with the Metrowerks Java team. Read on to learn what's coming down the pike in CodeWarrior Java...

Dave: What Java related technologies is Metrowerks working on these days?

Tim: CodeWarrior Java has seen a lot of extra attention recently, and we've really put a lot of work into streamlining the tools and expanding the Java support within CodeWarrior. We are making CodeWarrior work better as a Java development environment, and we're adding new functionality in several areas.

For example, we are working on our ability to compile Java source directly into machine code, leveraging our existing compiler backend technologies to produce quality Java to native code for a variety of platforms. We'll also have a new backend which uses our optimization technology to produce highly optimized bytecodes. Our ClassWrangler tool is growing by leaps and bounds, giving developers a more sophisticated mechanism for exploring their class libraries. Constructor for Java will be growing into a full Rapid Application Development tool for Java and will be fully integrated into the IDE. Lastly, our VM has received perhaps the most attention, giving us current JDK compatibility and undergoing many, many optimizations for speed, both in the core VM and in the JIT.

Dave: What's the story with the CodeWarrior Java to Native compiler? Will it be compatible with the various CW Back-ends?

Laurent: The Java front-end will generate the standard CodeWarrior IR (Intermediate Representation) that is used by all the CW back-ends. Therefore the Java compiler will be able to invoke any existing or future CW back-end. Because of this architecture developers will be able to generate native binaries with no need for a JIT or an interpreter. This architecture also enables the various optimizations performed both at the IR level and in the back-ends. This will allow the generation of binary code from Java sources equivalent in quality to code generated from C/C++ sources.

Dave: And the new Java back-end?

Laurent: We will implement a new Java back-end that will translate IR to Javabytecode. Because of the optimizations performed on the IR, this new back-end will allow developers to generate better optimized bytecodes.

Tim: This is the same optimization technology CodeWarrior uses in some of its other compilers, so it's proven. It will make even the interpreted bytecodes run more quickly, even without a JIT; with a JIT in place, the code runs that much faster. Also, size optimization can make applet class files download more quickly.

Dave: What's new with Class Wrangler?

Greg: First, Class Wrangler is a program that will allow Mac users to create zipfiles and examine zip files, with an emphasis on zip archive files for Java. You can view all the classes in your archive, and add and remove classes from the archive. As Java programmers already know, it's really easy to get class files with file names longer than the Mac's limit of 31 characters.

When you drop a class file onto Class Wrangler, it will examine the actual class data to determine what the class really should be called in the zip archive. Class files keep lots of data about themselves in their object code. In the Information window, you can see all the methods, all the data members, the super class, all the interfaces, the source file, and the package of a class. You can copy the java code or the java signature to the clipboard, which really comes in handy for native method calls, both Java->native and native->Java.

Class Wrangler is also ready for JDK 1.1's JAR files. It will read and write compressed JAR files. We will be expanding ClassWrangler's JAR capability to handle java digital signatures and other security features. Soon we'll also add the ability to put any type of file within the zip file's hierarchy. This way users can create an images directory for their gifs for JDK 1.1, all within a single JAR file. Class Wrangler is a simple utility for Mac Java programmers, but it's handy for all Java programmers. It will be on Windows soon.

Dave: What class libraries will CodeWarrior support?

Tim: Java frameworks are moving towards the component model, which is great for RAD. By using a defined component API, such as Java Beans, we will be able to support a variety of frameworks. The tool need only know the component API. It can query the component, and the user can put them together in a meaningful fashion. This allows our users to choose what framework they want to use, and lets us remain agnostic about whose framework we support.

Dave: Constructor for Java has been final or some time now. Can you tell me about the next generation RAD tools as they relate to Java?

Clint: The preferred mechanism for RAD in Java is quickly becoming Java Beans. Beans provides a simple metadata infrastructure for component software, and this makes it very attractive to RAD tool designers. In the past, developers created their own proprietary scheme for managing processes such as reanimation, event hookup, component introspection, description, and packaging. Beans provides a common API for these pieces, and provides it in a framework independent fashion. Currently, the Java framework landscape is diverse and confusing. But by building our Java RAD plans on Beans, our work can go forward as the framework wars are waged, without fear of obsoletion.

Dave: What VMs will CodeWarrior support? Apple MRJ? Sun JDK VM for Mac? Microsoft VM?

Scott: Well, there are a couple of levels of 'support'. The first is bytecode support -- our Java compiler generates bytecode that will work with any Java VM, whether it's on Windows, Mac, Unix, or any other platform. Then there is run support, which means "What can CodeWarrior tell to run your Java code?" This one's pretty broad as well -- just about any Java-enabled browser, Metrowerks Java, or Sun's applet viewer can be used to run your Java code directly from CodeWarrior.

Finally, there is debugging support, which means "VM's that our debugger can talk to". Our long term plan is for our debugger to support any VM that implements Sun's debug API, and right now, that means the Metrowerks VM and Apple's MRJ. Obviously, the more VMs we support, the more solid your VM testing can be.We understand how important that is. Bottom line, we need to be VM-neutral, but we do play better with some VM's than others.

Dave: Can you talk about the direction of the CW VM?

Scott: I guess the best way to describe the VM's direction is that we don't intend the Metrowerks VM to be the reference standard for Java on the MacOS -- it's up to Apple to do that as it moves Java into the OS. But until that day happens, we'll do everything we can to provide developers with the best tools for Java development. That means making sure that our VM keeps up with enhancements defined by Sun, and providing the additional tools that come along with those VM enhancements. To that end, we've updated the VM, compiler, and Metrowerks Java to version 1.1.x, which should have shipped in final form by the time you read this. (Sun seems to put out .x versions every other week, so who knows where we'll be when this article prints!)

In addition to the 1.1 features you would expect, the 1.1 VM will support a number of APIs that can be used to embed the VM into a developer's application. Apple's JManager API is supported, as well as Sun's JNI and Microsoft's COM.Many people have asked us if we're going to support JRI (Netscape's native interface API). When we wrote the VM for Internet Explorer, there wasn't a need for JRI, so we didn't implement it. But now that Sun's JNI is becoming the standard for a native interface to the VM, and the fact that JNI support is basically cross platform, we decided that we will support JNI in the 1.1 VM. I expect that Apple will move from JRI to JNI as well given that JRI is generally going away, so it looks like our decision was a good one.

We've also added some new features to Metrowerks Java to make it more useful as a Java development tool -- things like a basic JAR file maker, being able to print the console window, more flexible tool dialogs, and the ability to choose which VM you want to work with. As I write this, we're still sorting out what will or won't be included, so there may be more than that, but I can say these will be there.

Dave: What are you doing to improve JIT performance?

Tim: Enhancement of our JIT technology is bringing an enormous speed boost to our VM's performance. We have engineers that are dedicated to optimizing our core JIT technology, and this is really having tangible effects. Between CW11 and CWPro1, our benchmark scores doubled. We expect this trend to continue, as we add more and more optimzations to our JIT.

Kevin: With respect to the JIT, there are two types of optimizations which can be done. The first concerns improvements in code quality, i.e, making the JIT compiler produce code which is more optimal in some way. The second is concerned with making the translator (JIT) itself faster or more space efficient.

Our recent efforts have been towards improving code quality, sometimes at the expense of translator speed. As Tim mentioned, we've seen a tremendous improvement in some of our benchmark scores. This is due to an optimization step which we've added which performs transformations on the internal representation of a method. One example of the type of optimization that we've done is to look for patterns which represent the logical not operator in java. Since there is no java bytecode which represents the logical not, a java compiler is forced to compile something like the following java statement:

cond = !cond;

into the following java bytecodes:

0 iload_0
1 ifeq 8
4 iconst_0
5 goto 9
8 iconst_1
9 istore_0

Note that there are two branch instructions. If we were to naively transform this to native code, we'd also end up with a test and two branch instructions. But on most processors we can do considerably better. What we did is to invent a new instruction called "lnot". Our optimizer recognizes patterns like the above and transforms these patterns to our new "lnot" instruction. Remember that this new instruction is a new instruction in our internal form, not some new bytecode we've added. But if we were to code it as bytecodes, the above would look something like this:

0 iload_0
1 lnot
2 istore_0

Of course there are many other optimizations that we do, but most of them are similar to the one described above where we look for certain types of patterns and then perform the obvious transformation. Our future efforts will be to do more of the same and also some tuning of the JIT compiler itself so that it will do its translation in a shorter amount of time.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »

Price Scanner via MacPrices.net

Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more
Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more

Jobs Board

Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
IT Systems Engineer ( *Apple* Platforms) - S...
IT Systems Engineer ( Apple Platforms) at SpaceX Hawthorne, CA SpaceX was founded under the belief that a future where humanity is out exploring the stars is Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.