Merge changes up to trunk@1022963.

git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/java/branches/mrh@1023369 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.xml b/build.xml
index b779969..c41f802 100644
--- a/build.xml
+++ b/build.xml
@@ -32,6 +32,8 @@
     <property name="hy.select" value="false" />
 
     <property name="hy.hdk" location="${hy.target}/hdk" />
+    <property name="hy.component" location="federated" />
+    <property name="hy.module" location="toplevel" />
 
     <!-- property to identify when components are being built by the 
          federated build -->
@@ -43,7 +45,15 @@
     <!-- import some vm-specific properties -->
     <property file="${vm.dir.loc}/make/build.properties" />
 
-    <import file="common_resources/make/properties.xml" />
+    <property name="common.resources" location="common_resources" />
+
+    <mkdir dir="${hy.hdk}/build/ant" />
+    <copy todir="${hy.hdk}/build/ant" preservelastmodified="true">
+        <fileset dir="${common.resources}/make" includes="*.xml"/>
+    </copy>
+
+    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <init-hdk />
 
     <description>
         Apache Harmony project federation script
@@ -470,6 +480,8 @@
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
             <property name="keep.working" value="true" />
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
         <!-- hack to make sure the federated build doesn't use the classlib
              LICENSE/NOTICE files as they don't cover ICU4C
@@ -487,6 +499,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -497,6 +511,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -507,6 +523,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -516,16 +534,20 @@
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
             <property name="keep.working" value="true" />
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
     <target name="-init-classlib-hdk-for-clean">
-        <ant antfile="classlib/build.xml"
+ <!--       <ant antfile="classlib/build.xml"
              target="-init-hdk-for-clean" inheritAll="false" >
             <propertyset refid="required.props" />
             <property name="keep.working" value="true" />
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
-    </target>
+-->    </target>
 
     <target name="-init-hdk">
         <ant antfile="${vm.dir.loc}/build.xml"
@@ -533,6 +555,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -548,6 +572,8 @@
             <property name="deploy.canonical.flag" value="false"/>
             <property name="drlvm.deploy.dir" location="${hy.hdk}"/>
             <property name="import.hdk" value="false"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -556,6 +582,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -566,6 +594,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -576,6 +606,8 @@
             <propertyset refid="required.props" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -588,6 +620,8 @@
             <property name="deploy.canonical.flag" value="false"/>
             <property name="drlvm.deploy.dir" location="${hy.hdk}"/>
             <property name="import.hdk" value="false"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -598,15 +632,17 @@
             depends="init,-init-hdk,auto-fetch-depends-jdktools">
         <ant antfile="jdktools/build.xml" target="build" inheritall="false" >
             <propertyset refid="required.props" />
-            <property name="common.resources" location="common_resources" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
     <target name="auto-fetch-depends-jdktools" if="auto.fetch">
         <ant target="fetch-depends-jdktools" inheritall="false" >
             <propertyset refid="required.props" />
+            <property name="hy.target" location="${hy.target}"/>
             <property name="common.resources" location="common_resources" />
         </ant>
     </target>
@@ -616,6 +652,7 @@
         <ant antfile="jdktools/build.xml" target="fetch-depends"
              inheritall="false" >
             <propertyset refid="required.props" />
+            <property name="hy.target" location="${hy.target}"/>
             <property name="common.resources" location="common_resources" />
         </ant>
     </target>
@@ -625,6 +662,7 @@
         <ant antfile="jdktools/build.xml" target="check-depends"
              inheritall="false" >
             <propertyset refid="required.props" />
+            <property name="hy.target" location="${hy.target}"/>
             <property name="common.resources" location="common_resources" />
         </ant>
     </target>
@@ -632,9 +670,10 @@
     <target name="clean-jdktools">
         <ant antfile="jdktools/build.xml" target="clean" inheritall="false" >
             <propertyset refid="required.props" />
-            <property name="common.resources" location="common_resources" />
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
+            <property name="hy.target" location="${hy.target}"/>
+            <property name="common.resources" location="common_resources" />
         </ant>
     </target>
 
@@ -653,7 +692,16 @@
                  clean-classlib,
                  clean-vm,
                  clean-tests" >
-        <delete dir="${hy.target}" failonerror="false" />
+        <delete includeemptydirs="true" failonerror="false">
+            <fileset dir="${hy.target}">
+                <exclude name="depends/**" />
+            </fileset>
+        </delete>
+    </target>
+
+    <target name="distclean">
+        <delete dir="${hy.target}"
+                includeemptydirs="true" failonerror="false" />
     </target>
 
     <!-- ============================================================== -->
@@ -800,8 +848,9 @@
             <property name="svn.info" value="${harmony.long.version}"/>
             <property name="svn.revision" value="${harmony.version}"/>
             <property name="keep.working" value="true" />
-            <property name="tests.output" location="${hy.target}/test_report" />
-            <property name="test.jre.home" location="${hy.target}/hdk/jdk/jre" />
+            <property name="tests.output" location="${hy.target}/test_report"/>
+            <property name="test.jre.home"
+                      location="${hy.target}/hdk/jdk/jre" />
         </ant>
     </target>
 
diff --git a/classlib/build.xml b/classlib/build.xml
index f03fec6..121cfdd 100644
--- a/classlib/build.xml
+++ b/classlib/build.xml
@@ -31,7 +31,7 @@
 
   ant build
     Compiles the java and native code to produce a jdk in
-    "deploy/jdk".
+    "target/hdk/jdk".
 
   ant clean
     Removes all the files generated by a build.
@@ -72,16 +72,33 @@
 
     <property file="${user.home}/.harmony-classlib.properties" />
 
-    <property name="hy.hdk" location="deploy" />
+    <property name="hy.target" location="target" />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="toplevel" />
 
-    <property name="build.output" location="build/classes" />
-    <property name="tests.output" location="build/test_report" />
-    <property name="tests.support.output" location="build/test_support" />
-    <property name="tests.report.dir" value="${tests.output}/html"/>
+    <fail message="Property 'common.resources' is not defined">
+        <condition>
+            <not><isset property="common.resources" /></not>
+        </condition>
+    </fail>
+
+    <mkdir dir="${hy.target}/hdk/build/ant" />
+    <copy todir="${hy.target}/hdk/build/ant" preservelastmodified="true">
+        <fileset dir="${common.resources}/make" includes="*.xml"/>
+    </copy>
 
     <!-- import properties for snapshot targets -->
-    <import file="make/properties.xml" />
-    <import file="make/depends.xml" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
+    <init-hdk/>
+
+    <property name="build.output" location="${hy.build.top}/java" />
+    <property name="tests.output" location="${hy.target}/test_report" />
+    <property name="tests.support.output" location="${hy.build.top}/test" />
+    <property name="tests.report.dir" value="${tests.output}/html"/>
+    <property name="depends.files" location="depends/files"/>
+    <property name="depends.manifests" location="depends/manifests"/>
+
+    <import file="${hy.hdk}/build/ant/depends.xml" />
     <property file="make/depends.properties" />
 
     <condition property="needs.vme.v3.hack" value="true">
@@ -91,6 +108,12 @@
         </or>
     </condition>
 
+    <propertyset id="toplevel.props">
+        <propertyref name="hy.target" />
+        <propertyref name="hy.component" />
+        <propertyref name="hy.module" />
+    </propertyset>
+
     <!-- ================================
 	 target : rebuild
 	     
@@ -105,7 +128,7 @@
 
     <target name="clean"
             depends="-init-hdk-for-clean,-clean-modules,-clean-check,
-                     -clean-native,-clean-test,-clean-hdk" 
+                     -clean-native,-clean-test" 
             description="Removes all the files generated by a build" />
 
     <target name="-build-java" unless="skip.java.build"
@@ -312,11 +335,29 @@
             description="Compiles the native code only" >
 
         <!-- these must be run in a specific order due to dependencies -->
-    	<ant dir="modules/portlib" target="-build-native" />
-        <ant dir="modules/luni" target="-build-native-core" />
-    	<ant dir="modules/archive" target="-build-native" />
-    	<ant dir="modules/luni" target="-build-native-secondary" />
+    	<ant dir="modules/portlib" target="-build-native"
+             inheritall="false">
+            <property name="hy.target" location="${hy.target}"/>
+            <propertyset refid="module.props" />
+        </ant>
 
+        <ant dir="modules/luni" target="-build-native-core"
+             inheritall="false">
+            <property name="hy.target" location="${hy.target}"/>
+            <propertyset refid="module.props" />
+        </ant>
+
+    	<ant dir="modules/archive" target="-build-native"
+             inheritall="false">
+            <property name="hy.target" location="${hy.target}"/>
+            <propertyset refid="module.props" />
+        </ant>
+
+    	<ant dir="modules/luni" target="-build-native-secondary"
+             inheritall="false">
+            <property name="hy.target" location="${hy.target}"/>
+            <propertyset refid="module.props" />
+        </ant>
     </target>
 
     <target name="-layout-natives" unless="skip.native.build"
@@ -439,7 +480,7 @@
     <!-- ================================= 
           target: -properties
          ================================= -->
-    <target name="-properties" depends="-svn-prop">
+    <target name="-properties" depends="-svn-info">
         <property name="deploy.file.prefix"
                   value="harmony-classlib-r${svn.revision}" />
         <property name="deploy.tar"
@@ -523,12 +564,17 @@
     </target>
 
     <target name="-check-depends" description="Check top-level dependencies">
-        <ant antfile="make/depends.xml" inheritall="false" target="check" />
+        <ant antfile="make/depends.xml" inheritall="false" target="check">
+            <propertyset refid="toplevel.props" />
+        </ant>
     </target>
 
     <target name="fetch-depends" depends="-init-hdk"
         description="Fetches dependencies. Note: Some of Harmony's dependencies are licensed under terms other than the Apache License v2.">
-        <ant antfile="make/depends.xml" inheritall="false" target="download" />
+        <ant antfile="make/depends.xml" inheritall="false" target="download">
+            <propertyset refid="toplevel.props" />
+        </ant>
+
         <poll-modules target="fetch-depends" />
     </target>
 
@@ -610,11 +656,6 @@
         <init-hdk />
     </target>
 
-    <target name="-clean-hdk">
-        <delete dir="${hy.hdk}/build/ant" />
-	<delete dir="${hy.hdk}/build/make" />
-    </target>
-    
     <macrodef name="chksum">
         <attribute name="file" />
         <attribute name="type" default="md5" />
@@ -626,47 +667,5 @@
         </sequential>
     </macrodef>
 
-    <macrodef name="init-hdk">
-        <sequential>
-            <mkdir dir="${hy.hdk}/build/ant" />
-            <copy file="make/properties.xml"
-                  tofile="${hy.hdk}/build/ant/properties.xml"
-                  outputencoding="UTF-8" >
-                <filterchain>
-                    <tokenfilter>
-                        <replacestring from="Top-Level property definitions"
-                                       to="Classlib property definitions" />
-                    </tokenfilter>
-                </filterchain>
-            </copy>
-            <copy file="make/make.xml"
-                  tofile="${hy.hdk}/build/ant/make.xml"
-                  outputencoding="UTF-8" >
-            </copy>
-            <copy file="make/depends-common.xml"
-                  tofile="${hy.hdk}/build/ant/depends.xml"
-                  outputencoding="UTF-8" >
-                <filterchain>
-                    <tokenfilter>
-                        <replacestring from="Common dependency definitions"
-                                       to="Classlib dependency definitions" />
-                    </tokenfilter>
-                </filterchain>
-            </copy>
-            <copy file="make/depends.properties"
-                  tofile="${hy.hdk}/build/ant/depends.properties"
-                  outputencoding="UTF-8" >
-            </copy>
-
-	    <mkdir dir="${hy.hdk}/build/make" />
-	    <copy todir="${hy.hdk}/build/make" overwrite="yes">
-                <fileset dir="depends/build">
-                    <include name="**" />
-                </fileset>
-            </copy>
-
-        </sequential>
-    </macrodef>
-
 </project>
 
diff --git a/classlib/depends/build/rules.mk b/classlib/depends/build/rules.mk
deleted file mode 100644
index 197c782..0000000
--- a/classlib/depends/build/rules.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#  
-#      http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-#
-# Configuration Makefile
-#
-
-CFLAGS := $(DEFINES) $(INCLUDES) $(OPT) $(PLATFORM) $(CFLAGS) $(WARNFLAGS)
-CXXFLAGS := $(DEFINES) $(INCLUDES) $(OPT) $(PLATFORM) $(CXXFLAGS) $(WARNFLAGS)
-EXPFILE = $(notdir $(basename $(DLLNAME))).exp
-
-ifneq ($(HY_OS),zos)
-# Convert $(LIBPATH)libblah.so to -L$(LIBPATH) ... -lblah, also for $(DLLPATH)
-MDLLIBARGS := \
-  $(MDLLIBPREFIX) -L$(LIBPATH) -L$(DLLPATH) \
-  $(patsubst $(LIBPATH)lib%$(HY_LINKLIB_SUFFIX),-l%, \
-    $(patsubst $(DLLPATH)lib%$(HY_LINKLIB_SUFFIX),-l%, $(MDLLIBFILES))) \
-  $(MDLLIBSUFFIX)
-else
-# Do not change on zOS
-MDLLIBARGS := \
-  $(MDLLIBPREFIX) $(MDLLIBFILES) $(MDLLIBSUFFIX)
-endif
-
-all: $(DLLNAME) $(EXENAME) $(LIBNAME)
-
-$(LIBNAME): $(BUILDFILES)
-	$(AR) $(ARFLAGS) $(ARCREATE) $@ $(BUILDFILES)
-	$(RANLIB) $@
-
-$(EXPFILE): exports.txt
-ifeq ($(HY_OS),aix)
-	cp $< $@
-else
-	echo "$(EXPNAME) {" >$@
-	echo "  global :" >>$@
-	sed -e's/^/    /;s/$$/;/' <$< >>$@
-	echo "  local : *;" >>$@
-	echo "};" >>$@
-endif
-
-$(DLLNAME): $(BUILDFILES) $(MDLLIBFILES) $(EXPFILE)
-	$(DLL_LD) $(DLL_LDFLAGS) $(LDFLAGS) $(VMLINK) -o $@ \
-	$(BUILDFILES) $(MDLLIBARGS) $(OSLIBS)
-ifeq ($(HY_CAN_LINK_DEBUG),yes)
-	objcopy --only-keep-debug $@ $@.dbg
-	strip --strip-debug --strip-unneeded $@
-	( cd $(@D) && objcopy --add-gnu-debuglink=$(@F).dbg $(@F) )
-	-mkdir -p $(DBGPATH)
-	test "$@.dbg" = "$(DBGPATH)$(@F).dbg" || \
-		mv $@.dbg $(DBGPATH)$(@F).dbg
-endif
-ifeq ($(HY_OS),zos)
-	mv $(notdir $(basename $(DLLNAME)))$(HY_LINKLIB_SUFFIX) $(LIBPATH)
-endif
-
-$(EXENAME): $(BUILDFILES) $(MDLLIBFILES)
-	$(CC) $(VMLINK) $(EXELDFLAGS) \
-	$(BUILDFILES) $(MDLLIBARGS) -o $@ $(OSLIBS) \
-	$(EXERPATHPREFIX) -L$(DLLPATH)
-	@chmod 755 $(EXENAME)
-
-clean:
-	-rm -f $(BUILDFILES) $(DLLNAME) $(EXENAME) $(LIBNAME) $(EXPFILE) \
-	       $(CLEANFILES) $(DBGPATH)$(notdir $(DLLNAME)).dbg
diff --git a/classlib/make/depends-common.xml b/classlib/make/depends-common.xml
deleted file mode 100644
index 4bdb9b9..0000000
--- a/classlib/make/depends-common.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- 
-
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-     
-      http://www.apache.org/licenses/LICENSE-2.0
-     
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-  implied.  See the License for the specific language governing
-  permissions and limitations under the License.
-
- -->
-
-<project name="Common dependency definitions" default="none" basedir="..">
-    <description>
-    Confirm that dependencies are present and fetch missing dependencies
-    where possible.
-    </description>
-
-    <property name="maven2.base"
-              value="http://mirrors.ibiblio.org/pub/mirrors/maven2" />
-
-    <loadproperties srcfile="${basedir}/make/depends.properties">
-      <filterchain>
-        <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
-            <param type="token" name="${hy.arch}" value=""/>
-            <param type="token" name="${hy.os.family}" value=""/>
-            <param type="token" name="${hy.platform}" value=""/>
-            <param type="token" name="${hy.platform.variant}" value=""/>
-        </filterreader>
-      </filterchain>
-    </loadproperties>
-
-    <macrodef name="download-one-file">
-        <attribute name="src" />
-        <attribute name="dest" />
-        <attribute name="md5" />
-        <attribute name="md5-deprecated" default="" />
-        <sequential>
-            <echo>Checking @{dest}</echo>
-            <available file="@{dest}" type="file"
-                       property="@{dest}.exists" />
-            <antcall target="-really-download">
-                <param name="src" value="@{src}" />
-                <param name="dest" value="@{dest}" />
-            </antcall>
-            <checksum file="@{dest}" property="@{dest}.md5" />
-            <condition property="@{dest}.md5.verified" value="true">
-                <or>
-                    <equals arg1="${@{dest}.md5}" arg2="@{md5}" />
-                    <equals arg1="${@{dest}.md5}" arg2="@{md5-deprecated}" />
-                </or>
-            </condition>
-            <antcall target="-remove-file-if-bad">
-                <param name="dest" value="@{dest}" />
-            </antcall>
-            <property name="@{dest}.fullpath" location="@{dest}" />
-            <fail unless="@{dest}.md5.verified">
-...
-
-File ${@{dest}.fullpath} has incorrect md5 checksum.
-    Expected: @{md5} (or @{md5-deprecated})
-    Found:    ${@{dest}.md5}
-
-            </fail>
-            <echo>Checksum verified (${@{dest}.md5.verified})</echo>
-        </sequential>
-    </macrodef>
-
-    <target name="-really-download" unless="${dest}.exists">
-        <echo>Fetching ${dest}</echo>
-        <get src="${src}" dest="${dest}" verbose="true" />
-    </target>
-
-    <target name="-remove-file-if-bad" unless="${dest}.md5.verified">
-        <delete file="${dest}" />
-    </target>
-
-    <macrodef name="check-one-file">
-        <attribute name="src" />
-        <attribute name="dest" />
-        <sequential>
-            <echo level="info">Checking for @{dest}</echo>
-            <available file="@{dest}" type="file"
-                       property="@{dest}.exists" />
-            <fail>
-                <condition>
-                    <not>
-                        <isset property="@{dest}.exists" />
-                    </not>
-                </condition>
-...
-
-Missing dependency.  The jar from:
-
-  @{src}
-
-should be downloaded to:
-
-  @{dest}
-
-Run "ant fetch-depends" to automatically fetch dependencies.
-Note: Some of Harmony's dependencies are licensed under terms other
-than the Apache License v2.
-            </fail>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="check-os-file">
-        <attribute name="src" />
-        <attribute name="message" />
-        <sequential>
-            <echo level="info">Checking for system file @{src}</echo>
-            <available file="@{src}" type="file"
-                       property="@{src}.exists" />
-            <fail>
-                <condition>
-                    <not>
-                        <isset property="@{src}.exists" />
-                    </not>
-                </condition>
-...
-
-Missing dependency.  The system file:
-
-  @{src}
-
-is missing.
-
-@{message}
-            </fail>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="check-one-link">
-        <attribute name="src" />
-        <attribute name="dest" />
-        <attribute name="message" />
-        <sequential>
-            <echo>Checking for @{dest}</echo>
-            <available file="@{dest}" type="file"
-                       property="@{dest}.exists" />
-            <available file="@{src}" type="file"
-                       property="@{src}.exists" />
-            <fail>
-                <condition>
-                    <and>
-                        <not>
-                            <isset property="@{dest}.exists" />
-                        </not>
-                        <not>
-                            <isset property="@{src}.exists" />
-                        </not>
-                    </and>
-                </condition>
-...
-
-Missing dependency.  The file from:
-
-  @{src}
-
-should be linked to:
-
-  @{dest}
-
-But @{src} doesn't exist.
-@{message}
-            </fail>
-            <antcall target="-really-link">
-                <param name="src" value="@{src}" />
-                <param name="dest" value="@{dest}" />
-            </antcall>
-        </sequential>
-    </macrodef>
-
-    <target name="-really-link" unless="${dest}.exists">
-        <echo>Linking ${dest}</echo>
-        <symlink resource="${src}" link="${basedir}/${dest}" />
-    </target>
-
-    <macrodef name="fetch">
-        <attribute name="dep" />
-        <sequential>
-            <dirname file="${@{dep}}" property="@{dep}.dir"/>
-            <mkdir dir="${@{dep}.dir}"/>
-            <download-one-file dest="${@{dep}}" 
-                src="${@{dep}.url}" md5="${@{dep}.md5}"/>
-            <unzip-one-file dep="@{dep}"/>
-        </sequential>
-    </macrodef>
-
-    <target name="-really-unzip" unless="unzipped" if="unzip.path">
-        <tempfile destdir="${dest}" property="tmp"/>
-        <unzip src="${src}" dest="${tmp}" >
-            <patternset includes="${unzip.path}"/>
-        </unzip>
-        <touch>
-            <fileset dir="${tmp}">
-                <patternset includes="${unzip.path}"/>
-            </fileset>
-        </touch>
-        <move todir="${dest}" flatten="yes" failonerror="no">
-            <fileset dir="${tmp}">
-                <patternset includes="${unzip.path}"/>
-            </fileset>
-        </move>
-        <delete dir="${tmp}" />
-    </target>
-
-    <macrodef name="unzip-one-file">
-        <attribute name="dep" />
-        <sequential>
-            <dirname file="${@{dep}}" property="@{dep}.dir"/>
-            <!-- quite tricky way to detect if unzip operation is pending,
-                still not very robust ...
-                Life could be simpler if unzip supported nested mappers
-            -->
-            <basename file="${@{dep}}" property="@{dep}.basename"/>
-            <basename file="${@{dep}.unzip.path}" property="@{dep}.unzip.basename"/>
-            <pathconvert property="@{dep}.matching.list" setonempty="no">
-                <path><fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}"/></path>
-            </pathconvert>
-            <pathconvert property="@{dep}.uptodate.list" setonempty="no">
-                <path>
-                    <fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}">
-                        <depend targetdir="${@{dep}.dir}">
-                            <mapper type="merge" to="${@{dep}.basename}"/>
-                        </depend>
-                    </fileset>
-                </path>
-            </pathconvert>
-            <condition property="@{dep}.unzipped">
-                <equals arg1="${@{dep}.uptodate.list}" arg2="${@{dep}.matching.list}"/>
-                <!--uptodate srcfile="${@{dep}}"
-                        targetfile="${@{dep}.dir}/${@{dep}.unzip.basename}"/-->
-            </condition>
-
-            <antcall target="-really-unzip">
-                <param name="src" value="${@{dep}}" />
-                <param name="dest" value="${@{dep}.dir}" />
-                <propertyset>
-                  <propertyref prefix="@{dep}.unzip"/>
-                  <globmapper from="@{dep}.*" to="*"/>
-                </propertyset>
-            </antcall>
-        </sequential>
-    </macrodef>
-
-</project>
diff --git a/classlib/make/depends.xml b/classlib/make/depends.xml
index 033a84d..fc32abd 100644
--- a/classlib/make/depends.xml
+++ b/classlib/make/depends.xml
@@ -25,10 +25,8 @@
     where possible.
     </description>
 
-    <property name="hy.hdk" location="${basedir}/deploy" />
-
-    <import file="${basedir}/make/properties.xml" />
-    <import file="${basedir}/make/depends-common.xml" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
+    <import file="${hy.target}/hdk/build/ant/depends.xml" />
 
     <target name="check" description="Check whether dependencies are available"
             depends="-check,-check-win,-extract" />
diff --git a/classlib/make/properties.xml b/classlib/make/properties.xml
deleted file mode 100644
index 9a171bc..0000000
--- a/classlib/make/properties.xml
+++ /dev/null
@@ -1,1101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-  implied.  See the License for the specific language governing
-  permissions and limitations under the License.
-
- -->
-
-<project name="Top-Level property definitions" default="echo" basedir="..">
-    <description>
-        Ant file of common properties to be imported by other ant files.
-        Property "hy.hdk" must be defined before this file is imported.
-    </description>
-
-    <property file="${user.home}/.harmony-classlib.properties" />
-
-    <fail message="Property 'hy.hdk' is not defined">
-        <condition>
-            <not><isset property="hy.hdk" /></not>
-        </condition>
-    </fail>
-    <property name="hy.jdk" location="${hy.hdk}/jdk" />
-    <property name="hy.jre" location="${hy.jdk}/jre" />
-
-    <!-- Debug or release version -->
-    <property name="hy.cfg" value="debug" />
-    <property name="hy.specification.version" value="1.5" />
-
-    <!-- Javac properties -->
-    <!-- Explicitly set to ECJ as the default compiler. -->
-    <property name="hy.javac.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
-    <property name="hy.javac.source" value="1.5" />
-    <property name="hy.javac.target" value="1.5" />
-    <property name="hy.javac.maxmem" value="384M" />
-    <property name="hy.javac.debug" value="on" />
-    <property name="hy.jar.compress" value="true" />
-    <property name="build.compilerarg" value="-nowarn" />
-
-    <!-- Include only stack trace information into release build -->
-    <condition property="hy.javac.debuglevel" value="lines,vars,source" else="lines,source">
-        <equals arg1="${hy.cfg}" arg2="debug" />
-    </condition>
-
-    <!-- During packaging, these files must be copied into the meta-inf dir -->
-    <fileset id="hy.required.metainf-files" dir="${hy.hdk}">
-        <include name="NOTICE" />
-        <include name="LICENSE" />
-    </fileset>
-
-    <!-- Test run property -->
-    <property name="hy.test.forkmode" value="once" />
-    <property name="hy.test.timeout" value="900000" />
-    <property name="hy.test.vmargs" value="" />
-    <property name="hy.test.impl" value="true" />
-    <condition property="hy.run.impl.tests" value="true">
-        <istrue value="${hy.test.impl}" />
-    </condition>
-
-    <!-- Conditions for operating systems -->
-    <condition property="is.windows">
-        <os family="Windows" />
-    </condition>
-    <condition property="is.linux">
-        <os name="linux" />
-    </condition>
-    <condition property="is.macosx">
-        <os name="mac os x" />
-    </condition>
-    <condition property="is.freebsd">
-        <os name="freebsd" />
-    </condition>
-    <condition property="is.aix">
-        <os name="aix" />
-    </condition>
-    <condition property="is.unix">
-        <os family="unix" />
-    </condition>
-    <condition property="is.zos">
-        <os name="z/OS" />
-    </condition>
-
-    <!-- Normalized operating system family -->
-    <condition property="hy.os.family" value="windows">
-        <isset property="is.windows" />
-    </condition>
-    <property name="hy.os.family" value="unix" />
-
-    <!-- Normalized operating system name -->
-
-    <!-- this special case makes sense -->
-    <condition property="hy.os" value="windows">
-        <isset property="is.windows"/>
-    </condition>
-    <condition property="hy.os" value="linux">
-        <os name="linux" />
-    </condition>
-    <condition property="hy.os" value="freebsd">
-        <os name="freebsd" />
-    </condition>
-    <condition property="hy.os" value="macosx">
-        <isset property="is.macosx"/>
-    </condition>
-    <condition property="hy.os" value="aix">
-        <os name="aix" />
-    </condition>
-    <condition property="hy.os" value="zos">
-        <isset property="is.zos"/>
-    </condition>
-
-    <property name="hy.os" value="${os.name}" />
-
-
-
-    <!-- Conditions for different architectures -->
-    <condition property="is.x86_64">
-        <or>
-            <equals arg1="x86_64" arg2="${os.arch}"/>
-            <equals arg1="amd64" arg2="${os.arch}"/>
-        </or>
-    </condition>
-    <condition property="is.x86">
-	<and>
-	    <not>
-                <isset property="is.x86_64" />
-            </not>
-            <or>
-                <equals arg1="x86" arg2="${os.arch}"/>
-                <equals arg1="i386" arg2="${os.arch}"/>
-                <equals arg1="i686" arg2="${os.arch}"/>
-            </or>
-        </and>
-    </condition>
-    <condition property="is.ia64">
-        <equals arg1="ia64" arg2="${os.arch}"/>
-    </condition>
-    <condition property="is.ppc32">
-        <or>
-            <equals arg1="${os.arch}" arg2="ppc32" />
-            <equals arg1="${os.arch}" arg2="ppc" />
-        </or>
-    </condition>
-    <condition property="is.ppc64">
-        <equals arg1="${os.arch}" arg2="ppc64" />
-    </condition>
-    <condition property="is.s390x">
-        <equals arg1="${os.arch}" arg2="s390x" />
-    </condition>
-    <condition property="is.s390">
-        <equals arg1="${os.arch}" arg2="s390" />
-    </condition>
-
-    <condition property="is.64bit">
-        <or>
-            <isset property="is.ia64" />
-            <isset property="is.x86_64" />
-            <isset property="is.ppc64" />
-            <isset property="is.s390x" />
-        </or>
-    </condition>
-    <condition property="is.32bit">
-        <or>
-            <isset property="is.x86" />
-            <isset property="is.ppc32" />
-            <isset property="is.s390" /> <!-- 31bit of course -->
-        </or>
-    </condition>
-    <condition property="hy.bits" value="32">
-        <isset property="is.32bit" />
-    </condition>
-    <property name="hy.bits" value="64" />
-
-    <!-- Normalized architecture name -->
-    <condition property="hy.arch" value="x86_64">
-        <isset property="is.x86_64" />
-    </condition>
-    <condition property="hy.arch" value="x86">
-        <and>
-            <isset property="is.x86" />
-            <isset property="is.32bit" />
-        </and>
-    </condition>
-    <condition property="hy.arch" value="ppc32">
-        <isset property="is.ppc32" />
-    </condition>
-    <property name="hy.arch" value="${os.arch}" />
-    
-    <!-- Normalized platform name -->
-    <property name="hy.platform" value="${hy.os}.${hy.arch}"/>
-    <property name="hy.platform.path" value="${hy.os}/${hy.arch}"/>
-
-    <condition property="exe.suffix" value=".exe">
-        <isset property="is.windows"/>
-    </condition>
-    <property name="exe.suffix" value="" />
-
-    <condition property="shlib.prefix" value="">
-        <isset property="is.windows"/>
-    </condition>
-    <property name="shlib.prefix" value="lib" />
-
-    <condition property="shlib.suffix" value=".dll">
-        <isset property="is.windows"/>
-    </condition>
-    <condition property="shlib.suffix" value=".dylib">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="shlib.suffix" value=".so" />
-
-    <condition property="progdb.suffix" value=".pdb">
-        <isset property="is.windows" />
-    </condition>
-
-    <condition property="object.suffix" value=".obj">
-        <isset property="is.windows" />
-    </condition>
-    <property name="object.suffix" value=".o" />
-
-    <condition property="linklib.suffix" value=".lib">
-        <isset property="is.windows"/>
-    </condition>
-    <condition property="linklib.suffix" value=".x">
-        <isset property="is.zos" />
-    </condition>
-    <condition property="linklib.suffix" value=".dylib">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="linklib.suffix" value=".so" />
-    
-    <condition property="shlib.is.linklib">
-        <equals arg1="${shlib.suffix}" arg2="${linklib.suffix}"/>
-    </condition>
-
-    <property name="manifest.suffix" value=".manifest" />
-
-    <condition property="make.command" value="nmake.exe">
-        <isset property="is.windows"/>
-    </condition>
-    <condition property="make.command" value="gmake">
-        <or>
-            <isset property="is.aix"/>
-            <isset property="is.freebsd"/>
-            <isset property="is.zos"/>
-        </or>
-    </condition>
-    <property name="make.command" value="make" />
-
-    <condition property="make.arg" value="/nologo">
-        <isset property="is.windows"/>
-    </condition>
-    <property name="make.arg" value="" />
-
-    <condition property="make.suffix" value="mak">
-        <isset property="is.windows"/>
-    </condition>
-    <property name="make.suffix" value="mk" />
-
-    <condition property="png.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="png.home" value="/opt/local">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="png.home" value="/usr" />
-
-    <condition property="lcms.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="lcms.home" value="/opt/local">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="lcms.home" value="/usr" />
-
-    <condition property="jpeg.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="jpeg.home" value="/opt/local">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="jpeg.home" value="/usr" />
-    
-    <condition property="is.select" value="true">
-        <istrue value="${hy.select}" />
-    </condition>
-    <condition property="is.not.select" value="true">
-        <not><istrue value="${hy.select}" /></not>
-    </condition>
-
-    <!-- default property for poll-modules macro - i.e. all modules -->
-    <property name="build.module" value="*" />
-    <condition property="exclude.module"
-            value="accessibility,applet,awt,imageio,orb,print,rmi,sound,swing">
-        <istrue value="${hy.select}" />
-    </condition>
-    <property name="exclude.module" value="nothing" />
-    <property name="build.java" value="true" />
-    <property name="build.native" value="true" />
-    <property name="build.test" value="true" />
-    <condition property="skip.java.build" value="true">
-        <equals arg1="${build.java}" arg2="false" />
-    </condition>
-    <condition property="skip.native.build" value="true">
-        <equals arg1="${build.native}" arg2="false" />
-    </condition>
-    <condition property="skip.test.build" value="true">
-        <equals arg1="${build.test}" arg2="false" />
-    </condition>
-
-    <!-- flags -->
-    <property name="hy.no.thr" value="false" />
-    <condition property="hy.skip.thr" value="true">
-        <istrue value="${hy.no.thr}" />
-    </condition>
-
-    <property name="hy.thr.no.deploy" value="false" />
-    <condition property="hy.thr.deploy" value="true">
-        <equals arg1="${hy.thr.no.deploy}" arg2="false" />
-    </condition>
-
-    <property name="hy.local.zlib" value="false" />
-    <condition property="hy.skip.zlib" value="true">
-        <istrue value="${hy.local.zlib}" />
-    </condition>
-
-    <property name="hy.zip.api" value="false" />
-    <condition property="hy.skip.zip.api" value="true">
-        <isfalse value="${hy.zip.api}" />
-     </condition>
-
-    <condition property="hy.portlib.stubs" value="true">
-        <or>
-            <equals arg1="${hy.os}" arg2="aix" />
-            <equals arg1="${hy.os}" arg2="zos" />
-        </or>
-    </condition>
-    <property name="hy.portlib.stubs" value="false" />
-
-    <condition property="hy.libstdc++.suffix" value=".libstdc++5">
-        <isset property="use.libstdc++5"/>
-    </condition>
-    <property name="hy.libstdc++.suffix" value="" />
-
-    <property name="hy.platform.variant"
-              value="${hy.platform}${hy.libstdc++.suffix}" />
-
-    <!-- fileset to represent classes built by a module. -->
-    <fileset id="classes" dir="../../build/classes">
-        <includesfile name="${hy.hdk}/build/ant/patternsets/${hy.module}.txt" />
-    </fileset>
-
-    <!-- fileset for resources of a module. -->
-    <fileset id="resources" dir="src/main/java">
-        <exclude name="**/*.java" />
-    </fileset>
-
-    <!-- fileset for resources of a module with platform-dependent code. -->
-    <fileset id="common.resources" dir="src/main/java/common">
-        <exclude name="**/*.java" />
-    </fileset>
-
-    <!-- test properties -->
-    <property name="tests.output" location="../../build/test_report" />
-    <property name="tests.hdk.dir" value="${hy.hdk}/build/test/${hy.module}" />
-    <property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" />
-    <property name="tests.resources.hdk.dir"
-              value="${tests.hdk.dir}/resources" />
-
-    <property name="findBugs.report" location="../../build/findbugs_report" />
-
-    <target name="echo" depends="-svn-prop, -svn-info, test-jre-vm-info"
-            description="Display the properties defined by this ant file" >
-        <echo>
-Harmony release configuration property:
-
-  hy.cfg = ${hy.cfg}
-
-Harmony javac properties:
-
-  hy.javac.compiler = ${hy.javac.compiler}
-  hy.javac.target = ${hy.javac.target}
-  hy.javac.source = ${hy.javac.source}
-  hy.javac.debug  = ${hy.javac.debug}
-  hy.javac.maxmem = ${hy.javac.maxmem}
-  build.compilerarg = ${build.compilerarg}
-
-Harmony test properties:
-
-    hy.test.forkmode = ${hy.test.forkmode}
-    hy.test.timeout = ${hy.test.timeout}
-    hy.test.vm.name = ${hy.test.vm.name}
-    hy.test.vmargs = ${hy.test.vmargs}
-    findbugs.available = ${findbugs.available}
-
-Harmony platform properties:
-
-  hy.os = ${hy.os}
-  hy.os.family = ${hy.os.family}
-  hy.arch = ${hy.arch}
-  hy.bits = ${hy.bits}
-  hy.platform = ${hy.platform}
-  hy.platform.path = ${hy.platform.path}
-
-  is.windows = ${is.windows}
-  is.unix = ${is.unix}
-  is.linux = ${is.linux}
-  is.freebsd = ${is.freebsd}
-  is.macosx = ${is.macosx}
-  is.aix = ${is.aix}
-  is.zos = ${is.zos}
-  is.32bit = ${is.32bit}
-  is.64bit = ${is.64bit}
-  is.x86 = ${is.x86}
-  is.x86_64 = ${is.x86_64}
-  is.ia64 = ${is.ia64}
-  is.ppc32 = ${is.ppc32}
-  is.ppc64 = ${is.ppc64}
-  is.s390 = ${is.s390}
-  is.s390x = ${is.s390x}
-
-  exe.suffix = ${exe.suffix}
-  shlib.prefix = ${shlib.prefix}
-  shlib.suffix = ${shlib.suffix}
-  make.command = ${make.command}
-
-  hy.hdk = ${hy.hdk}
-  hy.jdk = ${hy.jdk}
-  hy.jre = ${hy.jre}
-
-The following property is only set if the "-svn-prop" target has been
-called:
-
-  svn.revision = ${svn.revision}
-
-
-The following property is only set if the "-svn-info" target has been
-called:
-
-  svn.info = ${svn.info}
-
-Ant native properties, for information, but please use Harmony
-properties in preference to these:
-
-  os.name = ${os.name}
-  os.arch = ${os.arch}
-
-        </echo>
-    </target>
-
-    <target name="-svn-prop" unless="svn.revision">
-        <exec executable="svn">
-            <arg value="--non-interactive" />
-            <arg value="info" />
-            <redirector outputproperty="svn.revision">
-                <outputfilterchain>
-                    <linecontains>
-                        <contains value="Revision: " />
-                    </linecontains>
-                    <tokenfilter>
-                        <replacestring from="Revision: " to=""/>
-                    </tokenfilter>
-                </outputfilterchain>
-            </redirector>
-        </exec>
-    </target>
-
-    <target name="-svn-info" unless="svn.info">
-        <exec executable="svn"
-              failifexecutionfails="false"
-              resultproperty="svn.rc">
-            <arg value="info" />
-            <redirector outputproperty="svn.info.tmp">
-                <outputfilterchain>
-                    <linecontainsregexp>
-                        <regexp pattern="Repository Root:|Revision:" />
-                    </linecontainsregexp>
-                    <tokenfilter>
-                        <replacestring from="Repository Root: " to=""/>
-                        <replacestring from="Revision: " to=" "/>
-                    </tokenfilter>
-                    <striplinebreaks/>
-                </outputfilterchain>
-            </redirector>
-        </exec>
-        <condition property="svn.info" value="${svn.info.tmp}" >
-            <equals arg1="${svn.rc}" arg2="0" />
-        </condition>
-        <tstamp>
-            <format property="svn.info" pattern="'Unknown revision at' dd-MMM-yyyy hh:mm aa"/>
-        </tstamp>
-    </target>
-
-    <target name="test-jre-vm-info" depends="-get-test-vm-output">
-        <echo level="info" message="java -version${line.separator}${test.vm.info.tmp}" />
-        <!-- Add other runtime names here -->
-        <condition property="hy.test.vm.name" value="ri" >
-            <contains string="${test.vm.info.tmp}" substring="HotSpot"/>
-        </condition>
-        <condition property="hy.test.vm.name" value="jr" >
-            <contains string="${test.vm.info.tmp}" substring="JRockit"/>
-        </condition>
-        <!-- FIXME current behavior relies on the fact that J9 VM doesn't
-             support -version parameter -->
-        <condition property="hy.test.vm.name" value="ibm" else="drl" >
-            <contains string="${test.vm.info.tmp}" substring="IBM" casesensitive="false" />
-        </condition>
-        <echo level="info" message="hy.test.vm.name = ${hy.test.vm.name}" />
-    </target>
-
-    <target name="-get-test-vm-output">
-        <condition property="test.jre.home" value="${hy.jre}">
-            <not><isset property="test.jre.home" /></not>
-        </condition>
-        <exec executable="${test.jre.home}/bin/java" failifexecutionfails="false">
-            <arg value="-version" />
-            <redirector outputproperty="test.vm.info.tmp"/>
-        </exec>
-    </target>
-
-    <macrodef name="poll-modules" 
-        description="directory-based macros for polling sub-builds">
-        <attribute name="target" />
-        <attribute name="dir" default="modules" />
-        <attribute name="includes" default="${build.module}"/>
-        <attribute name="excludes" default="${exclude.module}"/>
-        <attribute name="antfile" default="*.xml"/>
-        <sequential>
-            <!-- convert dirset pattern to fileset pattern-->
-            <property name="@{dir}.loc" location="@{dir}"/>
-            <pathconvert property="list.@{dir}.@{target}" 
-                pathsep="${file.separator}@{antfile}," setonempty="no">
-                <path>
-                    <dirset dir="@{dir}"
-                            includes="@{includes}"
-                            excludes="@{excludes}">
-                        <exclude name=".*" />
-                    </dirset>
-                </path>
-                <map from="${@{dir}.loc}${file.separator}" to=""/>
-            </pathconvert>
-            <!-- append antfile suffix to last item in the list, if any -->
-            <condition property="poll.@{dir}.@{target}"
-                value="${list.@{dir}.@{target}}${file.separator}@{antfile}" 
-                else="">
-                <isset property="list.@{dir}.@{target}"/>
-            </condition>
-            <poll-build target="@{target}" dir="@{dir}" 
-                includes="${poll.@{dir}.@{target}}"/>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="poll-build"
-        description="plain-filter macros for polling sub-builds">
-        <attribute name="target" />
-        <attribute name="dir" />
-        <attribute name="includes" default="**/*.xml"/>
-        <attribute name="excludes" default=""/>
-        <sequential>
-            <echo message="polling @{includes}"/>
-            <subant target="@{target}">
-                <!-- TODO: modules probably need to work these properties
-                     out for themselves in order to reduce coupling -->
-                <property name="hy.test.vm.name" value="${hy.test.vm.name}"/>
-                <property name="hy.hdk" value="${hy.hdk}"/>
-                <property name="hy.select" value="${hy.select}"/>
-                <property name="svn.revision" value="${svn.revision}"/>
-                <property name="svn.info" value="${svn.info}"/>
-                <property name="hy.no.thr" value="${hy.no.thr}"/>
-                <property name="hy.zip.api" value="${hy.zip.api}"/>
-                <fileset dir="@{dir}" includes="@{includes}" excludes="@{excludes}">
-                    <containsregexp expression="&lt;target[^&gt;]*name=&quot;@{target}&quot;"/>
-                </fileset>
-            </subant>
-        </sequential>
-    </macrodef>
-
-    <!-- macros for modules -->
-    <!-- TOFIX move to a shared file in the HDK/build/make directory. -->
-
-    <macrodef name="make">
-        <attribute name="dir" />
-        <attribute name="target" default="" />
-        <element name="make-elements" optional="true" />
-        <sequential>
-            <echo>Making "@{target}" in @{dir}</echo>
-            <echo file="${hy.hdk}/build/make/properties.${make.suffix}">
-HY_ZIP_API=${hy.zip.api}
-HY_PORTLIB_STUBS=${hy.portlib.stubs}
-HY_CFG=${hy.cfg}
-HY_ARCH=${hy.arch}
-HY_OS=${hy.os}
-HY_PLATFORM=${hy.platform}
-HY_NO_THR=${hy.no.thr}
-HY_THR_NO_DEPLOY=${hy.thr.no.deploy}
-HY_LOCAL_ZLIB=${hy.local.zlib}
-HY_SHLIB_SUFFIX=${shlib.suffix}
-HY_LINKLIB_SUFFIX=${linklib.suffix}
-            </echo>                
-            <exec failonerror="true"
-                  executable="${make.command}"
-                  dir="@{dir}">
-                <env key="HY_HDK" value="${hy.hdk}" />
-                <arg line="${make.arg}" />
-                <arg line="@{target}" />
-                <make-elements />
-            </exec>
-        </sequential>
-    </macrodef>
-
-
-    <!-- To use with -Dtest.case=... option                   -->
-    <!-- if ${test.case} is provided in package+class form    -->
-    <!-- it is converted to dir+filename form                 -->
-    <macrodef name="convert-test">
-        <attribute name="from"/>
-        <attribute name="to"/>
-        <sequential>
-            <pathconvert property="@{to}" setonempty="no">
-                <path path="${@{from}}"/>
-                <chainedmapper>
-                    <filtermapper>
-                        <replaceregex pattern="\.java$$"/>
-                    </filtermapper>
-                    <unpackagemapper from="${basedir}${file.separator}*" to="*.java"/>
-                </chainedmapper>
-            </pathconvert>
-        </sequential>
-    </macrodef>
-    <convert-test from="test.case" to="converted.tc" />
-    
-    <!-- Concatenate several exclude lists into single list -->
-    <macrodef name="prepare-exclude-list">
-       <attribute name="moduleName"/>
-       <!-- directory with exclude lists for the module -->
-       <attribute name="dir"/>
-       <!-- name of concatenated list, should be an absolute pathname -->
-       <attribute name="result"/>
-       <sequential>
-            <!-- names of exclude lists, used by prepare-exclude-list macro -->
-            <property name="common.exclude.file" value="exclude.common" />
-            <property name="common.exclude.interm" value="exclude.interm" />
-            <property name="platform.exclude.file"
-                      value="exclude.${hy.platform}.${hy.test.vm.name}" />
-            <property name="platform.exclude.interm"
-                      value="exclude.${hy.platform}.${hy.test.vm.name}.interm"
-            />
-
-            <dirname file="@{result}" property="@{result}.dir" />
-            <mkdir dir="${@{result}.dir}" />
-
-           <echo message="" file="@{result}"/>
-           <concat destfile="@{result}" force="yes" fixlastline="yes" append="true">
-               <fileset dir="@{dir}">
-                   <include name="${common.exclude.file}"/> 
-                   <include name="${platform.exclude.file}"/>
-                   <include name="${common.exclude.interm}" if="exclude.interm" />
-                   <include name="${platform.exclude.interm}" if="exclude.interm" />
-                   <size value="0" when="more"/>
-               </fileset>
-           </concat>
-       </sequential>
-   </macrodef>
-    
-    <macrodef name="ensure-javac">
-        <sequential>
-            <fail>
-                <condition>
-                    <and>
-                        <equals arg1="${hy.javac.compiler}" arg2="org.eclipse.jdt.core.JDTCompilerAdapter"/>
-                        <not>
-                            <available classname="${hy.javac.compiler}"/>
-                        </not>
-                    </and>
-                </condition>
-The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib.
-The JAR can be downloaded directly from eclipse.org or copied from common_resources/depends/jars/ecj_3.x folder after the fetch-depends target for jdktools has been run.
-Alternatively, you can switch to another compiler, e.g. specify '-Dhy.javac.compiler=modern' for classic javac.                
-            </fail>
-        </sequential>
-    </macrodef>
-   
-    <presetdef name="hy.javac">
-        <javac compiler="${hy.javac.compiler}"
-               memoryMaximumSize="${hy.javac.maxmem}"
-               source="${hy.javac.source}"
-               target="${hy.javac.target}"
-               debug="${hy.javac.debug}"
-               debuglevel="${hy.javac.debuglevel}"
-               includeantruntime="false">
-            <compilerarg line="${build.compilerarg}" />
-        </javac>
-    </presetdef>
-
-    <presetdef name="hy.jar.bin">
-        <jar compress="${hy.jar.compress}">
-            <manifest>
-                <attribute name="Implementation-Title" value="Apache Harmony"/>
-                <attribute name="Implementation-Vendor"
-                           value="The Apache Software Foundation"/>
-                <attribute name="Implementation-Vendor-Id"
-                           value="org.apache.harmony"/>
-                <attribute name="Implementation-URL"
-                           value="http://harmony.apache.org"/>
-                <attribute name="Implementation-Version" value="${svn.info}"/> 
-                <attribute name="Specification-Vendor"
-                           value="Sun Microsystems, Inc." />
-                <attribute name="Specification-Title"
-                           value="Java Platform API Specification" />
-                <attribute name="Specification-Version"
-                           value="${hy.specification.version}" />
-                <attribute name="X-Compile-Source-JDK"
-                           value="${hy.javac.source}"/> 
-                <attribute name="X-Compile-Target-JDK"
-                           value="${hy.javac.target}"/> 
-            </manifest>
-            <metainf refid="hy.required.metainf-files"/>
-        </jar>
-    </presetdef>
-
-    <presetdef name="hy.jar.src">
-        <jar compress="${hy.jar.compress}">
-            <manifest>
-                <attribute name="Implementation-Title" value="Apache Harmony"/>
-                <attribute name="Implementation-Vendor"
-                           value="The Apache Software Foundation"/>
-                <attribute name="Implementation-Vendor-Id"
-                           value="org.apache.harmony"/>
-                <attribute name="Implementation-URL"
-                           value="http://harmony.apache.org"/>
-                <attribute name="Implementation-Version" value="${svn.info}"/> 
-                <attribute name="Specification-Vendor"
-                           value="Sun Microsystems, Inc." />
-                <attribute name="Specification-Title"
-                           value="Java Platform API Specification" />
-                <attribute name="Specification-Version"
-                           value="${hy.specification.version}" />
-            </manifest>
-            <metainf refid="hy.required.metainf-files"/>
-        </jar>
-    </presetdef>
-   
-    <macrodef name="compile-classes">
-        <attribute name="description" default="" />
-        <attribute name="destdir" default="../../build/classes" />
-        <element name="javac-elements" />
-        <sequential>
-            <echo message="Compiling @{description}" />
-            
-            <mkdir dir="@{destdir}" />
-
-            <hy.javac sourcepath="" destdir="@{destdir}">
-                <javac-elements />
-                <compilerarg line="${build.compilerarg}" />
-                <bootclasspath>
-                    <fileset dir="${hy.jre}/lib/boot">
-                        <include name="**/*.jar" />
-                    </fileset>
-                </bootclasspath>
-            </hy.javac>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="compile-tests">
-        <attribute name="description" default="" />
-        <attribute name="destdir" default="bin/test" />
-        <element name="javac-elements" />
-        <sequential>
-            <echo message="Compiling @{description}" />
-            
-            <mkdir dir="@{destdir}" />
-
-            <mkdir dir="${hy.hdk}/build/test" />
-            <copy file="${junit.jar}"
-                  tofile="${hy.hdk}/build/test/junit.jar" />
-            <copy file="${hamcrest-library.jar}"
-                  tofile="${hy.hdk}/build/test/hamcrest-library.jar" />
-            
-            <hy.javac destdir="@{destdir}">
-
-                <javac-elements />
-
-                <compilerarg line="${build.compilerarg}" />
-
-                <bootclasspath>
-                    <fileset dir="${hy.jre}/lib/boot">
-                        <include name="**/*.jar" />
-                    </fileset>
-                </bootclasspath>
-
-                <classpath location="../../build/classes" />
-                <classpath location="${hy.hdk}/build/test/junit.jar" />
-                <classpath
-                     location="${hy.hdk}/build/test/hamcrest-library.jar" />
-                <classpath location="${hy.hdk}/build/test/support.jar" />
-            </hy.javac>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="run-hdk-tests">
-        <attribute name="module" />
-        <attribute name="jar" />
-        <element name="junit-elements" optional="true"/>
-        <element name="excludeorinclude" optional="true"/>
-        <sequential>
-            <echo message="Running @{module} Unit Test from @{jar}" />
-            <echo message="Tested jre: ${test.jre.home}/bin/java" />
-            <property name="test.module.dir" value="${target.dir}/@{module}" />
-            <property name="test.excludes.dir" value="${test.module.dir}/excludes" />
-            <property name="test.resources.dir" value="${test.module.dir}/resources" />
-            <property name="module.work.dir" location="${work.dir}/@{module}" />
-            <property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
-
-            <property name="module.temp.dir"
-                      location="${work.dir}/@{module}/temp" />
-            <property name="junit.tempdir"
-                      location="${module.temp.dir}/ant" />
-            <property name="junit.java.io.tmpdir"
-                      location="${module.temp.dir}/tmpdir" />
-            <property name="junit.user.home"
-                      location="${module.temp.dir}/user" />
-            
-            <mkdir dir="${tests.output}" /> 
-            <mkdir dir="${junit.tempdir}" />
-            <mkdir dir="${junit.java.io.tmpdir}" />
-            <mkdir dir="${junit.user.home}" />
-
-            <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
-            <junit fork="yes" 
-                   forkmode="${hy.test.forkmode}" 
-                   timeout="${hy.test.timeout}" 
-                   printsummary="withOutAndErr" 
-                   errorproperty="test.errors" 
-                   failureproperty="test.failures" 
-                   showoutput="on" 
-                   dir="${work.dir}/@{module}" 
-                   tempdir="${junit.tempdir}"
-                   jvm="${test.jre.home}/bin/java">
-
-                <jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
-                <jvmarg line="-Duser.home=${junit.user.home}" />
-
-                <classpath>
-                    <fileset dir="${target.dir}">
-                        <include name="*.jar" />
-                    </fileset>
-                    <pathelement path="${test.resources.dir}/" />
-                    <pathelement path="${test.module.dir}/" />
-                    <pathelement location="${test.module.dir}/@{jar}" />
-                </classpath>
-
-                <junit-elements />
-
-                <batchtest todir="${tests.output}" haltonfailure="no">
-                    <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
-                        <exclude name="Test.class" />
-                        <exclude name="**/*$*" />
-
-                        <!-- if ${test.case}     -->
-                        <include name="${converted.tc.class}" if="test.case" />
-                        <!-- unless ${test.case} -->
-                        <include name="**/*Test.class" unless="test.case" />
-                        <excludesfile name="${test.exclude.file}" unless="test.case"/>
-                        <excludeorinclude/>
-                    </zipfileset>
-                </batchtest>
-
-                <assertions enableSystemAssertions="true">
-                    <enable />
-                </assertions>
-
-                <jvmarg line="${hy.test.vmargs}" />
-                <!-- Used by Support_Exec.execJava() -->
-                <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
-
-                <formatter type="xml" />
-            </junit>
-
-            <delete dir="${module.temp.dir}"
-                    includeemptydirs="true" failonerror="false" />
-
-            <antcall target="touch-failures-file">
-                <param name="module" value="@{module}" />
-            </antcall>
-            <antcall target="touch-errors-file">
-                <param name="module" value="@{module}" />
-            </antcall>
-
-        </sequential>
-    </macrodef>
-
-    <!-- TOFIX: Can't seem to override the line:
-             <include name="**/*Test.class" unless="test.case" />
-         so this is just run-hdk-tests without that line -->
-    <macrodef name="run-selected-hdk-tests">
-        <attribute name="module" />
-        <attribute name="jar" />
-        <element name="junit-elements" optional="true"/>
-        <element name="excludeorinclude" optional="true"/>
-        <sequential>
-            <echo message="Running @{module} Unit Test from @{jar}" />
-            <echo message="Tested jre: ${test.jre.home}/bin/java" />
-            <property name="test.module.dir" value="${target.dir}/@{module}" />
-            <property name="test.excludes.dir" value="${test.module.dir}/excludes" />
-            <property name="test.resources.dir" value="${test.module.dir}/resources" />
-            <property name="module.work.dir" location="${work.dir}/@{module}" />
-            <property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
-
-            <property name="module.temp.dir"
-                      location="${work.dir}/@{module}/temp" />
-            <property name="junit.tempdir"
-                      location="${module.temp.dir}/ant" />
-            <property name="junit.java.io.tmpdir"
-                      location="${module.temp.dir}/tmpdir" />
-            <property name="junit.user.home"
-                      location="${module.temp.dir}/user" />
-            
-            <mkdir dir="${tests.output}" /> 
-            <mkdir dir="${junit.tempdir}" />
-            <mkdir dir="${junit.java.io.tmpdir}" />
-            <mkdir dir="${junit.user.home}" />
-
-            <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
-            <junit fork="yes" 
-                   forkmode="${hy.test.forkmode}" 
-                   timeout="${hy.test.timeout}" 
-                   printsummary="withOutAndErr" 
-                   errorproperty="test.errors" 
-                   failureproperty="test.failures" 
-                   showoutput="on" 
-                   dir="${work.dir}/@{module}" 
-                   tempdir="${junit.tempdir}"
-                   jvm="${test.jre.home}/bin/java">
-
-                <jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
-                <jvmarg line="-Duser.home=${junit.user.home}" />
-
-                <classpath>
-                    <fileset dir="${target.dir}">
-                        <include name="*.jar" />
-                    </fileset>
-                    <pathelement path="${test.resources.dir}/" />
-                    <pathelement path="${test.module.dir}/" />
-                    <pathelement location="${test.module.dir}/@{jar}" />
-                </classpath>
-
-                <junit-elements />
-
-                <batchtest todir="${tests.output}" haltonfailure="no">
-                    <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
-                        <exclude name="Test.class" />
-                        <exclude name="**/*$*" />
-
-                        <!-- if ${test.case}     -->
-                        <include name="${converted.tc.class}" if="test.case" />
-                        <!-- unless ${test.case} -->
-                        <excludesfile name="${test.exclude.file}" unless="test.case"/>
-                        <excludeorinclude/>
-                    </zipfileset>
-                </batchtest>
-
-                <assertions enableSystemAssertions="true">
-                    <enable />
-                </assertions>
-
-                <jvmarg line="${hy.test.vmargs}" />
-                <!-- Used by Support_Exec.execJava() -->
-                <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
-
-                <formatter type="xml" />
-            </junit>
-
-            <delete dir="${module.temp.dir}"
-                    includeemptydirs="true" failonerror="false" />
-
-            <antcall target="touch-failures-file">
-                <param name="module" value="@{module}" />
-            </antcall>
-            <antcall target="touch-errors-file">
-                <param name="module" value="@{module}" />
-            </antcall>
-
-        </sequential>
-    </macrodef>
-
-    <target name="touch-failures-file" if="test.failures">
-        <echo file="${tests.output}/test.failures"
-            append="true">${module}${line.separator}</echo>
-    </target>
-
-    <target name="touch-errors-file" if="test.errors">
-        <echo file="${tests.output}/test.errors"
-            append="true">${module}${line.separator}</echo>
-    </target>
-
-    <!-- To use with -Dtest.case=... option                   -->
-    <!-- if ${test.case} is provided in package+class form    -->
-    <!-- it is converted to dir+filename form                 -->
-    <macrodef name="convert-test-as-class">
-        <attribute name="from" />
-        <attribute name="to" />
-        <sequential>
-            <pathconvert property="@{to}" setonempty="no">
-                <path path="${@{from}}" />
-                <chainedmapper>
-                    <filtermapper>
-                        <replaceregex pattern="\.java$$" />
-                    </filtermapper>
-                    <unpackagemapper from="${basedir}${file.separator}*" to="*.class" />
-                </chainedmapper>
-            </pathconvert>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="make-patternset">
-        <attribute name="source" default="src/main" />
-        <attribute name="module" />
-        <attribute name="file"
-                   default="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
-        <sequential>
-            <dirname file="@{file}" property="@{file}.dir" />
-            <mkdir dir="${@{file}.dir}" />
-            <property name="@{source}.loc" location="@{source}"/>
-
-            <pathconvert targetos="unix" property="@{file}.content"
-                         pathsep="${line.separator}">
-                <fileset dir="${@{source}.loc}" includes="java*/**/*.java" />
-                <map from="${@{source}.loc}/java/unix/" to="" />
-                <map from="${@{source}.loc}/java/windows/" to="" />
-                <map from="${@{source}.loc}/java/common/" to="" />
-                <map from="${@{source}.loc}/java5/" to="" />
-                <map from="${@{source}.loc}/java/" to="" />
-                <compositemapper>
-                    <mapper type="regexp" from="^(.*)\.java$$" to="\1.*"/>
-                    <mapper type="regexp" from="^(.*)\.java$$" to="\1$*.*"/>
-                </compositemapper>
-            </pathconvert>
-            <echo message="${@{file}.content}${line.separator}"
-                  file="@{file}" />
-        </sequential>
-    </macrodef>
-
-    <macrodef name="delete-patternset">
-        <attribute name="module" />
-        <sequential>
-            <delete file="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
-        </sequential>
-    </macrodef>
-
-    <macrodef name="run-findBugs">
-       <attribute name="outputFile"/>
-       <attribute name="excludeFilter"/>
-       <attribute name="jarFile"/>
-       <sequential>
-           <!-- Find and define findbugs task -->
-           <property name="findbugs.home" location="${basedir}/../../depends/oss/findbugs-1.3.9"/>
-           <available
-               classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
-               classpath="${findbugs.home}/lib/findbugs-ant.jar"
-               property="findbugs.available"/>
-           <taskdef
-               name="findbugs"
-               classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
-               classpath="${findbugs.home}/lib/findbugs-ant.jar"
-               onerror="ignore"/>
-          <fail message="FindBugs is unavailable" unless="findbugs.available"/>
-
-          <!-- Run findbugs using the attributes given -->
-          <dirname file="@{outputFile}" property="@{outputFile}.dir" />
-          <mkdir dir="${@{outputFile}.dir}" />
-          <findbugs home="${findbugs.home}"
-            output="xml"
-            outputFile="@{outputFile}"
-            excludeFilter="@{excludeFilter}"
-            jvmargs="-Xmx512M"
-            workhard="true">
-            <auxClasspath>
-                <fileset dir="${hy.jdk}/jre/lib/boot">
-                    <include name="**/*.jar" />
-                </fileset>
-            </auxClasspath>
-            <sourcePath path="src/main/java" />
-            <sourcePath path="src/main/java5" />
-            <sourcePath path="src/main/java/common" />
-            <sourcePath path="src/main/java/${hy.os.family}" />
-            <class location="@{jarFile}" />
-        </findbugs>
-       </sequential>
-    </macrodef>
-
-</project>
diff --git a/classlib/make/run-test.xml b/classlib/make/run-test.xml
index 91aca25..325ed1a 100644
--- a/classlib/make/run-test.xml
+++ b/classlib/make/run-test.xml
@@ -23,11 +23,13 @@
     <property file="test.properties" />
 
     <!-- These two parameters could be assigned by user -->
-    <property name="target.dir" value="." />
-    <property name="work.dir" value="${target.dir}" />
+    <property name="hy.target" value="." />
+    <property name="hy.component" value="test" />
+    <property name="hy.module" value="toplevel" />
+    <property name="work.dir" value="${hy.target}" />
     <property name="tests.output" value="${work.dir}/report" />
     <property name="report.dir" value="${tests.output}/html" />
-    <property name="junit.jar" value="${target.dir}/junit.jar" />
+    <property name="junit.jar" value="${hy.target}/junit.jar" />
 
     <property name="gen.report" value="true" />
     <condition property="do.full.report" value="true">
@@ -54,7 +56,7 @@
 
     <target name="-test">
         <echo message="Test Work Dir: ${work.dir}" />
-        <echo message="Test Target Dir: ${target.dir}" />
+        <echo message="Test Target Dir: ${hy.target}" />
         <mkdir dir="${work.dir}" /> 
         <delete dir="${tests.output}" quiet="true"/>
         <poll-modules dir="." target="test-module" />
diff --git a/classlib/modules/accessibility/build.xml b/classlib/modules/accessibility/build.xml
index 264a04e..03d10bb 100644
--- a/classlib/modules/accessibility/build.xml
+++ b/classlib/modules/accessibility/build.xml
@@ -19,10 +19,10 @@
 <project name="ACCESSIBILITY Build" default="build" basedir=".">
     <description>Build for ACCESSIBILITY component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="accessibility" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -97,7 +97,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/accessibility/make/run-test.xml b/classlib/modules/accessibility/make/run-test.xml
index 45715dc..f38c795 100644
--- a/classlib/modules/accessibility/make/run-test.xml
+++ b/classlib/modules/accessibility/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="accessibility" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/annotation/build.xml b/classlib/modules/annotation/build.xml
index 8e360e9..4461f06 100644
--- a/classlib/modules/annotation/build.xml
+++ b/classlib/modules/annotation/build.xml
@@ -19,10 +19,10 @@
 <project name="ANNOTATION Build" default="build" basedir=".">
     <description>Build for ANNOTATION component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="annotation" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/annotation/make/run-test.xml b/classlib/modules/annotation/make/run-test.xml
index ee5bdb5..96b6656 100644
--- a/classlib/modules/annotation/make/run-test.xml
+++ b/classlib/modules/annotation/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="annotation" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/applet/build.xml b/classlib/modules/applet/build.xml
index 6a080ab..da16cda 100644
--- a/classlib/modules/applet/build.xml
+++ b/classlib/modules/applet/build.xml
@@ -19,10 +19,10 @@
 <project name="APPLET Build" default="build" basedir=".">
     <description>Build for APPLET component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="applet" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -96,7 +96,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/applet/make/run-test.xml b/classlib/modules/applet/make/run-test.xml
index e1c955a..6425943 100644
--- a/classlib/modules/applet/make/run-test.xml
+++ b/classlib/modules/applet/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="applet" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/archive/build.xml b/classlib/modules/archive/build.xml
index ed89f63..99375ff 100644
--- a/classlib/modules/archive/build.xml
+++ b/classlib/modules/archive/build.xml
@@ -19,15 +19,18 @@
 <project name="ARCHIVE Build" default="build" basedir=".">
     <description>Build for ARCHIVE component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="archive" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
     <property file="make/depends.properties" />
 
+    <property name="zlib.dist"
+              location="${hy.target}/depends/native/zlib_dist"/>
+
     <target name="build" depends="check-depends,-build-no-check"/>
     <target name="-build-no-check" depends="-build-jar,-test-jar" />
     
@@ -50,7 +53,7 @@
     <target name="-copy-zlib-include" unless="hy.skip.zlib">
         <!-- TOFIX: should add property for: unless="skip.native.build" -->
         <copy todir="${hy.hdk}/include" preservelastmodified="true">
-            <fileset dir="src/main/native/zlib_dist">
+            <fileset dir="${zlib.dist}">
                 <include name="zlib.h" />
                 <include name="zconf.h" />
             </fileset>
@@ -73,7 +76,7 @@
     <target name="-extract-props" unless="hy.skip.zlib">
         <uptodate property="zlib.extracted"
                   srcfile="${zlib.tar}"
-                  targetfile="src/main/native/zlib_dist/README" />
+                  targetfile="${zlib.dist}/README" />
         <condition property="zlib.uptodate" value="true">
             <or>
                 <isset property="hy.skip.zlib" />
@@ -83,31 +86,31 @@
     </target>
 
     <target name="-unzip-oss" unless="zlib.uptodate">
-        <mkdir dir="src/main/native/zlib_dist" />
-        <untar src="${zlib.tar}" dest="src/main/native/zlib_dist"
+        <mkdir dir="${zlib.dist}" />
+        <untar src="${zlib.tar}" dest="${zlib.dist}"
                compression="gzip">
             <mapper type="flatten"/>
         </untar>
-        <chmod dir="src/main/native/zlib_dist" perm="ugo+r" />
-        <touch file="src/main/native/zlib_dist/README" />
+        <chmod dir="${zlib.dist}" perm="ugo+r" />
+        <touch file="${zlib.dist}/README" />
     </target>
 
     <target name="-ascii2ebcdic-conversion" if="is.zos" unless="zlib.uptodate">
-        <move todir="src/main/native/zlib_dist_ascii">
-            <fileset dir="src/main/native/zlib_dist">
+        <move todir="${zlib.dist}_ascii">
+            <fileset dir="${zlib.dist}">
                 <include name="**/*" />
                 <exclude name="**/*.o" />
             </fileset>
         </move>
-        <copy todir="src/main/native/zlib_dist" outputencoding="IBM-1047" >
-            <fileset dir="src/main/native/zlib_dist_ascii">
+        <copy todir="${zlib.dist}" outputencoding="IBM-1047" >
+            <fileset dir="${zlib.dist}_ascii">
                 <include name="**/*" />
                 <exclude name="**/*.o" />
             </fileset>               
         </copy>
-        <fixcrlf srcdir="src/main/native/zlib_dist"
+        <fixcrlf srcdir="${zlib.dist}"
                  includes="**/*" excludes="**/*.o" eol="unix" />
-        <delete dir="src/main/native/zlib_dist_ascii" />
+        <delete dir="${zlib.dist}_ascii" />
     </target>
     
     <!-- Build native code -->
@@ -152,7 +155,7 @@
     </target>
 
     <target name="-clean-overlay-oss" unless="hy.skip.zlib" >
-        <delete dir="src/main/native/zlib_dist" quiet="true" />
+        <delete dir="${zlib.dist}" quiet="true" />
     </target>
     
     <target name="test" depends="-test-module">
@@ -181,7 +184,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -219,11 +222,11 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_internal_tests.jar">
-            <fileset dir="bin/test-internal" />
+            <fileset dir="${hy.build.mod}/test/internal" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -239,7 +242,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} internal tests"
-                       destdir="bin/test-internal">
+                       destdir="${hy.build.mod}/test/internal">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/java-internal" />
diff --git a/classlib/modules/archive/make/run-test.xml b/classlib/modules/archive/make/run-test.xml
index 8d0882a..7606e61 100644
--- a/classlib/modules/archive/make/run-test.xml
+++ b/classlib/modules/archive/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="archive" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/archive/src/main/native/archive/unix/makefile b/classlib/modules/archive/src/main/native/archive/unix/makefile
index 215085a..dbaad0b 100644
--- a/classlib/modules/archive/src/main/native/archive/unix/makefile
+++ b/classlib/modules/archive/src/main/native/archive/unix/makefile
@@ -17,13 +17,13 @@
 # Makefile for module 'archive'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/archive/native/archive/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+ZLIB_DIST = $(HY_TARGET)/depends/native/zlib_dist/
+INCLUDES += -I$(SHARED)common -I$(ZLIB_DIST) -I../../include/shared
 
-INCLUDES += -I$(SHARED)common -I../../zlib_dist -I../../include/shared
-
-BUILDFILES = $(SHAREDSUB)archive_copyright.o $(SHAREDSUB)jclcrc32.o \
-	$(SHAREDSUB)zip.o $(SHAREDSUB)adler32.o $(SHAREDSUB)inflater.o \
-	$(SHAREDSUB)jarfile.o $(SHAREDSUB)deflater.o $(SHAREDSUB)archiveglob.o
+BUILDFILES = archive_copyright.o jclcrc32.o zip.o adler32.o inflater.o \
+  jarfile.o deflater.o archiveglob.o
 
 ifneq ($(HY_ZIP_API),true)
 MDLLIBFILES +=	$(LIBPATH)libhyzip.a
@@ -48,4 +48,4 @@
 DLLNAME=$(DLLPATH)libhyarchive$(HY_SHLIB_SUFFIX)
 EXPNAME=HYARCHIVE_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/archive/src/main/native/archive/windows/makefile b/classlib/modules/archive/src/main/native/archive/windows/makefile
index 820f0f4..78285fd 100644
--- a/classlib/modules/archive/src/main/native/archive/windows/makefile
+++ b/classlib/modules/archive/src/main/native/archive/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'archive'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\archive\native\archive\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyarchive
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -27,10 +28,9 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-	$(SHAREDSUB)archive_copyright.obj $(SHAREDSUB)jclcrc32.obj \
-	$(SHAREDSUB)zip.obj $(SHAREDSUB)adler32.obj $(SHAREDSUB)inflater.obj \
-	$(SHAREDSUB)jarfile.obj $(SHAREDSUB)deflater.obj \
-	$(SHAREDSUB)archiveglob.obj
+	$(HY_BIN)archive_copyright.obj $(HY_BIN)jclcrc32.obj \
+	$(HY_BIN)zip.obj $(HY_BIN)adler32.obj $(HY_BIN)inflater.obj \
+	$(HY_BIN)jarfile.obj $(HY_BIN)deflater.obj $(HY_BIN)archiveglob.obj
 
 VIRTFILES = $(LIBBASE).res
 
diff --git a/classlib/modules/archive/src/main/native/zip/unix/makefile b/classlib/modules/archive/src/main/native/zip/unix/makefile
index 1f86f11..6d04698 100644
--- a/classlib/modules/archive/src/main/native/zip/unix/makefile
+++ b/classlib/modules/archive/src/main/native/zip/unix/makefile
@@ -17,12 +17,12 @@
 # Makefile for module 'zip'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/archive/native/zip/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+ZLIB_DIST = $(HY_TARGET)/depends/native/zlib_dist/
+INCLUDES += -I$(ZLIB_DIST)
 
-INCLUDES += -I../../zlib_dist
-
-BUILDFILES = $(SHAREDSUB)zcpool.o $(SHAREDSUB)zipalloc.o \
-	$(SHAREDSUB)zipcache.o $(SHAREDSUB)zipsup.o pool.o pool_cap.o
+BUILDFILES = zcpool.o zipalloc.o zipcache.o zipsup.o pool.o pool_cap.o
 
 ifeq ($(HY_LOCAL_ZLIB),true)
 DEFINES += -DHY_LOCAL_ZLIB
@@ -38,7 +38,7 @@
 
 LIBNAME = $(LIBPATH)libhyzip.a
 
-%.o: $(LIBPATH)libhypool.a(%.o)
-	ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@
+$(HY_BIN)%.o: $(LIBPATH)libhypool.a(%.o)
+	( cd $(HY_BIN) && ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@ )
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/archive/src/main/native/zip/windows/makefile b/classlib/modules/archive/src/main/native/zip/windows/makefile
index 69dbbef..5acc005 100644
--- a/classlib/modules/archive/src/main/native/zip/windows/makefile
+++ b/classlib/modules/archive/src/main/native/zip/windows/makefile
@@ -17,13 +17,15 @@
 # Makefile for module 'zip'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\archive\native\zip\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyzip
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
-BUILDFILES = $(SHAREDSUB)zcpool.obj $(SHAREDSUB)zipalloc.obj \
-	$(SHAREDSUB)zipcache.obj $(SHAREDSUB)zipsup.obj \
+BUILDFILES = $(HY_BIN)zcpool.obj $(HY_BIN)zipalloc.obj \
+	$(HY_BIN)zipcache.obj $(HY_BIN)zipsup.obj \
         $(LIBPATH)hypool$(HY_LINKLIB_SUFFIX)
-HYCFLAGS = $(HYCFLAGS) /I..\..\zlib_dist
+ZLIB_DIST = $(HY_TARGET)\depends\native\zlib_dist\# trailing slash
+HYCFLAGS = $(HYCFLAGS) /I$(ZLIB_DIST)
 
 !include <$(HY_HDK)\build\make\rules.mak>
diff --git a/classlib/modules/archive/src/main/native/zlib/unix/makefile b/classlib/modules/archive/src/main/native/zlib/unix/makefile
index df4ba85..05b1d8b 100644
--- a/classlib/modules/archive/src/main/native/zlib/unix/makefile
+++ b/classlib/modules/archive/src/main/native/zlib/unix/makefile
@@ -20,7 +20,8 @@
 # We don't need to debug into zlib
 HY_CFG=release
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/archive/native/zlib/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 HYRELEASECFLAGS = -O2
 
@@ -29,12 +30,11 @@
 HYRELEASECFLAGS += -DUNALIGNED_OK
 endif
 
-ZLIB_DIST=../../zlib_dist/# Path to zlib
+OSS_DIST=$(HY_TARGET)/depends/native/zlib_dist/# Path to zlib
 
 BUILDFILES = \
-	$(SHAREDSUB)zlib_copyright.o $(ZLIB_DIST)adler32.o $(ZLIB_DIST)compress.o \
-	$(ZLIB_DIST)crc32.o $(ZLIB_DIST)deflate.o $(ZLIB_DIST)infback.o $(ZLIB_DIST)inffast.o \
-	$(ZLIB_DIST)inflate.o $(ZLIB_DIST)inftrees.o $(ZLIB_DIST)trees.o $(ZLIB_DIST)uncompr.o $(ZLIB_DIST)zutil.o
+  zlib_copyright.o adler32.o compress.o crc32.o deflate.o infback.o \
+  inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
 
 DLLNAME = $(DLLPATH)libhyzlib$(HY_SHLIB_SUFFIX)
 EXPNAME = HYZLIB_0.1
@@ -51,4 +51,4 @@
 OPT += -DSTDC
 endif
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/archive/src/main/native/zlib/windows/makefile b/classlib/modules/archive/src/main/native/zlib/windows/makefile
index 788eb71..62b4a43 100644
--- a/classlib/modules/archive/src/main/native/zlib/windows/makefile
+++ b/classlib/modules/archive/src/main/native/zlib/windows/makefile
@@ -17,21 +17,22 @@
 # Makefile for module 'zlib'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\archive\native\zlib\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyzlib
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 
-ZLIB_DIST=..\..\zlib_dist\# Path to zlib
+OSS_DIST = $(HY_TARGET)\depends\native\zlib_dist\# trailing slash
 
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  $(SHAREDSUB)zlib_copyright.obj $(ZLIB_DIST)adler32.obj $(ZLIB_DIST)compress.obj \
-  $(ZLIB_DIST)crc32.obj $(ZLIB_DIST)deflate.obj $(ZLIB_DIST)infback.obj \
-  $(ZLIB_DIST)inffast.obj $(ZLIB_DIST)inflate.obj $(ZLIB_DIST)inftrees.obj $(ZLIB_DIST)trees.obj \
-  $(ZLIB_DIST)uncompr.obj $(ZLIB_DIST)zutil.obj
+  $(HY_BIN)zlib_copyright.obj $(HY_BIN)adler32.obj $(HY_BIN)compress.obj \
+  $(HY_BIN)crc32.obj $(HY_BIN)deflate.obj $(HY_BIN)infback.obj \
+  $(HY_BIN)inffast.obj $(HY_BIN)inflate.obj $(HY_BIN)inftrees.obj \
+  $(HY_BIN)trees.obj $(HY_BIN)uncompr.obj $(HY_BIN)zutil.obj
 
 VIRTFILES = $(LIBBASE).res
 DLLBASE=0x11700000
diff --git a/classlib/modules/auth/build.xml b/classlib/modules/auth/build.xml
index c1b05c7..1ded722 100644
--- a/classlib/modules/auth/build.xml
+++ b/classlib/modules/auth/build.xml
@@ -20,10 +20,10 @@
 <project name="AUTH Build" default="build" basedir=".">
     <description>Build for AUTH component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="auth" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -68,7 +68,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -110,7 +110,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <copy todir="${tests.resources.hdk.dir}">
diff --git a/classlib/modules/auth/make/run-test.xml b/classlib/modules/auth/make/run-test.xml
index 9922de5..4f22765 100644
--- a/classlib/modules/auth/make/run-test.xml
+++ b/classlib/modules/auth/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="auth" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/auth/src/main/native/auth/unix/makefile b/classlib/modules/auth/src/main/native/auth/unix/makefile
index 7d99af0..aaceb54 100644
--- a/classlib/modules/auth/src/main/native/auth/unix/makefile
+++ b/classlib/modules/auth/src/main/native/auth/unix/makefile
@@ -17,13 +17,14 @@
 # Makefile for module 'auth'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/auth/native/auth/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)auth_copyright.o authnix.o
+BUILDFILES = auth_copyright.o authnix.o
 
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
 DLLNAME = $(DLLPATH)libhyauth$(HY_SHLIB_SUFFIX)
 EXPNAME = HYAUTH_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/auth/src/main/native/auth/windows/makefile b/classlib/modules/auth/src/main/native/auth/windows/makefile
index c06664e..f981b02 100644
--- a/classlib/modules/auth/src/main/native/auth/windows/makefile
+++ b/classlib/modules/auth/src/main/native/auth/windows/makefile
@@ -17,12 +17,13 @@
 # Makefile for module 'auth'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\auth\native\auth\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyauth
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
-BUILDFILES = $(SHAREDSUB)auth_copyright.obj authwin32.obj
+BUILDFILES = $(HY_BIN)auth_copyright.obj $(HY_BIN)authwin32.obj
 VIRTFILES = $(LIBBASE).res
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
diff --git a/classlib/modules/awt/build.xml b/classlib/modules/awt/build.xml
index f600f1f..4ca034f 100644
--- a/classlib/modules/awt/build.xml
+++ b/classlib/modules/awt/build.xml
@@ -19,10 +19,10 @@
 <project name="AWT Build" default="build" basedir=".">
     <description>Build for AWT component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="awt" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
@@ -163,7 +163,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -298,15 +298,15 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_boot_tests.jar">
-            <fileset dir="bin/test/boot">
+            <fileset dir="${hy.build.mod}/test/boot">
                 <exclude name="**/*Headless*Test.class" />
             </fileset>
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test/classes" />
+            <fileset dir="${hy.build.mod}/test/classes" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_headless_tests.jar">
-            <fileset dir="bin/test/boot">
+            <fileset dir="${hy.build.mod}/test/boot">
                 <include name="**/*Headless*Test.class" />
             </fileset>
         </hy.jar.bin>
@@ -329,7 +329,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} boot tests"
-                       destdir="bin/test/boot">
+                       destdir="${hy.build.mod}/test/boot">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/impl/boot" />
@@ -337,7 +337,7 @@
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} tests"
-                       destdir="bin/test/classes">
+                       destdir="${hy.build.mod}/test/classes">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/java" />
diff --git a/classlib/modules/awt/make/run-test.xml b/classlib/modules/awt/make/run-test.xml
index f797bfe..550bab8 100644
--- a/classlib/modules/awt/make/run-test.xml
+++ b/classlib/modules/awt/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="awt" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/awt/src/main/native/fontlib/unix/makefile b/classlib/modules/awt/src/main/native/fontlib/unix/makefile
index e5defe0..9764b04 100644
--- a/classlib/modules/awt/src/main/native/fontlib/unix/makefile
+++ b/classlib/modules/awt/src/main/native/fontlib/unix/makefile
@@ -13,28 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/fontlib/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
 
-BUILDFILES = \
-  $(SHAREDSUB)fljni.o \
-  $(SHAREDSUB)EncodedValue.o \
-  $(SHAREDSUB)Environment.o \
-  $(SHAREDSUB)Font.o \
-  $(SHAREDSUB)Glyph.o \
-  $(SHAREDSUB)Outline.o \
-  $(SHAREDSUB)ParsingTables.o \
-  $(SHAREDSUB)T1Font.o \
-  $(SHAREDSUB)T1Glyph.o \
-  $(SHAREDSUB)TTCurve.o \
-  $(SHAREDSUB)TTFont.o \
-  FontLibExports.o \
-  $(SHAREDSUB)TypeDefinition.o
+BUILDFILES = fljni.o EncodedValue.o Environment.o Font.o Glyph.o Outline.o \
+  ParsingTables.o T1Font.o T1Glyph.o TTCurve.o TTFont.o FontLibExports.o \
+  TypeDefinition.o
 
 OSLIBS += $(STDCLIBS)
 
 DLLNAME=$(DLLPATH)libFL$(HY_LINKLIB_SUFFIX)
 EXPNAME=HYFONTLIB_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/fontlib/windows/makefile b/classlib/modules/awt/src/main/native/fontlib/windows/makefile
index 8595d66..c2fc09b 100644
--- a/classlib/modules/awt/src/main/native/fontlib/windows/makefile
+++ b/classlib/modules/awt/src/main/native/fontlib/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\fontlib\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=FL
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -24,19 +25,19 @@
 	/EHsc
 
 BUILDFILES = \
-  $(SHAREDSUB)fljni.obj \
-  $(SHAREDSUB)EncodedValue.obj \
-  $(SHAREDSUB)Environment.obj \
-  $(SHAREDSUB)Font.obj \
-  $(SHAREDSUB)Glyph.obj \
-  $(SHAREDSUB)Outline.obj \
-  $(SHAREDSUB)ParsingTables.obj \
-  $(SHAREDSUB)T1Font.obj \
-  $(SHAREDSUB)T1Glyph.obj \
-  $(SHAREDSUB)TTCurve.obj \
-  $(SHAREDSUB)TTFont.obj \
-  $(SHAREDSUB)TypeDefinition.obj \
-  FontLibExports.obj
+  $(HY_BIN)fljni.obj \
+  $(HY_BIN)EncodedValue.obj \
+  $(HY_BIN)Environment.obj \
+  $(HY_BIN)Font.obj \
+  $(HY_BIN)Glyph.obj \
+  $(HY_BIN)Outline.obj \
+  $(HY_BIN)ParsingTables.obj \
+  $(HY_BIN)T1Font.obj \
+  $(HY_BIN)T1Glyph.obj \
+  $(HY_BIN)TTCurve.obj \
+  $(HY_BIN)TTFont.obj \
+  $(HY_BIN)TypeDefinition.obj \
+  $(HY_BIN)FontLibExports.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/awt/src/main/native/gl/unix/makefile b/classlib/modules/awt/src/main/native/gl/unix/makefile
index 2d94bd1..97c8068 100644
--- a/classlib/modules/awt/src/main/native/gl/unix/makefile
+++ b/classlib/modules/awt/src/main/native/gl/unix/makefile
@@ -13,24 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/gl/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 # TODO: Fix the warnings see HARMONY-5885
 WARNFLAGS :=
 
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include \
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include \
             -I/usr/X11R6/include -I/usr/include -Iinclude
 
-BUILDFILES = \
-  $(SHAREDSUB)/blitter.o \
-  $(SHAREDSUB)/gifdecoder.o \
-  $(SHAREDSUB)/LUTTables.o \
-  $(SHAREDSUB)/pngdecoder.o \
-  $(SHAREDSUB)/SurfaceDataStructure.o \
-  gl.o \
-  XBlitter.o \
-  XGraphics2D.o \
-  LockingKeys.o
+BUILDFILES = blitter.o gifdecoder.o LUTTables.o pngdecoder.o \
+  SurfaceDataStructure.o gl.o XBlitter.o XGraphics2D.o LockingKeys.o
 
 OSLIBS += -lpng
 
@@ -39,4 +32,4 @@
 DLLNAME=$(DLLPATH)libgl$(HY_SHLIB_SUFFIX)
 EXPNAME=HYGL_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/gl/windows/makefile b/classlib/modules/awt/src/main/native/gl/windows/makefile
index 083aae1..9c668f2 100644
--- a/classlib/modules/awt/src/main/native/gl/windows/makefile
+++ b/classlib/modules/awt/src/main/native/gl/windows/makefile
@@ -14,7 +14,8 @@
 # limitations under the License.
 
 APPVER = 5.0 # Need WINVER=0x0500 to get HMONITOR defined.
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\gl\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 PNG_DIR=$(HY_PNG_DIR)\# avoid continuation
 
@@ -27,18 +28,18 @@
            /I$(PNG_DIR) /Iinclude
 
 BUILDFILES = \
-  BitmapSurface.obj \
-  GDIBlitter.obj \
-  WinGDIGraphics2D.obj \
-  WinGDIPGraphics2D.obj \
-  WinGraphicsEnvironment.obj \
-  WinThemeGraphics.obj \
-  LockingKeys.obj \
-  $(SHAREDSUB)blitter.obj \
-  $(SHAREDSUB)gifdecoder.obj \
-  $(SHAREDSUB)LUTTables.obj \
-  $(SHAREDSUB)pngdecoder.obj \
-  $(SHAREDSUB)SurfaceDataStructure.obj \
+  $(HY_BIN)BitmapSurface.obj \
+  $(HY_BIN)GDIBlitter.obj \
+  $(HY_BIN)WinGDIGraphics2D.obj \
+  $(HY_BIN)WinGDIPGraphics2D.obj \
+  $(HY_BIN)WinGraphicsEnvironment.obj \
+  $(HY_BIN)WinThemeGraphics.obj \
+  $(HY_BIN)LockingKeys.obj \
+  $(HY_BIN)blitter.obj \
+  $(HY_BIN)gifdecoder.obj \
+  $(HY_BIN)LUTTables.obj \
+  $(HY_BIN)pngdecoder.obj \
+  $(HY_BIN)SurfaceDataStructure.obj \
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib \
diff --git a/classlib/modules/awt/src/main/native/jpegdecoder/unix/makefile b/classlib/modules/awt/src/main/native/jpegdecoder/unix/makefile
index e33f5a3..8f87d50 100644
--- a/classlib/modules/awt/src/main/native/jpegdecoder/unix/makefile
+++ b/classlib/modules/awt/src/main/native/jpegdecoder/unix/makefile
@@ -13,15 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/jpegdecoder/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
 
-BUILDFILES = $(SHAREDSUB)JpegDecoder.o
+BUILDFILES = JpegDecoder.o
 
 OSLIBS += -ljpeg
 
 DLLNAME=$(DLLPATH)libjpegdecoder$(HY_SHLIB_SUFFIX)
 EXPNAME=HYJPEGDECODER_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile b/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile
index db29820..dec2865 100644
--- a/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile
+++ b/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\jpegdecoder\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 JPEG_DIR=$(HY_JPEG_DIR)\# avoid continuation
 
@@ -24,7 +25,7 @@
 
 HYCFLAGS = $(HYCFLAGS) -I$(SHAREDSUB)\include -I$(JPEG_DIR)
 
-BUILDFILES = $(SHAREDSUB)JpegDecoder.obj
+BUILDFILES = $(HY_BIN)JpegDecoder.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
@@ -37,7 +38,7 @@
 
 !include <$(HY_HDK)\build\make\rules.mak>
 
-$(SHAREDSUB)JpegDecoder.obj: jconfig.h
+$(HY_BIN)JpegDecoder.obj: jconfig.h
 
 jconfig.h: $(JPEG_DIR)jconfig.vc
 	copy $(JPEG_DIR)jconfig.vc $@
diff --git a/classlib/modules/awt/src/main/native/lcmm/unix/makefile b/classlib/modules/awt/src/main/native/lcmm/unix/makefile
index 18eedb3..0c54484 100644
--- a/classlib/modules/awt/src/main/native/lcmm/unix/makefile
+++ b/classlib/modules/awt/src/main/native/lcmm/unix/makefile
@@ -13,20 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/lcmm/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include $(LCMS_INCLUDES)
 
-BUILDFILES = \
-  $(SHAREDSUB)cmmerror.o \
-  $(SHAREDSUB)cmmio.o \
-  $(SHAREDSUB)cmmxforms.o \
-  $(SHAREDSUB)NativeCMM.o \
-  $(SHAREDSUB)NativeImageFormat.o
+BUILDFILES = cmmerror.o cmmio.o cmmxforms.o NativeCMM.o NativeImageFormat.o
 
 OSLIBS += -llcms
 
 DLLNAME=$(DLLPATH)liblcmm$(HY_SHLIB_SUFFIX)
 EXPNAME=HYLCMM_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/lcmm/windows/makefile b/classlib/modules/awt/src/main/native/lcmm/windows/makefile
index fdb6a8b..76e6238 100644
--- a/classlib/modules/awt/src/main/native/lcmm/windows/makefile
+++ b/classlib/modules/awt/src/main/native/lcmm/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\lcmm\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LCMS_DIR=$(HY_LCMS_DIR)\# avoid continuation
 
@@ -25,11 +26,11 @@
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(LCMS_DIR)include /I$(SHAREDSUB)include
 
 BUILDFILES = \
-  $(SHAREDSUB)cmmerror.obj \
-  $(SHAREDSUB)cmmio.obj \
-  $(SHAREDSUB)cmmxforms.obj \
-  $(SHAREDSUB)NativeCMM.obj \
-  $(SHAREDSUB)NativeImageFormat.obj
+  $(HY_BIN)cmmerror.obj \
+  $(HY_BIN)cmmio.obj \
+  $(HY_BIN)cmmxforms.obj \
+  $(HY_BIN)NativeCMM.obj \
+  $(HY_BIN)NativeImageFormat.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/awt/src/main/native/linuxfont/unix/makefile b/classlib/modules/awt/src/main/native/linuxfont/unix/makefile
index d7645e0..dbd7503 100644
--- a/classlib/modules/awt/src/main/native/linuxfont/unix/makefile
+++ b/classlib/modules/awt/src/main/native/linuxfont/unix/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/linuxfont/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I/usr/X11R6/include -I/usr/include/freetype2 \
             -Iinclude -I../../fontlib/unix -I../../fontlib/shared # TOFIX move includes
@@ -33,4 +34,4 @@
 DLLNAME=$(DLLPATH)liblinuxfont$(HY_SHLIB_SUFFIX)
 EXPNAME=HYLINUXFONT_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/oglwrapper/unix/makefile b/classlib/modules/awt/src/main/native/oglwrapper/unix/makefile
index 5036d3f..0d32eba 100644
--- a/classlib/modules/awt/src/main/native/oglwrapper/unix/makefile
+++ b/classlib/modules/awt/src/main/native/oglwrapper/unix/makefile
@@ -13,16 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/oglwrapper/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include
 
-BUILDFILES = \
-  $(SHAREDSUB)/org_apache_harmony_awt_gl_opengl_GL.o
+BUILDFILES = org_apache_harmony_awt_gl_opengl_GL.o
 
 OSLIBS += $(STDCLIBS)
 
 DLLNAME=$(DLLPATH)liboglwrapper$(HY_SHLIB_SUFFIX)
 EXPNAME=HYOGLWRAPPER_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/awt/src/main/native/oglwrapper/windows/makefile b/classlib/modules/awt/src/main/native/oglwrapper/windows/makefile
index 2ff7b96..0e2791d 100644
--- a/classlib/modules/awt/src/main/native/oglwrapper/windows/makefile
+++ b/classlib/modules/awt/src/main/native/oglwrapper/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\oglwrapper\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=oglwrapper
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -22,7 +23,7 @@
 
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(SHAREDSUB)include
 
-BUILDFILES = $(SHAREDSUB)org_apache_harmony_awt_gl_opengl_GL.obj
+BUILDFILES = $(HY_BIN)org_apache_harmony_awt_gl_opengl_GL.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/awt/src/main/native/win32wrapper/windows/makefile b/classlib/modules/awt/src/main/native/win32wrapper/windows/makefile
index 0a49f87..337c919 100644
--- a/classlib/modules/awt/src/main/native/win32wrapper/windows/makefile
+++ b/classlib/modules/awt/src/main/native/win32wrapper/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\win32wrapper\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=Win32Wrapper
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -21,12 +22,12 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  Callback.obj \
-  org_apache_harmony_awt_nativebridge_windows_Win32.obj \
-  org_apache_harmony_awt_nativebridge_windows_WGL.obj \
-  WinDataTransfer.obj \
-  WinManagement.obj \
-  nativelib_common.obj
+  $(HY_BIN)Callback.obj \
+  $(HY_BIN)org_apache_harmony_awt_nativebridge_windows_Win32.obj \
+  $(HY_BIN)org_apache_harmony_awt_nativebridge_windows_WGL.obj \
+  $(HY_BIN)WinDataTransfer.obj \
+  $(HY_BIN)WinManagement.obj \
+  $(HY_BIN)nativelib_common.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/awt/src/main/native/winfont/windows/makefile b/classlib/modules/awt/src/main/native/winfont/windows/makefile
index 44e07e9..46cb673 100644
--- a/classlib/modules/awt/src/main/native/winfont/windows/makefile
+++ b/classlib/modules/awt/src/main/native/winfont/windows/makefile
@@ -15,7 +15,8 @@
 
 TARGETOS = WINNT # Need _WIN32_WINNT=0x0500 to get GLYPHSET defined.
 APPVER = 5.0 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\awt\native\winfont\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=fontlib
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -25,7 +26,7 @@
 HYCFLAGS = $(HYCFLAGS) /Iinclude /I..\..\gl\windows\include /I..\..\fontlib\shared /I..\..\fontlib\windows \
   -DUNICODE -D_UNICODE
 
-BUILDFILES = winFont.obj
+BUILDFILES = $(HY_BIN)winFont.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib gdi32.lib GdiPlus.lib advapi32.lib 
diff --git a/classlib/modules/awt/src/main/native/x11wrapper/unix/makefile b/classlib/modules/awt/src/main/native/x11wrapper/unix/makefile
index 3073d5b..b7b5e95 100644
--- a/classlib/modules/awt/src/main/native/x11wrapper/unix/makefile
+++ b/classlib/modules/awt/src/main/native/x11wrapper/unix/makefile
@@ -13,12 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/awt/native/x11wrapper/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I/usr/X11R6/include
 
-BUILDFILES = \
-  org_apache_harmony_awt_nativebridge_linux_ErrorHandler.o \
+BUILDFILES = org_apache_harmony_awt_nativebridge_linux_ErrorHandler.o \
   org_apache_harmony_awt_nativebridge_linux_GLX.o \
   org_apache_harmony_awt_nativebridge_linux_X11.o \
   org_apache_harmony_awt_nativebridge_linux_Xft.o
@@ -28,4 +28,4 @@
 DLLNAME=$(DLLPATH)libX11Wrapper$(HY_SHLIB_SUFFIX)
 EXPNAME=HYX11WRAPPER_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/beans/build.xml b/classlib/modules/beans/build.xml
index 1808a0d..776775b 100644
--- a/classlib/modules/beans/build.xml
+++ b/classlib/modules/beans/build.xml
@@ -19,10 +19,10 @@
 <project name="BEANS Build" default="build" basedir=".">
     <description>Build for BEANS component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="beans" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,15 +95,15 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_test_support.jar">
-            <fileset dir="bin/test_support" />
+            <fileset dir="${hy.build.mod}/test/support" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_tests.jar">
-            <fileset dir="bin/test-internal" />
+            <fileset dir="${hy.build.mod}/test/internal" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -128,7 +128,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} test support"
-                       destdir="bin/test_support">
+                       destdir="${hy.build.mod}/test/support">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/support/java" />
@@ -136,12 +136,12 @@
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} internal tests"
-                       destdir="bin/test-internal">
+                       destdir="${hy.build.mod}/test/internal">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/java-internal" />
                 </src>
-                <classpath location="bin/test_support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} api tests">
@@ -149,7 +149,7 @@
                 <src>
                     <pathelement location="src/test/java" />
                 </src>
-                <classpath location="bin/test_support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
     </target>
diff --git a/classlib/modules/beans/make/run-test.xml b/classlib/modules/beans/make/run-test.xml
index b7fd8b0..20fb234 100644
--- a/classlib/modules/beans/make/run-test.xml
+++ b/classlib/modules/beans/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="beans" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/concurrent/build.xml b/classlib/modules/concurrent/build.xml
index 6ab884b..c163868 100644
--- a/classlib/modules/concurrent/build.xml
+++ b/classlib/modules/concurrent/build.xml
@@ -19,10 +19,10 @@
 <project name="CONCURRENT Build" default="build" basedir=".">
     <description>Build for CONCURRENT component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="concurrent" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -94,7 +94,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/concurrent/make/run-test.xml b/classlib/modules/concurrent/make/run-test.xml
index 6080538..0ec77b1 100644
--- a/classlib/modules/concurrent/make/run-test.xml
+++ b/classlib/modules/concurrent/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="concurrent" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/crypto/build.xml b/classlib/modules/crypto/build.xml
index 1908e33..8d8b2fc 100644
--- a/classlib/modules/crypto/build.xml
+++ b/classlib/modules/crypto/build.xml
@@ -19,10 +19,10 @@
 <project name="CRYPTO Build" default="build" basedir=".">
     <description>Build for CRYPTO component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="crypto" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,21 +95,21 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_test_support.jar">
-            <fileset dir="bin/test/support" />
+            <fileset dir="${hy.build.mod}/test/support" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_api_tests.jar">
-            <fileset dir="bin/test/api" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_api_boot_tests.jar">
-            <fileset dir="bin/test/api.injected" />
+            <fileset dir="${hy.build.mod}/test/api.injected" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_tests.jar">
-            <fileset dir="bin/test/impl" />
+            <fileset dir="${hy.build.mod}/test/impl" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_boot_tests.jar">
-            <fileset dir="bin/test/impl.injected" />
+            <fileset dir="${hy.build.mod}/test/impl.injected" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}" />
@@ -130,7 +130,7 @@
     <target name="-compile-tests" unless="skip.test.build">
 
         <compile-tests description="${hy.module} test support files"
-                       destdir="bin/test/support">
+                       destdir="${hy.build.mod}/test/support">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/support/common/java"/>
@@ -144,29 +144,29 @@
         </compile-tests>
 
         <compile-tests description="${hy.module} api tests"
-                       destdir="bin/test/api">
+                       destdir="${hy.build.mod}/test/api">
             <javac-elements>
                 <src path="src/test/api/java"/>
                 <include name="**/*Test.java" />
                 <classpath>
-                    <pathelement path="bin/test/support" />
+                    <pathelement path="${hy.build.mod}/test/support" />
                 </classpath>
             </javac-elements>
         </compile-tests>
 
         <compile-tests description="${hy.module} api injected tests"
-                       destdir="bin/test/api.injected">
+                       destdir="${hy.build.mod}/test/api.injected">
             <javac-elements>
                 <src path="src/test/api/java.injected"/>
                 <include name="**/*Test.java" />
                 <classpath>
-                    <pathelement path="bin/test/support" />
+                    <pathelement path="${hy.build.mod}/test/support" />
                 </classpath>
             </javac-elements>
         </compile-tests>
 
         <compile-tests description="${hy.module} impl injected tests"
-                       destdir="bin/test/impl.injected">
+                       destdir="${hy.build.mod}/test/impl.injected">
             <javac-elements>
                 <src path="src/test/impl/java.injected"/>
                 <include name="**/*Test.java" />
@@ -174,12 +174,12 @@
         </compile-tests>
 
         <compile-tests description="${hy.module} impl tests"
-                       destdir="bin/test/impl">
+                       destdir="${hy.build.mod}/test/impl">
             <javac-elements>
                 <src path="src/test/impl/java"/>
                 <include name="**/*Test.java" />
                 <classpath>
-                    <pathelement path="bin/test/support" />
+                    <pathelement path="${hy.build.mod}/test/support" />
                 </classpath>
             </javac-elements>
         </compile-tests>
diff --git a/classlib/modules/crypto/make/run-test.xml b/classlib/modules/crypto/make/run-test.xml
index 449a5a6..d494a8d 100644
--- a/classlib/modules/crypto/make/run-test.xml
+++ b/classlib/modules/crypto/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="crypto" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/imageio/build.xml b/classlib/modules/imageio/build.xml
index ff353b7..7b73bf2 100644
--- a/classlib/modules/imageio/build.xml
+++ b/classlib/modules/imageio/build.xml
@@ -19,10 +19,10 @@
 <project name="ImageIO Build" default="build" basedir=".">
     <description>Build for ImageIO component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="imageio" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
@@ -123,7 +123,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -179,7 +179,7 @@
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
             <metainf dir="src/test/java/META-INF" />
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/imageio/make/run-test.xml b/classlib/modules/imageio/make/run-test.xml
index ca9aa18..7bb64a8 100644
--- a/classlib/modules/imageio/make/run-test.xml
+++ b/classlib/modules/imageio/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="imageio" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/imageio/src/main/native/jpegencoder/unix/makefile b/classlib/modules/imageio/src/main/native/jpegencoder/unix/makefile
index 3bbaf1e..aec973e 100644
--- a/classlib/modules/imageio/src/main/native/jpegencoder/unix/makefile
+++ b/classlib/modules/imageio/src/main/native/jpegencoder/unix/makefile
@@ -13,11 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/imageio/native/jpegencoder/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
 
-BUILDFILES = $(SHAREDSUB)JpegEncoder.o
+BUILDFILES = JpegEncoder.o
 
 ifneq ($(HY_OS),zos)
 OSLIBS += -ljpeg
@@ -28,4 +29,4 @@
 DLLNAME=$(DLLPATH)libjpegencoder$(HY_SHLIB_SUFFIX)
 EXPNAME=HYJPEGENCODER_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile b/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile
index c5f0168..d897936 100644
--- a/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile
+++ b/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\imageio\native\jpegencoder\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 JPEG_DIR=$(HY_JPEG_DIR)\# avoid continuation
 
@@ -35,7 +36,7 @@
 !ENDIF
 
 
-BUILDFILES = $(SHAREDSUB)JpegEncoder.obj
+BUILDFILES = $(HY_BIN)JpegEncoder.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
@@ -48,7 +49,7 @@
 
 !include <$(HY_HDK)\build\make\rules.mak>
 
-$(SHAREDSUB)JpegEncoder.obj: jconfig.h
+$(HY_BIN)JpegEncoder.obj: jconfig.h
 
 jconfig.h: $(JPEG_DIR)jconfig.vc
 	copy $(JPEG_DIR)jconfig.vc $@
diff --git a/classlib/modules/imageio/src/main/native/pngencoder/unix/makefile b/classlib/modules/imageio/src/main/native/pngencoder/unix/makefile
index 74f88ca..4ce1805 100644
--- a/classlib/modules/imageio/src/main/native/pngencoder/unix/makefile
+++ b/classlib/modules/imageio/src/main/native/pngencoder/unix/makefile
@@ -13,11 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/imageio/native/pngencoder/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
 
-BUILDFILES = $(SHAREDSUB)pngencoder.o
+BUILDFILES = pngencoder.o
 
 ifneq ($(HY_OS),zos)
 OSLIBS += -lpng
@@ -33,4 +34,4 @@
 DLLNAME=$(DLLPATH)libpngencoder$(HY_SHLIB_SUFFIX)
 EXPNAME=HYPNGENCODER_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile b/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile
index b667019..e3347f3 100644
--- a/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile
+++ b/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\imageio\native\pngencoder\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 PNG_DIR=$(HY_PNG_DIR)\# avoid continuation
 
@@ -25,7 +26,7 @@
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)include /I$(SHAREDSUB) \
            /I$(PNG_DIR) /Iinclude
 
-BUILDFILES = $(SHAREDSUB)pngencoder.obj
+BUILDFILES = $(HY_BIN)pngencoder.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/instrument/build.xml b/classlib/modules/instrument/build.xml
index 27ff451..1a74f33 100644
--- a/classlib/modules/instrument/build.xml
+++ b/classlib/modules/instrument/build.xml
@@ -19,10 +19,10 @@
 <project name="INSTRUMENT Build" default="build" basedir=".">
     <description>Build for INSTRUMENT component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="instrument" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -67,7 +67,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -105,7 +105,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/instrument/make/run-test.xml b/classlib/modules/instrument/make/run-test.xml
index 0c8be7c..698c2a2 100644
--- a/classlib/modules/instrument/make/run-test.xml
+++ b/classlib/modules/instrument/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="instrument" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/instrument/src/main/native/instrument/unix/makefile b/classlib/modules/instrument/src/main/native/instrument/unix/makefile
index 761f14b..7cda678 100644
--- a/classlib/modules/instrument/src/main/native/instrument/unix/makefile
+++ b/classlib/modules/instrument/src/main/native/instrument/unix/makefile
@@ -17,10 +17,10 @@
 # Makefile for module 'instrument'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/instrument/native/instrument/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = \
-	../shared/instrument.o ../shared/inst_agt.o 
+BUILDFILES = instrument.o inst_agt.o 
 
 ifneq ($(HY_ZIP_API),true)
 MDLLIBFILES += $(LIBPATH)libhyzip.a 
@@ -35,4 +35,4 @@
 DLLNAME = $(DLLPATH)libhyinstrument$(HY_SHLIB_SUFFIX)
 EXPNAME = HYINSTRUMENT_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/instrument/src/main/native/instrument/windows/makefile b/classlib/modules/instrument/src/main/native/instrument/windows/makefile
index da22d99..d79934a 100644
--- a/classlib/modules/instrument/src/main/native/instrument/windows/makefile
+++ b/classlib/modules/instrument/src/main/native/instrument/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'instrument'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\instrument\native\instrument\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyinstrument
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -26,7 +27,7 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  $(SHAREDSUB)instrument.obj $(SHAREDSUB)inst_agt.obj 
+  $(HY_BIN)instrument.obj $(HY_BIN)inst_agt.obj 
 
 VIRTFILES = hyinstrument.res
 
diff --git a/classlib/modules/jmx/build.xml b/classlib/modules/jmx/build.xml
index 07d1990..9e0eb98 100644
--- a/classlib/modules/jmx/build.xml
+++ b/classlib/modules/jmx/build.xml
@@ -21,10 +21,10 @@
 <project name="JMX Build" default="build" basedir=".">
     <description>Build for JMX component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="jmx" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <target name="build" depends="check-depends" />
diff --git a/classlib/modules/jndi/build.xml b/classlib/modules/jndi/build.xml
index 970c291..de48ab3 100644
--- a/classlib/modules/jndi/build.xml
+++ b/classlib/modules/jndi/build.xml
@@ -19,10 +19,10 @@
 <project name="JNDI Build" default="build" basedir=".">
     <description>Build for JNDI component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="jndi" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/jndi/make/run-test.xml b/classlib/modules/jndi/make/run-test.xml
index cb63313..6a66ef3 100644
--- a/classlib/modules/jndi/make/run-test.xml
+++ b/classlib/modules/jndi/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="jndi" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/lang-management/build.xml b/classlib/modules/lang-management/build.xml
index b204817..2663454 100644
--- a/classlib/modules/lang-management/build.xml
+++ b/classlib/modules/lang-management/build.xml
@@ -19,10 +19,10 @@
 <project name="LANG-MANAGEMENT Build" default="build" basedir=".">
     <description>Build for LANG-MANAGEMENT component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="lang-management" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -94,11 +94,11 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/api" />
+            <fileset dir="${hy.build.mod}/api" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_tests.jar">
-            <fileset dir="bin/impl" />
+            <fileset dir="${hy.build.mod}/impl" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -114,7 +114,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} api tests"
-                       destdir="bin/api">
+                       destdir="${hy.build.mod}/api">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/java" />
@@ -122,7 +122,7 @@
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} impl tests"
-                       destdir="bin/impl">
+                       destdir="${hy.build.mod}/impl">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/impl/java" />
diff --git a/classlib/modules/lang-management/make/run-test.xml b/classlib/modules/lang-management/make/run-test.xml
index 5930ed4..b25cee7 100644
--- a/classlib/modules/lang-management/make/run-test.xml
+++ b/classlib/modules/lang-management/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="lang-management" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/logging/build.xml b/classlib/modules/logging/build.xml
index 92137b5..6b83184 100644
--- a/classlib/modules/logging/build.xml
+++ b/classlib/modules/logging/build.xml
@@ -19,10 +19,10 @@
 <project name="LOGGING Build" default="build" basedir=".">
     <description>Build for LOGGING component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="logging" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -58,7 +58,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -107,10 +107,10 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_boot_tests.jar">
-            <fileset dir="bin/test-internal" />
+            <fileset dir="${hy.build.mod}/test/internal" />
         </hy.jar.bin>
 
         <copy file="../../support/src/test/resources/config/testing.policy"
@@ -133,7 +133,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} internal tests"
-                       destdir="bin/test-internal">
+                       destdir="${hy.build.mod}/test/internal">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/java-internal" />
@@ -143,7 +143,7 @@
         <compile-tests description="${hy.module} api tests">
             <javac-elements>
                 <bootclasspath>
-                    <pathelement path="bin/test-internal"/>
+                    <pathelement path="${hy.build.mod}/test/internal"/>
                 </bootclasspath>
                 <src>
                     <pathelement location="src/test/java" />
diff --git a/classlib/modules/logging/make/run-test.xml b/classlib/modules/logging/make/run-test.xml
index d2cd78b..043b8f6 100644
--- a/classlib/modules/logging/make/run-test.xml
+++ b/classlib/modules/logging/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="logging" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/luni-kernel/build.xml b/classlib/modules/luni-kernel/build.xml
index 401ad92..a3815f7 100644
--- a/classlib/modules/luni-kernel/build.xml
+++ b/classlib/modules/luni-kernel/build.xml
@@ -21,9 +21,10 @@
 
     <description>Build for luni kernel stub jar</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="luni-kernel" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property name="stub.jar"
               location="${hy.jdk}/jre/lib/boot/${hy.module}-stubs.jar" />
diff --git a/classlib/modules/luni/build.xml b/classlib/modules/luni/build.xml
index 1c1b451..6a9b40b 100644
--- a/classlib/modules/luni/build.xml
+++ b/classlib/modules/luni/build.xml
@@ -19,15 +19,16 @@
 <project name="LUNI Build" default="build" basedir=".">
     <description>Build for LUNI component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="luni" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
 
-    <property name="fdlibm.dist" location="src/main/native/fdlibm_dist"/>
+    <property name="fdlibm.dist"
+              location="${hy.target}/depends/native/fdlibm_dist"/>
 
     <target name="build" depends="-build-no-check"/>
     <target name="-build-no-check" depends="-build-jar,-test-jar" />
@@ -71,14 +72,12 @@
              runtime the libvmi.so provided by the VM
              implementation is loaded
           -->
-        <copy todir="${hy.hdk}/lib" failonerror="false"
-              preservelastmodified="true">
-            <fileset dir="src/main/native/vmi">
+        <copy todir="${hy.hdk}/lib" flatten="true" preservelastmodified="true">
+            <fileset dir="${hy.build.mod}/native/vmi">
                 <include name="libvmi${shlib.suffix}"/>
-            </fileset>
-            <!-- Copy link exports file on z/OS -->
-            <fileset dir="src/main/native/vmi/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
+                <!-- Copy link exports file on z/OS -->
+                <include name="${hy.os.family}/*${linklib.suffix}"
+                         if="is.zos" />
             </fileset>
         </copy>
     </target>
@@ -113,6 +112,7 @@
 
     <!-- Overlay OSS packages into their required locations -->
     <target name="-unzip-oss" unless="skip.native.build">
+        <mkdir dir="${fdlibm.dist}"/>
         <untar src="${fdlibm.tar}" compression="gzip" dest="${fdlibm.dist}">
             <patternset>
                 <exclude name="fdlibm53"/>
@@ -125,8 +125,10 @@
             <fileset dir="${fdlibm.dist}" >
                 <include name="fdlibm.h"/>
                 <include name="s_lib_version.c"/>
-                <include name="configure*"/>
-                <include name="Makefile*"/>
+                <include name="configure"/>
+                <include name="configure.in"/>
+                <include name="Makefile"/>
+                <include name="Makefile.in"/>
             </fileset>
             <mapper type="glob" from="*" to="*.orig" />
         </move>
@@ -212,7 +214,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -251,11 +253,11 @@
               tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_api.jar">
-            <fileset dir="bin/test/api" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_impl.jar">
-            <fileset dir="bin/test/impl" />
+            <fileset dir="${hy.build.mod}/test/impl" />
         </hy.jar.bin>
 
         <copy todir="${tests.resources.hdk.dir}">
@@ -292,7 +294,7 @@
     <!-- compile both api tests and impl tests-->
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} api tests"
-                       destdir="bin/test/api">
+                       destdir="${hy.build.mod}/test/api">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/common" />
@@ -305,7 +307,7 @@
             </javac-elements>
         </compile-tests>
         <compile-tests description="${hy.module} impl tests"
-                       destdir="bin/test/impl">
+                       destdir="${hy.build.mod}/test/impl">
             <javac-elements>
                 <src>
                    <pathelement location="src/test/impl/common" />
diff --git a/classlib/modules/luni/make/run-test.xml b/classlib/modules/luni/make/run-test.xml
index 4a8b99d..a79c5d7 100644
--- a/classlib/modules/luni/make/run-test.xml
+++ b/classlib/modules/luni/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="luni" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/luni/src/main/native/fdlibm/unix/makefile b/classlib/modules/luni/src/main/native/fdlibm/unix/makefile
index 78343c3..b111688 100644
--- a/classlib/modules/luni/src/main/native/fdlibm/unix/makefile
+++ b/classlib/modules/luni/src/main/native/fdlibm/unix/makefile
@@ -17,32 +17,24 @@
 # Makefile for module 'fdlibm'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/fdlibm/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-FDLIBM_DIST=../../fdlibm_dist/
+OSS_DIST=$(HY_TARGET)/depends/native/fdlibm_dist/# Path to fdlibm
 
 BUILDFILES = \
-	$(FDLIBM_DIST)e_acos.o $(FDLIBM_DIST)e_acosh.o $(FDLIBM_DIST)e_asin.o $(FDLIBM_DIST)e_atan2.o \
-	$(FDLIBM_DIST)e_atanh.o $(FDLIBM_DIST)e_cosh.o $(FDLIBM_DIST)e_exp.o $(FDLIBM_DIST)e_fmod.o \
-	$(FDLIBM_DIST)e_gamma.o $(FDLIBM_DIST)e_gamma_r.o $(FDLIBM_DIST)e_hypot.o $(FDLIBM_DIST)e_j0.o \
-	$(FDLIBM_DIST)e_j1.o $(FDLIBM_DIST)e_jn.o $(FDLIBM_DIST)e_lgamma.o $(FDLIBM_DIST)e_lgamma_r.o \
-	$(FDLIBM_DIST)e_log.o $(FDLIBM_DIST)e_log10.o $(FDLIBM_DIST)e_pow.o $(FDLIBM_DIST)e_rem_pio2.o \
-	$(FDLIBM_DIST)e_remainder.o $(FDLIBM_DIST)e_scalb.o $(FDLIBM_DIST)e_sinh.o $(FDLIBM_DIST)e_sqrt.o \
-	$(FDLIBM_DIST)k_cos.o $(FDLIBM_DIST)k_rem_pio2.o $(FDLIBM_DIST)k_sin.o $(FDLIBM_DIST)k_standard.o \
-	$(FDLIBM_DIST)k_tan.o $(FDLIBM_DIST)s_asinh.o $(FDLIBM_DIST)s_atan.o $(FDLIBM_DIST)s_cbrt.o $(FDLIBM_DIST)s_ceil.o \
-	$(FDLIBM_DIST)s_copysign.o $(FDLIBM_DIST)s_cos.o $(FDLIBM_DIST)s_erf.o $(FDLIBM_DIST)s_expm1.o \
-	$(FDLIBM_DIST)s_fabs.o $(FDLIBM_DIST)s_finite.o $(FDLIBM_DIST)s_floor.o $(FDLIBM_DIST)s_frexp.o \
-	$(FDLIBM_DIST)s_ilogb.o $(FDLIBM_DIST)s_isnan.o $(FDLIBM_DIST)s_ldexp.o \
-	$(SHAREDSUB)s_lib_version.o \
-	$(FDLIBM_DIST)s_log1p.o $(FDLIBM_DIST)s_logb.o $(FDLIBM_DIST)s_matherr.o $(FDLIBM_DIST)s_modf.o \
-	$(FDLIBM_DIST)s_nextafter.o $(FDLIBM_DIST)s_rint.o $(FDLIBM_DIST)s_scalbn.o $(FDLIBM_DIST)s_signgam.o \
-	$(FDLIBM_DIST)s_significand.o $(FDLIBM_DIST)s_sin.o $(FDLIBM_DIST)s_tan.o $(FDLIBM_DIST)s_tanh.o \
-	$(FDLIBM_DIST)w_acos.o $(FDLIBM_DIST)w_acosh.o $(FDLIBM_DIST)w_asin.o $(FDLIBM_DIST)w_atan2.o \
-	$(FDLIBM_DIST)w_atanh.o $(FDLIBM_DIST)w_cosh.o $(FDLIBM_DIST)w_exp.o $(FDLIBM_DIST)w_fmod.o \
-	$(FDLIBM_DIST)w_gamma.o $(FDLIBM_DIST)w_gamma_r.o $(FDLIBM_DIST)w_hypot.o $(FDLIBM_DIST)w_j0.o \
-	$(FDLIBM_DIST)w_j1.o $(FDLIBM_DIST)w_jn.o $(FDLIBM_DIST)w_lgamma.o $(FDLIBM_DIST)w_lgamma_r.o \
-	$(FDLIBM_DIST)w_log.o $(FDLIBM_DIST)w_log10.o $(FDLIBM_DIST)w_pow.o $(FDLIBM_DIST)w_remainder.o \
-	$(FDLIBM_DIST)w_scalb.o $(FDLIBM_DIST)w_sinh.o $(FDLIBM_DIST)w_sqrt.o
+  e_acos.o e_acosh.o e_asin.o e_atan2.o e_atanh.o e_cosh.o e_exp.o e_fmod.o \
+  e_gamma.o e_gamma_r.o e_hypot.o e_j0.o e_j1.o e_jn.o e_lgamma.o \
+  e_lgamma_r.o e_log.o e_log10.o e_pow.o e_rem_pio2.o e_remainder.o e_scalb.o \
+  e_sinh.o e_sqrt.o \
+  k_cos.o k_rem_pio2.o k_sin.o k_standard.o k_tan.o \
+  s_asinh.o s_atan.o s_cbrt.o s_ceil.o s_copysign.o s_cos.o s_erf.o s_expm1.o \
+  s_fabs.o s_finite.o s_floor.o s_frexp.o s_ilogb.o s_isnan.o s_ldexp.o \
+  s_lib_version.o s_log1p.o s_logb.o s_matherr.o s_modf.o s_nextafter.o \
+  s_rint.o s_scalbn.o s_signgam.o s_significand.o s_sin.o s_tan.o s_tanh.o \
+  w_acos.o w_acosh.o w_asin.o w_atan2.o w_atanh.o w_cosh.o w_exp.o w_fmod.o \
+  w_gamma.o w_gamma_r.o w_hypot.o w_j0.o w_j1.o w_jn.o w_lgamma.o w_lgamma_r.o \
+  w_log.o w_log10.o w_pow.o w_remainder.o w_scalb.o w_sinh.o w_sqrt.o
 
 DEFINES += -D_IEEE_LIBM
 
@@ -56,4 +48,4 @@
 endif
 PLATFORM := $(subst -fpic,-fPIC,$(PLATFORM))
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/fdlibm/windows/makefile b/classlib/modules/luni/src/main/native/fdlibm/windows/makefile
index 0971c87..62fe291 100644
--- a/classlib/modules/luni/src/main/native/fdlibm/windows/makefile
+++ b/classlib/modules/luni/src/main/native/fdlibm/windows/makefile
@@ -17,50 +17,62 @@
 # Makefile for module 'fdlibm'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\fdlibm\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBNAME=$(LIBPATH)hyfdlibm.lib
 
-FDLIBM_DIST=..\..\fdlibm_dist\# Comment to stop line continuation
+OSS_DIST=$(HY_TARGET)\depends\native\fdlibm_dist\# Path to fdlibm
 
 BUILDFILES = \
-  $(FDLIBM_DIST)e_acos.obj $(FDLIBM_DIST)e_acosh.obj $(FDLIBM_DIST)e_asin.obj $(FDLIBM_DIST)e_atan2.obj \
-  $(FDLIBM_DIST)e_atanh.obj $(FDLIBM_DIST)e_cosh.obj $(FDLIBM_DIST)e_exp.obj $(FDLIBM_DIST)e_fmod.obj \
-  $(FDLIBM_DIST)e_gamma.obj $(FDLIBM_DIST)e_gamma_r.obj $(FDLIBM_DIST)e_hypot.obj $(FDLIBM_DIST)e_j0.obj \
-  $(FDLIBM_DIST)e_j1.obj $(FDLIBM_DIST)e_jn.obj $(FDLIBM_DIST)e_lgamma.obj $(FDLIBM_DIST)e_lgamma_r.obj \
-  $(FDLIBM_DIST)e_log.obj $(FDLIBM_DIST)e_log10.obj $(FDLIBM_DIST)e_pow.obj $(FDLIBM_DIST)e_rem_pio2.obj \
-  $(FDLIBM_DIST)e_remainder.obj $(FDLIBM_DIST)e_scalb.obj $(FDLIBM_DIST)e_sinh.obj $(FDLIBM_DIST)e_sqrt.obj \
-  $(FDLIBM_DIST)k_cos.obj $(FDLIBM_DIST)k_rem_pio2.obj $(FDLIBM_DIST)k_sin.obj $(FDLIBM_DIST)k_standard.obj \
-  $(FDLIBM_DIST)k_tan.obj $(FDLIBM_DIST)s_asinh.obj $(FDLIBM_DIST)s_atan.obj $(FDLIBM_DIST)s_cbrt.obj \
-  $(FDLIBM_DIST)s_ceil.obj $(FDLIBM_DIST)s_copysign.obj $(FDLIBM_DIST)s_cos.obj $(FDLIBM_DIST)s_erf.obj \
-  $(FDLIBM_DIST)s_expm1.obj $(FDLIBM_DIST)s_fabs.obj $(FDLIBM_DIST)s_finite.obj $(FDLIBM_DIST)s_floor.obj \
-  $(FDLIBM_DIST)s_frexp.obj $(FDLIBM_DIST)s_ilogb.obj $(FDLIBM_DIST)s_isnan.obj $(FDLIBM_DIST)s_ldexp.obj \
-  $(SHAREDSUB)s_lib_version.obj \
-  $(FDLIBM_DIST)s_log1p.obj $(FDLIBM_DIST)s_logb.obj $(FDLIBM_DIST)s_matherr.obj \
-  $(FDLIBM_DIST)s_modf.obj $(FDLIBM_DIST)s_nextafter.obj $(FDLIBM_DIST)s_rint.obj $(FDLIBM_DIST)s_scalbn.obj \
-  $(FDLIBM_DIST)s_signgam.obj $(FDLIBM_DIST)s_significand.obj $(FDLIBM_DIST)s_sin.obj $(FDLIBM_DIST)s_tan.obj \
-  $(FDLIBM_DIST)s_tanh.obj $(FDLIBM_DIST)w_acos.obj $(FDLIBM_DIST)w_acosh.obj $(FDLIBM_DIST)w_asin.obj \
-  $(FDLIBM_DIST)w_atan2.obj $(FDLIBM_DIST)w_atanh.obj $(FDLIBM_DIST)w_cosh.obj $(FDLIBM_DIST)w_exp.obj \
-  $(FDLIBM_DIST)w_fmod.obj $(FDLIBM_DIST)w_gamma.obj $(FDLIBM_DIST)w_gamma_r.obj $(FDLIBM_DIST)w_hypot.obj \
-  $(FDLIBM_DIST)w_j0.obj $(FDLIBM_DIST)w_j1.obj $(FDLIBM_DIST)w_jn.obj $(FDLIBM_DIST)w_lgamma.obj \
-  $(FDLIBM_DIST)w_lgamma_r.obj $(FDLIBM_DIST)w_log.obj $(FDLIBM_DIST)w_log10.obj $(FDLIBM_DIST)w_pow.obj \
-  $(FDLIBM_DIST)w_remainder.obj $(FDLIBM_DIST)w_scalb.obj $(FDLIBM_DIST)w_sinh.obj $(FDLIBM_DIST)w_sqrt.obj
+  $(HY_BIN)e_acos.obj $(HY_BIN)e_acosh.obj $(HY_BIN)e_asin.obj \
+  $(HY_BIN)e_atan2.obj $(HY_BIN)e_atanh.obj $(HY_BIN)e_cosh.obj \
+  $(HY_BIN)e_exp.obj $(HY_BIN)e_fmod.obj $(HY_BIN)e_gamma.obj \
+  $(HY_BIN)e_gamma_r.obj $(HY_BIN)e_hypot.obj $(HY_BIN)e_j0.obj \
+  $(HY_BIN)e_j1.obj $(HY_BIN)e_jn.obj $(HY_BIN)e_lgamma.obj \
+  $(HY_BIN)e_lgamma_r.obj $(HY_BIN)e_log.obj $(HY_BIN)e_log10.obj \
+  $(HY_BIN)e_pow.obj $(HY_BIN)e_rem_pio2.obj $(HY_BIN)e_remainder.obj \
+  $(HY_BIN)e_scalb.obj $(HY_BIN)e_sinh.obj $(HY_BIN)e_sqrt.obj \
+  $(HY_BIN)k_cos.obj $(HY_BIN)k_rem_pio2.obj $(HY_BIN)k_sin.obj \
+  $(HY_BIN)k_standard.obj $(HY_BIN)k_tan.obj $(HY_BIN)s_asinh.obj \
+  $(HY_BIN)s_atan.obj $(HY_BIN)s_cbrt.obj $(HY_BIN)s_ceil.obj \
+  $(HY_BIN)s_copysign.obj $(HY_BIN)s_cos.obj $(HY_BIN)s_erf.obj \
+  $(HY_BIN)s_expm1.obj $(HY_BIN)s_fabs.obj $(HY_BIN)s_finite.obj \
+  $(HY_BIN)s_floor.obj $(HY_BIN)s_frexp.obj $(HY_BIN)s_ilogb.obj \
+  $(HY_BIN)s_isnan.obj $(HY_BIN)s_ldexp.obj $(HY_BIN)s_lib_version.obj \
+  $(HY_BIN)s_log1p.obj $(HY_BIN)s_logb.obj $(HY_BIN)s_matherr.obj \
+  $(HY_BIN)s_modf.obj $(HY_BIN)s_nextafter.obj $(HY_BIN)s_rint.obj \
+  $(HY_BIN)s_scalbn.obj $(HY_BIN)s_signgam.obj $(HY_BIN)s_significand.obj \
+  $(HY_BIN)s_sin.obj $(HY_BIN)s_tan.obj $(HY_BIN)s_tanh.obj \
+  $(HY_BIN)w_acos.obj $(HY_BIN)w_acosh.obj $(HY_BIN)w_asin.obj \
+  $(HY_BIN)w_atan2.obj $(HY_BIN)w_atanh.obj $(HY_BIN)w_cosh.obj \
+  $(HY_BIN)w_exp.obj $(HY_BIN)w_fmod.obj $(HY_BIN)w_gamma.obj \
+  $(HY_BIN)w_gamma_r.obj $(HY_BIN)w_hypot.obj $(HY_BIN)w_j0.obj \
+  $(HY_BIN)w_j1.obj $(HY_BIN)w_jn.obj $(HY_BIN)w_lgamma.obj \
+  $(HY_BIN)w_lgamma_r.obj $(HY_BIN)w_log.obj $(HY_BIN)w_log10.obj \
+  $(HY_BIN)w_pow.obj $(HY_BIN)w_remainder.obj $(HY_BIN)w_scalb.obj \
+  $(HY_BIN)w_sinh.obj $(HY_BIN)w_sqrt.obj
 
 HYCFLAGS = -Oityb1 -W3 -Fd$(LIBPATH)hyfdlibm.pdb -D_IEEE_LIBM \
-	   /I$(SHAREDSUB) /I$(HY_HDK)\include /I$(HY_HDK)\jdk\include
+	   /I$(SHAREDSUB) /I$(HY_HDK)\include /I$(HY_HDK)\jdk\include \
+	   /I$(OSS_DIST)
 
-.c.obj:
-        $(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $*.c
+all: $(HY_BIN) $(LIBNAME)
 
-$(LIBPATH)$(LIBNAME): $(BUILDFILES)
-	@echo /NOLOGO -out:$(LIBNAME) >templrf
-	@echo $(BUILDFILES) >>templrf
-	$(implib) @templrf
-	@del templrf
+$(HY_BIN):
+	-mkdir $(HY_BIN)
+
+{$(OSS_DIST)}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(SHAREDSUB)}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+$(LIBNAME): $(BUILDFILES)
+	$(implib) /NOLOGO -out:$(LIBNAME) $(BUILDFILES)
 
 clean:
 	-del *.obj dist\*.obj
 	-del $(LIBNAME)
 	-del $(LIBPATH)hyfdlibm.pdb
         -del $(SHAREDSUB)*.obj
-
diff --git a/classlib/modules/luni/src/main/native/hyzip/unix/makefile b/classlib/modules/luni/src/main/native/hyzip/unix/makefile
index b4fe714..155038f 100644
--- a/classlib/modules/luni/src/main/native/hyzip/unix/makefile
+++ b/classlib/modules/luni/src/main/native/hyzip/unix/makefile
@@ -17,14 +17,14 @@
 # Makefile for module 'hyzip'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/hyzip/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I../../include/shared
-BUILDFILES = $(SHAREDSUB)hyzip.o $(SHAREDSUB)zcpool.o $(SHAREDSUB)zipalloc.o \
-	$(SHAREDSUB)zipcache.o $(SHAREDSUB)zipsup.o pool.o pool_cap.o
+BUILDFILES = hyzip.o zcpool.o zipalloc.o zipcache.o zipsup.o pool.o pool_cap.o
 LIBNAME = $(LIBPATH)libhyzip.a
 
-%.o: $(LIBPATH)libhypool.a(%.o)
-	ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@
+$(HY_BIN)%.o: $(LIBPATH)libhypool.a(%.o)
+	( cd $(HY_BIN) && ar $(ARFLAGS) $(AREXTRACT) $(LIBPATH)libhypool.a $@ )
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/launcher/unix/makefile b/classlib/modules/luni/src/main/native/launcher/unix/makefile
index 3ca94d7..d4c03fb 100644
--- a/classlib/modules/luni/src/main/native/launcher/unix/makefile
+++ b/classlib/modules/luni/src/main/native/launcher/unix/makefile
@@ -17,11 +17,11 @@
 # Makefile for 'launcher'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/launcher/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)main.o $(SHAREDSUB)cmain.o \
-	$(SHAREDSUB)launcher_copyright.o $(SHAREDSUB)strbuf.o \
-	$(SHAREDSUB)libhlp.o
+BUILDFILES = main.o cmain.o launcher_copyright.o strbuf.o libhlp.o
+
 ifeq ($(HY_NO_THR),false)
 MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
 else
@@ -34,4 +34,4 @@
 MDLLIBFILES = $(LIBPATH)libhya2e.a $(LIBPATH)libhycommon.a
 endif
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/launcher/windows/makefile.javae b/classlib/modules/luni/src/main/native/launcher/windows/makefile.javae
index 90fe110..4fd645b 100644
--- a/classlib/modules/luni/src/main/native/launcher/windows/makefile.javae
+++ b/classlib/modules/luni/src/main/native/launcher/windows/makefile.javae
@@ -17,18 +17,19 @@
 # Makefile for module 'launcher.java'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\launcher\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 EXEBASE=java
 EXENAME=$(EXEPATH)$(EXEBASE).exe
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
 
-BUILDFILES = $(SHAREDSUB)launcher_copyright.obj $(SHAREDSUB)cmain.obj \
-        $(SHAREDSUB)main.obj $(SHAREDSUB)strbuf.obj $(SHAREDSUB)libhlp.obj
+BUILDFILES = $(HY_BIN)launcher_copyright.obj $(HY_BIN)cmain.obj \
+        $(HY_BIN)main.obj $(HY_BIN)strbuf.obj $(HY_BIN)libhlp.obj
 !IF "$(HY_NO_THR)" == "false"
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
 !ELSE
-BUILDFILES = $(BUILDFILES) main_hlp.obj
+BUILDFILES = $(BUILDFILES) $(HY_BIN)main_hlp.obj
 !ENDIF
 
 VIRTFILES = java.res
diff --git a/classlib/modules/luni/src/main/native/launcher/windows/makefile.javaw b/classlib/modules/luni/src/main/native/launcher/windows/makefile.javaw
index 871a7b0..f70b702 100644
--- a/classlib/modules/luni/src/main/native/launcher/windows/makefile.javaw
+++ b/classlib/modules/luni/src/main/native/launcher/windows/makefile.javaw
@@ -17,18 +17,19 @@
 # Makefile for module 'launcher.javaw'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\launcher\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 EXEBASE=javaw
 EXENAME=$(EXEPATH)$(EXEBASE).exe
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
 
-BUILDFILES = $(SHAREDSUB)launcher_copyright.obj $(SHAREDSUB)main.obj \
-        winmain.obj $(SHAREDSUB)strbuf.obj $(SHAREDSUB)libhlp.obj
+BUILDFILES = $(HY_BIN)launcher_copyright.obj $(HY_BIN)main.obj \
+             $(HY_BIN)winmain.obj $(HY_BIN)strbuf.obj $(HY_BIN)libhlp.obj
 !IF "$(HY_NO_THR)" == "false"
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
 !ELSE
-BUILDFILES = $(BUILDFILES) main_hlp.obj
+BUILDFILES = $(BUILDFILES) $(HY_BIN)main_hlp.obj
 !ENDIF
 VIRTFILES = javaw.res
 EXEFLAGS=$(guilflags) -subsystem:windows
diff --git a/classlib/modules/luni/src/main/native/luni/unix/makefile b/classlib/modules/luni/src/main/native/luni/unix/makefile
index 124c637..d391340 100644
--- a/classlib/modules/luni/src/main/native/luni/unix/makefile
+++ b/classlib/modules/luni/src/main/native/luni/unix/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'luni'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/luni/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 # CFLAGS += -fpic -Wall -Werror 
 ifneq ($(HY_OS),zos)
@@ -27,25 +28,17 @@
 endif
 
 BUILDFILES = \
-	$(SHAREDSUB)luni_copyright.o $(SHAREDSUB)file.o procimpl.o \
-	$(SHAREDSUB)nethelp.o \
-	$(SHAREDSUB)floatbits.o \
-	helpers.o $(SHAREDSUB)math.o $(SHAREDSUB)luniglob.o \
-	$(SHAREDSUB)proxy.o \
-	$(SHAREDSUB)cbigint.o $(SHAREDSUB)dblparse.o $(SHAREDSUB)fltparse.o \
-	$(SHAREDSUB)netif.o $(SHAREDSUB)process.o $(SHAREDSUB)bigint.o \
-	$(SHAREDSUB)osc.o $(SHAREDSUB)socket.o $(SHAREDSUB)inetadds.o \
-	$(SHAREDSUB)filedesc.o $(SHAREDSUB)timezone.o \
-	$(SHAREDSUB)OSFileSystem.o OSFileSystemLinux32.o \
-	$(SHAREDSUB)OSMemory.o OSMemoryLinux32.o $(SHAREDSUB)OSNetworkSystem.o \
-	OSNetworkSystemLinux.o hyenv.o 
+  luni_copyright.o file.o procimpl.o nethelp.o floatbits.o helpers.o math.o \
+  luniglob.o proxy.o cbigint.o dblparse.o fltparse.o netif.o process.o \
+  bigint.o osc.o socket.o inetadds.o filedesc.o timezone.o OSFileSystem.o \
+  OSFileSystemLinux32.o OSMemory.o OSMemoryLinux32.o OSNetworkSystem.o \
+  OSNetworkSystemLinux.o hyenv.o 
 
-MDLLIBFILES += $(LIBPATH)libhyfdlibm.a \
-	$(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
+MDLLIBFILES += $(LIBPATH)libhyfdlibm.a $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
 OSLIBS += -lm
 
 DLLNAME = $(DLLPATH)libhyluni$(HY_SHLIB_SUFFIX)
 EXPNAME = HYLUNI_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/luni/windows/makefile b/classlib/modules/luni/src/main/native/luni/windows/makefile
index f04680d..fb7dbb4 100644
--- a/classlib/modules/luni/src/main/native/luni/windows/makefile
+++ b/classlib/modules/luni/src/main/native/luni/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'luni'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\luni\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyluni
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -26,17 +27,17 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  $(SHAREDSUB)luni_copyright.obj $(SHAREDSUB)file.obj procimpl.obj \
-  $(SHAREDSUB)nethelp.obj $(SHAREDSUB)floatbits.obj \
-  helpers.obj $(SHAREDSUB)math.obj \
-  $(SHAREDSUB)luniglob.obj $(SHAREDSUB)proxy.obj $(SHAREDSUB)netif.obj \
-  $(SHAREDSUB)cbigint.obj $(SHAREDSUB)dblparse.obj $(SHAREDSUB)fltparse.obj \
-  $(SHAREDSUB)process.obj $(SHAREDSUB)bigint.obj $(SHAREDSUB)osc.obj \
-  $(SHAREDSUB)socket.obj $(SHAREDSUB)inetadds.obj \
-  $(SHAREDSUB)filedesc.obj $(SHAREDSUB)timezone.obj \
-  OSFileSystemWin32.obj hyenv.obj\
-  $(SHAREDSUB)OSFileSystem.obj OSMemoryWin32.obj $(SHAREDSUB)OSMemory.obj \
-  $(SHAREDSUB)OSNetworkSystem.obj OSNetworkSystemWin32.obj
+  $(HY_BIN)luni_copyright.obj $(HY_BIN)file.obj $(HY_BIN)procimpl.obj \
+  $(HY_BIN)nethelp.obj $(HY_BIN)floatbits.obj \
+  $(HY_BIN)helpers.obj $(HY_BIN)math.obj \
+  $(HY_BIN)luniglob.obj $(HY_BIN)proxy.obj $(HY_BIN)netif.obj \
+  $(HY_BIN)cbigint.obj $(HY_BIN)dblparse.obj $(HY_BIN)fltparse.obj \
+  $(HY_BIN)process.obj $(HY_BIN)bigint.obj $(HY_BIN)osc.obj \
+  $(HY_BIN)socket.obj $(HY_BIN)inetadds.obj \
+  $(HY_BIN)filedesc.obj $(HY_BIN)timezone.obj \
+  $(HY_BIN)OSFileSystemWin32.obj $(HY_BIN)hyenv.obj\
+  $(HY_BIN)OSFileSystem.obj $(HY_BIN)OSMemoryWin32.obj $(HY_BIN)OSMemory.obj \
+  $(HY_BIN)OSNetworkSystem.obj $(HY_BIN)OSNetworkSystemWin32.obj
 
 VIRTFILES = hyluni.res
 
diff --git a/classlib/modules/luni/src/main/native/vmi/unix/makefile b/classlib/modules/luni/src/main/native/vmi/unix/makefile
index f755a32..49b4093 100644
--- a/classlib/modules/luni/src/main/native/vmi/unix/makefile
+++ b/classlib/modules/luni/src/main/native/vmi/unix/makefile
@@ -17,13 +17,14 @@
 # Makefile for module 'vmi stubs'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/vmi/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)vmi_copyright.o $(SHAREDSUB)vmi.o
+BUILDFILES = vmi_copyright.o vmi.o
 MDLLIBFILES =
 
-DLLNAME = ../libvmi$(HY_SHLIB_SUFFIX)
+DLLNAME = $(HY_BIN)libvmi$(HY_SHLIB_SUFFIX)
 EXPNAME = VMI_0.1
 HY_CAN_LINK_DEBUG=no
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/vmi/windows/makefile b/classlib/modules/luni/src/main/native/vmi/windows/makefile
index de73dea..e2e6a67 100644
--- a/classlib/modules/luni/src/main/native/vmi/windows/makefile
+++ b/classlib/modules/luni/src/main/native/vmi/windows/makefile
@@ -17,14 +17,15 @@
 # Makefile for module 'vmi'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\vmi\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=vmi
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYCFLAGS = $(HYCFLAGS) -DHYPORT_LIBRARY_DEFINE
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
-BUILDFILES = $(SHAREDSUB)vmi_copyright.obj $(SHAREDSUB)vmi.obj
+BUILDFILES = $(HY_BIN)vmi_copyright.obj $(HY_BIN)vmi.obj
 
 VIRTFILES = vmi.res
 
diff --git a/classlib/modules/luni/src/main/native/vmls/unix/makefile b/classlib/modules/luni/src/main/native/vmls/unix/makefile
index b9cd74f..3d2d5c5 100644
--- a/classlib/modules/luni/src/main/native/vmls/unix/makefile
+++ b/classlib/modules/luni/src/main/native/vmls/unix/makefile
@@ -14,13 +14,14 @@
 #  limitations under the License.
 
 #
-# Makefile for module 'common'
+# Makefile for module 'vmls'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/luni/native/vmls/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I../../include/shared
-BUILDFILES = $(SHAREDSUB)vmls.o
+BUILDFILES = vmls.o
 LIBNAME = $(LIBPATH)libhyvmls.a
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/luni/src/main/native/vmls/windows/makefile b/classlib/modules/luni/src/main/native/vmls/windows/makefile
index 17af152..2987c68 100644
--- a/classlib/modules/luni/src/main/native/vmls/windows/makefile
+++ b/classlib/modules/luni/src/main/native/vmls/windows/makefile
@@ -17,12 +17,12 @@
 # Makefile for module 'vmls'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\luni\native\vmls\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBNAME=$(LIBPATH)hyvmls.lib
 
-BUILDFILES = \
-	$(SHAREDSUB)vmls.obj
+BUILDFILES = $(HY_BIN)vmls.obj
 
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\include\shared /I..\..\include\windows
 
diff --git a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java
index 8744ddb..4efbbba 100644
--- a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java
+++ b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java
@@ -1,524 +1,524 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.io;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import junit.framework.TestCase;
-import tests.support.Support_PlatformFile;
-
-public class BufferedInputStreamTest extends TestCase {
-
-    public String fileName;
-
-    private BufferedInputStream is;
-
-    private FileInputStream isFile;
-
-    byte[] ibuf = new byte[4096];
-
-    public String fileString = "Test_All_Tests\nTest_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\nTest_java_io_File\nTest_java_io_FileDescriptor\nTest_java_io_FileInputStream\nTest_java_io_FileNotFoundException\nTest_java_io_FileOutputStream\nTest_java_io_FilterInputStream\nTest_java_io_FilterOutputStream\nTest_java_io_InputStream\nTest_java_io_IOException\nTest_java_io_OutputStream\nTest_java_io_PrintStream\nTest_java_io_RandomAccessFile\nTest_java_io_SyncFailedException\nTest_java_lang_AbstractMethodError\nTest_java_lang_ArithmeticException\nTest_java_lang_ArrayIndexOutOfBoundsException\nTest_java_lang_ArrayStoreException\nTest_java_lang_Boolean\nTest_java_lang_Byte\nTest_java_lang_Character\nTest_java_lang_Class\nTest_java_lang_ClassCastException\nTest_java_lang_ClassCircularityError\nTest_java_lang_ClassFormatError\nTest_java_lang_ClassLoader\nTest_java_lang_ClassNotFoundException\nTest_java_lang_CloneNotSupportedException\nTest_java_lang_Double\nTest_java_lang_Error\nTest_java_lang_Exception\nTest_java_lang_ExceptionInInitializerError\nTest_java_lang_Float\nTest_java_lang_IllegalAccessError\nTest_java_lang_IllegalAccessException\nTest_java_lang_IllegalArgumentException\nTest_java_lang_IllegalMonitorStateException\nTest_java_lang_IllegalThreadStateException\nTest_java_lang_IncompatibleClassChangeError\nTest_java_lang_IndexOutOfBoundsException\nTest_java_lang_InstantiationError\nTest_java_lang_InstantiationException\nTest_java_lang_Integer\nTest_java_lang_InternalError\nTest_java_lang_InterruptedException\nTest_java_lang_LinkageError\nTest_java_lang_Long\nTest_java_lang_Math\nTest_java_lang_NegativeArraySizeException\nTest_java_lang_NoClassDefFoundError\nTest_java_lang_NoSuchFieldError\nTest_java_lang_NoSuchMethodError\nTest_java_lang_NullPointerException\nTest_java_lang_Number\nTest_java_lang_NumberFormatException\nTest_java_lang_Object\nTest_java_lang_OutOfMemoryError\nTest_java_lang_RuntimeException\nTest_java_lang_SecurityManager\nTest_java_lang_Short\nTest_java_lang_StackOverflowError\nTest_java_lang_String\nTest_java_lang_StringBuffer\nTest_java_lang_StringIndexOutOfBoundsException\nTest_java_lang_System\nTest_java_lang_Thread\nTest_java_lang_ThreadDeath\nTest_java_lang_ThreadGroup\nTest_java_lang_Throwable\nTest_java_lang_UnknownError\nTest_java_lang_UnsatisfiedLinkError\nTest_java_lang_VerifyError\nTest_java_lang_VirtualMachineError\nTest_java_lang_vm_Image\nTest_java_lang_vm_MemorySegment\nTest_java_lang_vm_ROMStoreException\nTest_java_lang_vm_VM\nTest_java_lang_Void\nTest_java_net_BindException\nTest_java_net_ConnectException\nTest_java_net_DatagramPacket\nTest_java_net_DatagramSocket\nTest_java_net_DatagramSocketImpl\nTest_java_net_InetAddress\nTest_java_net_NoRouteToHostException\nTest_java_net_PlainDatagramSocketImpl\nTest_java_net_PlainSocketImpl\nTest_java_net_Socket\nTest_java_net_SocketException\nTest_java_net_SocketImpl\nTest_java_net_SocketInputStream\nTest_java_net_SocketOutputStream\nTest_java_net_UnknownHostException\nTest_java_util_ArrayEnumerator\nTest_java_util_Date\nTest_java_util_EventObject\nTest_java_util_HashEnumerator\nTest_java_util_Hashtable\nTest_java_util_Properties\nTest_java_util_ResourceBundle\nTest_java_util_tm\nTest_java_util_Vector\n";
-
-    /*
-     * @tests java.io.BufferedInputStream(InputStream)
-     */
-    public void test_ConstructorLjava_io_InputStream() {
-        try {
-            BufferedInputStream str = new BufferedInputStream(null);
-            str.read();
-            fail("Expected an IOException");
-        } catch (IOException e) {
-            // Expected
-        }
-    }
-
-    /*
-     * @tests java.io.BufferedInputStream(InputStream)
-     */
-    public void test_ConstructorLjava_io_InputStreamI() throws IOException {
-        try {
-            BufferedInputStream str = new BufferedInputStream(null, 1);
-            str.read();
-            fail("Expected an IOException");
-        } catch (IOException e) {
-            // Expected
-        }
-
-        // Test for method java.io.BufferedInputStream(java.io.InputStream, int)
-
-        // Create buffer with exact size of file
-        is = new BufferedInputStream(isFile, this.fileString.length());
-        // Ensure buffer gets filled by evaluating one read
-        is.read();
-        // Close underlying FileInputStream, all but 1 buffered bytes should
-        // still be available.
-        isFile.close();
-        // Read the remaining buffered characters, no IOException should
-        // occur.
-        is.skip(this.fileString.length() - 2);
-        is.read();
-        try {
-            // is.read should now throw an exception because it will have to
-            // be filled.
-            is.read();
-            fail("Exception should have been triggered by read()");
-        } catch (IOException e) {
-            // Expected
-        }
-
-        // regression test for harmony-2407
-        new MockBufferedInputStream(null);
-        assertNotNull(MockBufferedInputStream.buf);
-        MockBufferedInputStream.buf = null;
-        new MockBufferedInputStream(null, 100);
-        assertNotNull(MockBufferedInputStream.buf);
-    }
-
-    static class MockBufferedInputStream extends BufferedInputStream {
-        static byte[] buf;
-
-        MockBufferedInputStream(InputStream is) throws IOException {
-            super(is);
-            buf = super.buf;
-        }
-
-        MockBufferedInputStream(InputStream is, int size) throws IOException {
-            super(is, size);
-            buf = super.buf;
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#available()
-     */
-    public void test_available() throws IOException {
-        assertTrue("Returned incorrect number of available bytes", is
-                .available() == fileString.length());
-
-        // Test that a closed stream throws an IOE for available()
-        BufferedInputStream bis = new BufferedInputStream(
-                new ByteArrayInputStream(new byte[] { 'h', 'e', 'l', 'l', 'o',
-                        ' ', 't', 'i', 'm' }));
-        int available = bis.available();
-        bis.close();
-        assertTrue(available != 0);
-
-        try {
-            bis.available();
-            fail("Expected test to throw IOE.");
-        } catch (IOException ex) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#close()
-     */
-    public void test_close() throws IOException {
-        new BufferedInputStream(isFile).close();
-
-        // regression for HARMONY-667
-        BufferedInputStream buf = new BufferedInputStream(null, 5);
-        buf.close();
-
-        InputStream in = new InputStream() {
-            Object lock = new Object();
-
-            @Override
-            public int read() {
-                return 1;
-            }
-
-            @Override
-            public int read(byte[] buf, int offset, int length) {
-                synchronized (lock) {
-                    try {
-                        lock.wait(3000);
-                    } catch (InterruptedException e) {
-                        // Ignore
-                    }
-                }
-                return 1;
-            }
-
-            @Override
-            public void close() {
-                synchronized (lock) {
-                    lock.notifyAll();
-                }
-            }
-        };
-        final BufferedInputStream bufin = new BufferedInputStream(in);
-        Thread thread = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    Thread.sleep(1000);
-                    bufin.close();
-                } catch (Exception e) {
-                    // Ignored
-                }
-            }
-        });
-        thread.start();
-        try {
-            bufin.read(new byte[100], 0, 99);
-            fail("Should throw IOException");
-        } catch (IOException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#mark(int)
-     */
-    public void test_markI() throws IOException {
-        byte[] buf1 = new byte[100];
-        byte[] buf2 = new byte[100];
-        is.skip(3000);
-        is.mark(1000);
-        is.read(buf1, 0, buf1.length);
-        is.reset();
-        is.read(buf2, 0, buf2.length);
-        is.reset();
-        assertTrue("Failed to mark correct position", new String(buf1, 0,
-                buf1.length).equals(new String(buf2, 0, buf2.length)));
-
-        byte[] bytes = new byte[256];
-        for (int i = 0; i < 256; i++) {
-            bytes[i] = (byte) i;
-        }
-        InputStream in = new BufferedInputStream(
-                new ByteArrayInputStream(bytes), 12);
-        in.skip(6);
-        in.mark(14);
-        in.read(new byte[14], 0, 14);
-        in.reset();
-        assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);
-
-        in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12);
-        in.skip(6);
-        in.mark(8);
-        in.skip(7);
-        in.reset();
-        assertTrue("Wrong bytes 2", in.read() == 6 && in.read() == 7);
-
-        BufferedInputStream buf = new BufferedInputStream(
-                new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4 }), 2);
-        buf.mark(3);
-        bytes = new byte[3];
-        int result = buf.read(bytes);
-        assertEquals(3, result);
-        assertEquals("Assert 0:", 0, bytes[0]);
-        assertEquals("Assert 1:", 1, bytes[1]);
-        assertEquals("Assert 2:", 2, bytes[2]);
-        assertEquals("Assert 3:", 3, buf.read());
-
-        buf = new BufferedInputStream(new ByteArrayInputStream(new byte[] { 0,
-                1, 2, 3, 4 }), 2);
-        buf.mark(3);
-        bytes = new byte[4];
-        result = buf.read(bytes);
-        assertEquals(4, result);
-        assertEquals("Assert 4:", 0, bytes[0]);
-        assertEquals("Assert 5:", 1, bytes[1]);
-        assertEquals("Assert 6:", 2, bytes[2]);
-        assertEquals("Assert 7:", 3, bytes[3]);
-        assertEquals("Assert 8:", 4, buf.read());
-        assertEquals("Assert 9:", -1, buf.read());
-
-        buf = new BufferedInputStream(new ByteArrayInputStream(new byte[] { 0,
-                1, 2, 3, 4 }), 2);
-        buf.mark(Integer.MAX_VALUE);
-        buf.read();
-        buf.close();
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#markSupported()
-     */
-    public void test_markSupported() {
-        assertTrue("markSupported returned incorrect value", is.markSupported());
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#read()
-     */
-    public void test_read() throws IOException {
-        InputStreamReader isr = new InputStreamReader(is);
-        int c = isr.read();
-        assertTrue("read returned incorrect char", c == fileString.charAt(0));
-
-        byte[] bytes = new byte[256];
-        for (int i = 0; i < 256; i++) {
-            bytes[i] = (byte) i;
-        }
-        InputStream in = new BufferedInputStream(
-                new ByteArrayInputStream(bytes), 12);
-        assertEquals("Wrong initial byte", 0, in.read()); // Fill the
-        // buffer
-        byte[] buf = new byte[14];
-        in.read(buf, 0, 14); // Read greater than the buffer
-        assertTrue("Wrong block read data", new String(buf, 0, 14)
-                .equals(new String(bytes, 1, 14)));
-        assertEquals("Wrong bytes", 15, in.read()); // Check next byte
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#read(byte[], int, int)
-     */
-    public void test_read$BII_Exception() throws IOException {
-        BufferedInputStream bis = new BufferedInputStream(null);
-        try {
-            bis.read(null, -1, -1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        try {
-            bis.read(new byte[0], -1, -1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            bis.read(new byte[0], 1, -1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            bis.read(new byte[0], 1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        bis.close();
-
-        try {
-            bis.read(null, -1, -1);
-            fail("should throw IOException");
-        } catch (IOException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#read(byte[], int, int)
-     */
-    public void test_read$BII() throws IOException {
-        byte[] buf1 = new byte[100];
-        is.skip(3000);
-        is.mark(1000);
-        is.read(buf1, 0, buf1.length);
-        assertTrue("Failed to read correct data", new String(buf1, 0,
-                buf1.length).equals(fileString.substring(3000, 3100)));
-
-        BufferedInputStream bufin = new BufferedInputStream(new InputStream() {
-            int size = 2, pos = 0;
-
-            byte[] contents = new byte[size];
-
-            @Override
-            public int read() throws IOException {
-                if (pos >= size) {
-                    throw new IOException("Read past end of data");
-                }
-                return contents[pos++];
-            }
-
-            @Override
-            public int read(byte[] buf, int off, int len) throws IOException {
-                if (pos >= size) {
-                    throw new IOException("Read past end of data");
-                }
-                int toRead = len;
-                if (toRead > available()) {
-                    toRead = available();
-                }
-                System.arraycopy(contents, pos, buf, off, toRead);
-                pos += toRead;
-                return toRead;
-            }
-
-            @Override
-            public int available() {
-                return size - pos;
-            }
-        });
-        bufin.read();
-        int result = bufin.read(new byte[2], 0, 2);
-        assertTrue("Incorrect result: " + result, result == 1);
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#reset()
-     */
-    public void test_reset() throws IOException {
-        byte[] buf1 = new byte[10];
-        byte[] buf2 = new byte[10];
-        is.mark(2000);
-        is.read(buf1, 0, 10);
-        is.reset();
-        is.read(buf2, 0, 10);
-        is.reset();
-        assertTrue("Reset failed", new String(buf1, 0, buf1.length)
-                .equals(new String(buf2, 0, buf2.length)));
-
-        BufferedInputStream bIn = new BufferedInputStream(
-                new ByteArrayInputStream("1234567890".getBytes()));
-        bIn.mark(10);
-        for (int i = 0; i < 11; i++) {
-            bIn.read();
-        }
-        bIn.reset();
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#reset()
-     */
-    public void test_reset_Exception() throws IOException {
-        BufferedInputStream bis = new BufferedInputStream(null);
-
-        // throws IOException with message "Mark has been invalidated"
-        try {
-            bis.reset();
-            fail("should throw IOException");
-        } catch (IOException e) {
-            // expected
-        }
-
-        // does not throw IOException
-        bis.mark(1);
-        bis.reset();
-
-        bis.close();
-
-        // throws IOException with message "stream is closed"
-        try {
-            bis.reset();
-            fail("should throw IOException");
-        } catch (IOException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#reset()
-     */
-    public void test_reset_scenario1() throws IOException {
-        byte[] input = "12345678900".getBytes();
-        BufferedInputStream buffis = new BufferedInputStream(
-                new ByteArrayInputStream(input));
-        buffis.read();
-        buffis.mark(5);
-        buffis.skip(5);
-        buffis.reset();
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#reset()
-     */
-    public void test_reset_scenario2() throws IOException {
-        byte[] input = "12345678900".getBytes();
-        BufferedInputStream buffis = new BufferedInputStream(
-                new ByteArrayInputStream(input));
-        buffis.mark(5);
-        buffis.skip(6);
-        buffis.reset();
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#skip(long)
-     */
-    public void test_skipJ() throws IOException {
-        byte[] buf1 = new byte[10];
-        is.mark(2000);
-        is.skip(1000);
-        is.read(buf1, 0, buf1.length);
-        is.reset();
-        assertTrue("Failed to skip to correct position", new String(buf1, 0,
-                buf1.length).equals(fileString.substring(1000, 1010)));
-
-        // regression for HARMONY-667
-        try {
-            BufferedInputStream buf = new BufferedInputStream(null, 5);
-            buf.skip(10);
-            fail("Should throw IOException");
-        } catch (IOException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * @tests java.io.BufferedInputStream#skip(long)
-     */
-    public void test_skip_NullInputStream() throws IOException {
-        BufferedInputStream buf = new BufferedInputStream(null, 5);
-        assertEquals(0, buf.skip(0));
-    }
-
-    /**
-     * Sets up the fixture, for example, open a network connection. This method
-     * is called before a test is executed.
-     */
-    @Override
-    protected void setUp() throws IOException {
-        fileName = System.getProperty("user.dir");
-        String separator = System.getProperty("file.separator");
-        if (fileName.charAt(fileName.length() - 1) == separator.charAt(0)) {
-            fileName = Support_PlatformFile.getNewPlatformFile(fileName,
-                    "input.tst");
-        } else {
-            fileName = Support_PlatformFile.getNewPlatformFile(fileName
-                    + separator, "input.tst");
-        }
-        OutputStream fos = new FileOutputStream(fileName);
-        fos.write(fileString.getBytes());
-        fos.close();
-        isFile = new FileInputStream(fileName);
-        is = new BufferedInputStream(isFile);
-    }
-
-    /**
-     * Tears down the fixture, for example, close a network connection. This
-     * method is called after a test is executed.
-     */
-    @Override
-    protected void tearDown() {
-        try {
-            is.close();
-        } catch (Exception e) {
-        }
-        try {
-            File f = new File(fileName);
-            f.delete();
-        } catch (Exception e) {
-        }
-    }
-}
+/*

+ *  Licensed to the Apache Software Foundation (ASF) under one or more

+ *  contributor license agreements.  See the NOTICE file distributed with

+ *  this work for additional information regarding copyright ownership.

+ *  The ASF licenses this file to You under the Apache License, Version 2.0

+ *  (the "License"); you may not use this file except in compliance with

+ *  the License.  You may obtain a copy of the License at

+ *

+ *     http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ */

+

+package org.apache.harmony.luni.tests.java.io;

+

+import java.io.BufferedInputStream;

+import java.io.ByteArrayInputStream;

+import java.io.File;

+import java.io.FileInputStream;

+import java.io.FileOutputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.InputStreamReader;

+import java.io.OutputStream;

+import junit.framework.TestCase;

+import tests.support.Support_PlatformFile;

+

+public class BufferedInputStreamTest extends TestCase {

+

+    public String fileName;

+

+    private BufferedInputStream is;

+

+    private FileInputStream isFile;

+

+    byte[] ibuf = new byte[4096];

+

+    public String fileString = "Test_All_Tests\nTest_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\nTest_java_io_File\nTest_java_io_FileDescriptor\nTest_java_io_FileInputStream\nTest_java_io_FileNotFoundException\nTest_java_io_FileOutputStream\nTest_java_io_FilterInputStream\nTest_java_io_FilterOutputStream\nTest_java_io_InputStream\nTest_java_io_IOException\nTest_java_io_OutputStream\nTest_java_io_PrintStream\nTest_java_io_RandomAccessFile\nTest_java_io_SyncFailedException\nTest_java_lang_AbstractMethodError\nTest_java_lang_ArithmeticException\nTest_java_lang_ArrayIndexOutOfBoundsException\nTest_java_lang_ArrayStoreException\nTest_java_lang_Boolean\nTest_java_lang_Byte\nTest_java_lang_Character\nTest_java_lang_Class\nTest_java_lang_ClassCastException\nTest_java_lang_ClassCircularityError\nTest_java_lang_ClassFormatError\nTest_java_lang_ClassLoader\nTest_java_lang_ClassNotFoundException\nTest_java_lang_CloneNotSupportedException\nTest_java_lang_Double\nTest_java_lang_Error\nTest_java_lang_Exception\nTest_java_lang_ExceptionInInitializerError\nTest_java_lang_Float\nTest_java_lang_IllegalAccessError\nTest_java_lang_IllegalAccessException\nTest_java_lang_IllegalArgumentException\nTest_java_lang_IllegalMonitorStateException\nTest_java_lang_IllegalThreadStateException\nTest_java_lang_IncompatibleClassChangeError\nTest_java_lang_IndexOutOfBoundsException\nTest_java_lang_InstantiationError\nTest_java_lang_InstantiationException\nTest_java_lang_Integer\nTest_java_lang_InternalError\nTest_java_lang_InterruptedException\nTest_java_lang_LinkageError\nTest_java_lang_Long\nTest_java_lang_Math\nTest_java_lang_NegativeArraySizeException\nTest_java_lang_NoClassDefFoundError\nTest_java_lang_NoSuchFieldError\nTest_java_lang_NoSuchMethodError\nTest_java_lang_NullPointerException\nTest_java_lang_Number\nTest_java_lang_NumberFormatException\nTest_java_lang_Object\nTest_java_lang_OutOfMemoryError\nTest_java_lang_RuntimeException\nTest_java_lang_SecurityManager\nTest_java_lang_Short\nTest_java_lang_StackOverflowError\nTest_java_lang_String\nTest_java_lang_StringBuffer\nTest_java_lang_StringIndexOutOfBoundsException\nTest_java_lang_System\nTest_java_lang_Thread\nTest_java_lang_ThreadDeath\nTest_java_lang_ThreadGroup\nTest_java_lang_Throwable\nTest_java_lang_UnknownError\nTest_java_lang_UnsatisfiedLinkError\nTest_java_lang_VerifyError\nTest_java_lang_VirtualMachineError\nTest_java_lang_vm_Image\nTest_java_lang_vm_MemorySegment\nTest_java_lang_vm_ROMStoreException\nTest_java_lang_vm_VM\nTest_java_lang_Void\nTest_java_net_BindException\nTest_java_net_ConnectException\nTest_java_net_DatagramPacket\nTest_java_net_DatagramSocket\nTest_java_net_DatagramSocketImpl\nTest_java_net_InetAddress\nTest_java_net_NoRouteToHostException\nTest_java_net_PlainDatagramSocketImpl\nTest_java_net_PlainSocketImpl\nTest_java_net_Socket\nTest_java_net_SocketException\nTest_java_net_SocketImpl\nTest_java_net_SocketInputStream\nTest_java_net_SocketOutputStream\nTest_java_net_UnknownHostException\nTest_java_util_ArrayEnumerator\nTest_java_util_Date\nTest_java_util_EventObject\nTest_java_util_HashEnumerator\nTest_java_util_Hashtable\nTest_java_util_Properties\nTest_java_util_ResourceBundle\nTest_java_util_tm\nTest_java_util_Vector\n";

+

+    /*

+     * @tests java.io.BufferedInputStream(InputStream)

+     */

+    public void test_ConstructorLjava_io_InputStream() {

+        try {

+            BufferedInputStream str = new BufferedInputStream(null);

+            str.read();

+            fail("Expected an IOException");

+        } catch (IOException e) {

+            // Expected

+        }

+    }

+

+    /*

+     * @tests java.io.BufferedInputStream(InputStream)

+     */

+    public void test_ConstructorLjava_io_InputStreamI() throws IOException {

+        try {

+            BufferedInputStream str = new BufferedInputStream(null, 1);

+            str.read();

+            fail("Expected an IOException");

+        } catch (IOException e) {

+            // Expected

+        }

+

+        // Test for method java.io.BufferedInputStream(java.io.InputStream, int)

+

+        // Create buffer with exact size of file

+        is = new BufferedInputStream(isFile, this.fileString.length());

+        // Ensure buffer gets filled by evaluating one read

+        is.read();

+        // Close underlying FileInputStream, all but 1 buffered bytes should

+        // still be available.

+        isFile.close();

+        // Read the remaining buffered characters, no IOException should

+        // occur.

+        is.skip(this.fileString.length() - 2);

+        is.read();

+        try {

+            // is.read should now throw an exception because it will have to

+            // be filled.

+            is.read();

+            fail("Exception should have been triggered by read()");

+        } catch (IOException e) {

+            // Expected

+        }

+

+        // regression test for harmony-2407

+        new MockBufferedInputStream(null);

+        assertNotNull(MockBufferedInputStream.buf);

+        MockBufferedInputStream.buf = null;

+        new MockBufferedInputStream(null, 100);

+        assertNotNull(MockBufferedInputStream.buf);

+    }

+

+    static class MockBufferedInputStream extends BufferedInputStream {

+        static byte[] buf;

+

+        MockBufferedInputStream(InputStream is) throws IOException {

+            super(is);

+            buf = super.buf;

+        }

+

+        MockBufferedInputStream(InputStream is, int size) throws IOException {

+            super(is, size);

+            buf = super.buf;

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#available()

+     */

+    public void test_available() throws IOException {

+        assertTrue("Returned incorrect number of available bytes", is

+                .available() == fileString.length());

+

+        // Test that a closed stream throws an IOE for available()

+        BufferedInputStream bis = new BufferedInputStream(

+                new ByteArrayInputStream(new byte[] { 'h', 'e', 'l', 'l', 'o',

+                        ' ', 't', 'i', 'm' }));

+        int available = bis.available();

+        bis.close();

+        assertTrue(available != 0);

+

+        try {

+            bis.available();

+            fail("Expected test to throw IOE.");

+        } catch (IOException ex) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#close()

+     */

+    public void test_close() throws IOException {

+        new BufferedInputStream(isFile).close();

+

+        // regression for HARMONY-667

+        BufferedInputStream buf = new BufferedInputStream(null, 5);

+        buf.close();

+

+        InputStream in = new InputStream() {

+            Object lock = new Object();

+

+            @Override

+            public int read() {

+                return 1;

+            }

+

+            @Override

+            public int read(byte[] buf, int offset, int length) {

+                synchronized (lock) {

+                    try {

+                        lock.wait(3000);

+                    } catch (InterruptedException e) {

+                        // Ignore

+                    }

+                }

+                return 1;

+            }

+

+            @Override

+            public void close() {

+                synchronized (lock) {

+                    lock.notifyAll();

+                }

+            }

+        };

+        final BufferedInputStream bufin = new BufferedInputStream(in);

+        Thread thread = new Thread(new Runnable() {

+            public void run() {

+                try {

+                    Thread.sleep(1000);

+                    bufin.close();

+                } catch (Exception e) {

+                    // Ignored

+                }

+            }

+        });

+        thread.start();

+        try {

+            bufin.read(new byte[100], 0, 99);

+            fail("Should throw IOException");

+        } catch (IOException e) {

+            // Expected

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#mark(int)

+     */

+    public void test_markI() throws IOException {

+        byte[] buf1 = new byte[100];

+        byte[] buf2 = new byte[100];

+        is.skip(3000);

+        is.mark(1000);

+        is.read(buf1, 0, buf1.length);

+        is.reset();

+        is.read(buf2, 0, buf2.length);

+        is.reset();

+        assertTrue("Failed to mark correct position", new String(buf1, 0,

+                buf1.length).equals(new String(buf2, 0, buf2.length)));

+

+        byte[] bytes = new byte[256];

+        for (int i = 0; i < 256; i++) {

+            bytes[i] = (byte) i;

+        }

+        InputStream in = new BufferedInputStream(

+                new ByteArrayInputStream(bytes), 12);

+        in.skip(6);

+        in.mark(14);

+        in.read(new byte[14], 0, 14);

+        in.reset();

+        assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);

+

+        in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12);

+        in.skip(6);

+        in.mark(8);

+        in.skip(7);

+        in.reset();

+        assertTrue("Wrong bytes 2", in.read() == 6 && in.read() == 7);

+

+        BufferedInputStream buf = new BufferedInputStream(

+                new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4 }), 2);

+        buf.mark(3);

+        bytes = new byte[3];

+        int result = buf.read(bytes);

+        assertEquals(3, result);

+        assertEquals("Assert 0:", 0, bytes[0]);

+        assertEquals("Assert 1:", 1, bytes[1]);

+        assertEquals("Assert 2:", 2, bytes[2]);

+        assertEquals("Assert 3:", 3, buf.read());

+

+        buf = new BufferedInputStream(new ByteArrayInputStream(new byte[] { 0,

+                1, 2, 3, 4 }), 2);

+        buf.mark(3);

+        bytes = new byte[4];

+        result = buf.read(bytes);

+        assertEquals(4, result);

+        assertEquals("Assert 4:", 0, bytes[0]);

+        assertEquals("Assert 5:", 1, bytes[1]);

+        assertEquals("Assert 6:", 2, bytes[2]);

+        assertEquals("Assert 7:", 3, bytes[3]);

+        assertEquals("Assert 8:", 4, buf.read());

+        assertEquals("Assert 9:", -1, buf.read());

+

+        buf = new BufferedInputStream(new ByteArrayInputStream(new byte[] { 0,

+                1, 2, 3, 4 }), 2);

+        buf.mark(Integer.MAX_VALUE);

+        buf.read();

+        buf.close();

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#markSupported()

+     */

+    public void test_markSupported() {

+        assertTrue("markSupported returned incorrect value", is.markSupported());

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#read()

+     */

+    public void test_read() throws IOException {

+        InputStreamReader isr = new InputStreamReader(is);

+        int c = isr.read();

+        assertTrue("read returned incorrect char", c == fileString.charAt(0));

+

+        byte[] bytes = new byte[256];

+        for (int i = 0; i < 256; i++) {

+            bytes[i] = (byte) i;

+        }

+        InputStream in = new BufferedInputStream(

+                new ByteArrayInputStream(bytes), 12);

+        assertEquals("Wrong initial byte", 0, in.read()); // Fill the

+        // buffer

+        byte[] buf = new byte[14];

+        in.read(buf, 0, 14); // Read greater than the buffer

+        assertTrue("Wrong block read data", new String(buf, 0, 14)

+                .equals(new String(bytes, 1, 14)));

+        assertEquals("Wrong bytes", 15, in.read()); // Check next byte

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#read(byte[], int, int)

+     */

+    public void test_read$BII_Exception() throws IOException {

+        BufferedInputStream bis = new BufferedInputStream(null);

+        try {

+            bis.read(null, -1, -1);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e) {

+            // expected

+        }

+

+        try {

+            bis.read(new byte[0], -1, -1);

+            fail("should throw IndexOutOfBoundsException");

+        } catch (IndexOutOfBoundsException e) {

+            // expected

+        }

+

+        try {

+            bis.read(new byte[0], 1, -1);

+            fail("should throw IndexOutOfBoundsException");

+        } catch (IndexOutOfBoundsException e) {

+            // expected

+        }

+

+        try {

+            bis.read(new byte[0], 1, 1);

+            fail("should throw IndexOutOfBoundsException");

+        } catch (IndexOutOfBoundsException e) {

+            // expected

+        }

+

+        bis.close();

+

+        try {

+            bis.read(null, -1, -1);

+            fail("should throw IOException");

+        } catch (IOException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#read(byte[], int, int)

+     */

+    public void test_read$BII() throws IOException {

+        byte[] buf1 = new byte[100];

+        is.skip(3000);

+        is.mark(1000);

+        is.read(buf1, 0, buf1.length);

+        assertTrue("Failed to read correct data", new String(buf1, 0,

+                buf1.length).equals(fileString.substring(3000, 3100)));

+

+        BufferedInputStream bufin = new BufferedInputStream(new InputStream() {

+            int size = 2, pos = 0;

+

+            byte[] contents = new byte[size];

+

+            @Override

+            public int read() throws IOException {

+                if (pos >= size) {

+                    throw new IOException("Read past end of data");

+                }

+                return contents[pos++];

+            }

+

+            @Override

+            public int read(byte[] buf, int off, int len) throws IOException {

+                if (pos >= size) {

+                    throw new IOException("Read past end of data");

+                }

+                int toRead = len;

+                if (toRead > available()) {

+                    toRead = available();

+                }

+                System.arraycopy(contents, pos, buf, off, toRead);

+                pos += toRead;

+                return toRead;

+            }

+

+            @Override

+            public int available() {

+                return size - pos;

+            }

+        });

+        bufin.read();

+        int result = bufin.read(new byte[2], 0, 2);

+        assertTrue("Incorrect result: " + result, result == 1);

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#reset()

+     */

+    public void test_reset() throws IOException {

+        byte[] buf1 = new byte[10];

+        byte[] buf2 = new byte[10];

+        is.mark(2000);

+        is.read(buf1, 0, 10);

+        is.reset();

+        is.read(buf2, 0, 10);

+        is.reset();

+        assertTrue("Reset failed", new String(buf1, 0, buf1.length)

+                .equals(new String(buf2, 0, buf2.length)));

+

+        BufferedInputStream bIn = new BufferedInputStream(

+                new ByteArrayInputStream("1234567890".getBytes()));

+        bIn.mark(10);

+        for (int i = 0; i < 11; i++) {

+            bIn.read();

+        }

+        bIn.reset();

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#reset()

+     */

+    public void test_reset_Exception() throws IOException {

+        BufferedInputStream bis = new BufferedInputStream(null);

+

+        // throws IOException with message "Mark has been invalidated"

+        try {

+            bis.reset();

+            fail("should throw IOException");

+        } catch (IOException e) {

+            // expected

+        }

+

+        // does not throw IOException

+        bis.mark(1);

+        bis.reset();

+

+        bis.close();

+

+        // throws IOException with message "stream is closed"

+        try {

+            bis.reset();

+            fail("should throw IOException");

+        } catch (IOException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#reset()

+     */

+    public void test_reset_scenario1() throws IOException {

+        byte[] input = "12345678900".getBytes();

+        BufferedInputStream buffis = new BufferedInputStream(

+                new ByteArrayInputStream(input));

+        buffis.read();

+        buffis.mark(5);

+        buffis.skip(5);

+        buffis.reset();

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#reset()

+     */

+    public void test_reset_scenario2() throws IOException {

+        byte[] input = "12345678900".getBytes();

+        BufferedInputStream buffis = new BufferedInputStream(

+                new ByteArrayInputStream(input));

+        buffis.mark(5);

+        buffis.skip(6);

+        buffis.reset();

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#skip(long)

+     */

+    public void test_skipJ() throws IOException {

+        byte[] buf1 = new byte[10];

+        is.mark(2000);

+        is.skip(1000);

+        is.read(buf1, 0, buf1.length);

+        is.reset();

+        assertTrue("Failed to skip to correct position", new String(buf1, 0,

+                buf1.length).equals(fileString.substring(1000, 1010)));

+

+        // regression for HARMONY-667

+        try {

+            BufferedInputStream buf = new BufferedInputStream(null, 5);

+            buf.skip(10);

+            fail("Should throw IOException");

+        } catch (IOException e) {

+            // Expected

+        }

+    }

+

+    /**

+     * @tests java.io.BufferedInputStream#skip(long)

+     */

+    public void test_skip_NullInputStream() throws IOException {

+        BufferedInputStream buf = new BufferedInputStream(null, 5);

+        assertEquals(0, buf.skip(0));

+    }

+

+    /**

+     * Sets up the fixture, for example, open a network connection. This method

+     * is called before a test is executed.

+     */

+    @Override

+    protected void setUp() throws IOException {

+        fileName = System.getProperty("user.dir");

+        String separator = System.getProperty("file.separator");

+        if (fileName.charAt(fileName.length() - 1) == separator.charAt(0)) {

+            fileName = Support_PlatformFile.getNewPlatformFile(fileName,

+                    "input.tst");

+        } else {

+            fileName = Support_PlatformFile.getNewPlatformFile(fileName

+                    + separator, "input.tst");

+        }

+        OutputStream fos = new FileOutputStream(fileName);

+        fos.write(fileString.getBytes());

+        fos.close();

+        isFile = new FileInputStream(fileName);

+        is = new BufferedInputStream(isFile);

+    }

+

+    /**

+     * Tears down the fixture, for example, close a network connection. This

+     * method is called after a test is executed.

+     */

+    @Override

+    protected void tearDown() {

+        try {

+            is.close();

+        } catch (Exception e) {

+        }

+        try {

+            File f = new File(fileName);

+            f.delete();

+        } catch (Exception e) {

+        }

+    }

+}

diff --git a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLEncoderTest.java b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLEncoderTest.java
index 67a81cf..09ab006 100644
--- a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLEncoderTest.java
+++ b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLEncoderTest.java
@@ -1,67 +1,67 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.net;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-
-import junit.framework.TestCase;
-import tests.support.Support_Configuration;
-
-public class URLEncoderTest extends TestCase {
-
-    /**
-     * @tests java.net.URLEncoder#encode(java.lang.String)
-     */
-    @SuppressWarnings("deprecation")
-    public void test_encodeLjava_lang_String() {
-        final String URL = "http://" + Support_Configuration.HomeAddress;
-        final String URL2 = "telnet://justWantToHaveFun.com:400";
-        final String URL3 = "file://myServer.org/a file with spaces.jpg";
-
-        assertTrue("1. Incorrect encoding/decoding", URLDecoder.decode(
-                URLEncoder.encode(URL)).equals(URL));
-        assertTrue("2. Incorrect encoding/decoding", URLDecoder.decode(
-                URLEncoder.encode(URL2)).equals(URL2));
-        assertTrue("3. Incorrect encoding/decoding", URLDecoder.decode(
-                URLEncoder.encode(URL3)).equals(URL3));
-    }
-
-    /**
-     * @tests URLEncoder#encode(String, String)
-     */
-    public void test_encodeLjava_lang_StringLjava_lang_String()
-            throws Exception {
-        // Regression for HARMONY-24
-        try {
-            URLEncoder.encode("str", "unknown_enc");
-            fail("Assert 0: Should throw UEE for invalid encoding");
-        } catch (UnsupportedEncodingException e) {
-            // expected
-        }
-
-        // Regression for HARMONY-1233
-        try {
-            URLEncoder.encode(null, "harmony");
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-}
+/*

+ *  Licensed to the Apache Software Foundation (ASF) under one or more

+ *  contributor license agreements.  See the NOTICE file distributed with

+ *  this work for additional information regarding copyright ownership.

+ *  The ASF licenses this file to You under the Apache License, Version 2.0

+ *  (the "License"); you may not use this file except in compliance with

+ *  the License.  You may obtain a copy of the License at

+ *

+ *     http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ */

+

+package org.apache.harmony.luni.tests.java.net;

+

+import java.io.UnsupportedEncodingException;

+import java.net.URLDecoder;

+import java.net.URLEncoder;

+

+import junit.framework.TestCase;

+import tests.support.Support_Configuration;

+

+public class URLEncoderTest extends TestCase {

+

+    /**

+     * @tests java.net.URLEncoder#encode(java.lang.String)

+     */

+    @SuppressWarnings("deprecation")

+    public void test_encodeLjava_lang_String() {

+        final String URL = "http://" + Support_Configuration.HomeAddress;

+        final String URL2 = "telnet://justWantToHaveFun.com:400";

+        final String URL3 = "file://myServer.org/a file with spaces.jpg";

+

+        assertTrue("1. Incorrect encoding/decoding", URLDecoder.decode(

+                URLEncoder.encode(URL)).equals(URL));

+        assertTrue("2. Incorrect encoding/decoding", URLDecoder.decode(

+                URLEncoder.encode(URL2)).equals(URL2));

+        assertTrue("3. Incorrect encoding/decoding", URLDecoder.decode(

+                URLEncoder.encode(URL3)).equals(URL3));

+    }

+

+    /**

+     * @tests URLEncoder#encode(String, String)

+     */

+    public void test_encodeLjava_lang_StringLjava_lang_String()

+            throws Exception {

+        // Regression for HARMONY-24

+        try {

+            URLEncoder.encode("str", "unknown_enc");

+            fail("Assert 0: Should throw UEE for invalid encoding");

+        } catch (UnsupportedEncodingException e) {

+            // expected

+        }

+

+        // Regression for HARMONY-1233

+        try {

+            URLEncoder.encode(null, "harmony");

+            fail("NullPointerException expected");

+        } catch (NullPointerException e) {

+            // expected

+        }

+    }

+}

diff --git a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java
index 5468914..31d1368 100644
--- a/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java
+++ b/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java
@@ -1,4333 +1,4333 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.luni.tests.java.util;
-
-import java.io.BufferedOutputStream;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilePermission;
-import java.io.Flushable;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.math.MathContext;
-import java.nio.charset.Charset;
-import java.security.Permission;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.DuplicateFormatFlagsException;
-import java.util.FormatFlagsConversionMismatchException;
-import java.util.Formattable;
-import java.util.FormattableFlags;
-import java.util.Formatter;
-import java.util.FormatterClosedException;
-import java.util.IllegalFormatCodePointException;
-import java.util.IllegalFormatConversionException;
-import java.util.IllegalFormatException;
-import java.util.IllegalFormatFlagsException;
-import java.util.IllegalFormatPrecisionException;
-import java.util.IllegalFormatWidthException;
-import java.util.Locale;
-import java.util.MissingFormatArgumentException;
-import java.util.MissingFormatWidthException;
-import java.util.TimeZone;
-import java.util.UnknownFormatConversionException;
-import java.util.Formatter.BigDecimalLayoutForm;
-
-import junit.framework.TestCase;
-
-public class FormatterTest extends TestCase {
-	private boolean root;
-
-    class MockAppendable implements Appendable {
-        public Appendable append(CharSequence arg0) throws IOException {
-            return null;
-        }
-
-        public Appendable append(char arg0) throws IOException {
-            return null;
-        }
-
-        public Appendable append(CharSequence arg0, int arg1, int arg2)
-                throws IOException {
-            return null;
-        }
-    }
-
-    class MockSecurityManager extends SecurityManager {
-        public void checkPermission(Permission p) {
-            if (p.getActions().equals("write") && p instanceof FilePermission) {
-                throw new SecurityException("Always throw security exception");
-            }
-        }
-
-        public void checkPermission(Permission p, Object ctx) {
-            checkPermission(p);
-        }
-    }
-
-    class MockFormattable implements Formattable {
-        public void formatTo(Formatter formatter, int flags, int width,
-                int precision) throws IllegalFormatException {
-            if ((flags & FormattableFlags.UPPERCASE) != 0) {
-                formatter.format("CUSTOMIZED FORMAT FUNCTION" + " WIDTH: "
-                        + width + " PRECISION: " + precision);
-            } else {
-                formatter.format("customized format function" + " width: "
-                        + width + " precision: " + precision);
-            }
-        }
-
-        public String toString() {
-            return "formattable object";
-        }
-
-        public int hashCode() {
-            return 0xf;
-        }
-    }
-
-    class MockDestination implements Appendable, Flushable {
-
-        private StringBuilder data = new StringBuilder();
-
-        private boolean enabled = false;
-
-        public Appendable append(char c) throws IOException {
-            if (enabled) {
-                data.append(c);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public Appendable append(CharSequence csq) throws IOException {
-            if (enabled) {
-                data.append(csq);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public Appendable append(CharSequence csq, int start, int end)
-                throws IOException {
-            if (enabled) {
-                data.append(csq, start, end);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public void flush() throws IOException {
-            throw new IOException("Always throw IOException");
-        }
-
-        public String toString() {
-            return data.toString();
-        }
-    }
-
-    private File notExist;
-
-    private File fileWithContent;
-
-    private File readOnly;
-
-    private File secret;
-    
-    private TimeZone defaultTimeZone;
-
-    /**
-     * @tests java.util.Formatter#Formatter()
-     */
-    public void test_Constructor() {
-        Formatter f = new Formatter();
-        assertNotNull(f);
-        assertTrue(f.out() instanceof StringBuilder);
-        assertEquals(f.locale(), Locale.getDefault());
-        assertNotNull(f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Appendable)
-     */
-    public void test_ConstructorLjava_lang_Appendable() {
-        MockAppendable ma = new MockAppendable();
-        Formatter f1 = new Formatter(ma);
-        assertEquals(ma, f1.out());
-        assertEquals(f1.locale(), Locale.getDefault());
-        assertNotNull(f1.toString());
-
-        Formatter f2 = new Formatter((Appendable) null);
-        /*
-         * If a(the input param) is null then a StringBuilder will be created
-         * and the output can be attained by invoking the out() method. But RI
-         * raises an error of FormatterClosedException when invoking out() or
-         * toString().
-         */
-        Appendable sb = f2.out();
-        assertTrue(sb instanceof StringBuilder);
-        assertNotNull(f2.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Locale)
-     */
-    public void test_ConstructorLjava_util_Locale() {
-        Formatter f1 = new Formatter(Locale.FRANCE);
-        assertTrue(f1.out() instanceof StringBuilder);
-        assertEquals(f1.locale(), Locale.FRANCE);
-        assertNotNull(f1.toString());
-
-        Formatter f2 = new Formatter((Locale) null);
-        assertNull(f2.locale());
-        assertTrue(f2.out() instanceof StringBuilder);
-        assertNotNull(f2.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Appendable, Locale)
-     */
-    public void test_ConstructorLjava_lang_AppendableLjava_util_Locale() {
-        MockAppendable ma = new MockAppendable();
-        Formatter f1 = new Formatter(ma, Locale.CANADA);
-        assertEquals(ma, f1.out());
-        assertEquals(f1.locale(), Locale.CANADA);
-
-        Formatter f2 = new Formatter(ma, null);
-        assertNull(f2.locale());
-        assertEquals(ma, f1.out());
-
-        Formatter f3 = new Formatter(null, Locale.GERMAN);
-        assertEquals(f3.locale(), Locale.GERMAN);
-        assertTrue(f3.out() instanceof StringBuilder);
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String)
-     */
-    public void test_ConstructorLjava_lang_String() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent.getPath());
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath());
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath());
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String, String)
-     */
-    public void test_ConstructorLjava_lang_StringLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null, Charset.defaultCharset().name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist.getPath(), null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        try {
-            f = new Formatter(notExist.getPath(), "ISO 1111-1");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE");
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), "UTF-16BE");
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(), "UTF-16BE");
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String, String, Locale)
-     */
-    public void test_ConstructorLjava_lang_StringLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null, Charset.defaultCharset().name(),
-                    Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist.getPath(), null, Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),
-                null);
-        assertNotNull(f);
-        f.close();
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),
-                Locale.KOREA);
-        assertEquals(f.locale(), Locale.KOREA);
-        f.close();
-
-        try {
-            f = new Formatter(notExist.getPath(), "ISO 1111-1", Locale.CHINA);
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",
-                Locale.CANADA_FRENCH);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                        .name(), Locale.ITALY);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-        
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(),
-                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File)
-     */
-    public void test_ConstructorLjava_io_File() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist);
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-        
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File, String)
-     */
-    public void test_ConstructorLjava_io_FileLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null, Charset.defaultCharset().name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist, Charset.defaultCharset().name());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent, "UTF-16BE");
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly, Charset.defaultCharset().name());
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret, Charset.defaultCharset().name());
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-
-        try {
-            f = new Formatter(notExist, null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            if (notExist.exists()) {
-                // Fail on RI on Windows, because output stream is created and
-                // not closed when exception thrown
-                assertTrue(notExist.delete());
-            }
-        }
-
-        try {
-            f = new Formatter(notExist, "ISO 1111-1");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        } finally {
-            if (notExist.exists()) {
-                // Fail on RI on Windows, because output stream is created and
-                // not closed when exception thrown
-                assertTrue(notExist.delete());
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File, String, Locale)
-     */
-    public void test_ConstructorLjava_io_FileLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null, Charset.defaultCharset().name(),
-                    Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist, null, Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist, Charset.defaultCharset().name(), null);
-        assertNotNull(f);
-        f.close();
-
-        f = new Formatter(notExist, Charset.defaultCharset().name(),
-                Locale.KOREA);
-        assertEquals(f.locale(), Locale.KOREA);
-        f.close();
-
-        try {
-            f = new Formatter(notExist, "ISO 1111-1", Locale.CHINA);
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",
-                Locale.CANADA_FRENCH);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                        .name(), Locale.ITALY);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(),
-                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(PrintStream)
-     */
-    public void test_ConstructorLjava_io_PrintStream() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((PrintStream) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        PrintStream ps = new PrintStream(notExist, "UTF-16BE");
-        f = new Formatter(ps);
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(OutputStream)
-     */
-    public void test_ConstructorLjava_io_OutputStream() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = new FileOutputStream(notExist);
-        f = new Formatter(os);
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(OutputStream, String)
-     */
-    public void test_ConstructorLjava_io_OutputStreamLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null, Charset.defaultCharset()
-                    .name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = null;
-        try {
-            os = new FileOutputStream(notExist);
-            f = new Formatter(os, null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        try {
-            os = new PipedOutputStream();
-            f = new Formatter(os, "TMP-1111");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        os = new FileOutputStream(fileWithContent);
-        f = new Formatter(os, "UTF-16BE");
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * Test method for 'java.util.Formatter.Formatter(OutputStream, String,
-     * Locale)
-     */
-    public void test_ConstructorLjava_io_OutputStreamLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null, Charset.defaultCharset()
-                    .name(), Locale.getDefault());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = null;
-        try {
-            os = new FileOutputStream(notExist);
-            f = new Formatter(os, null, Locale.getDefault());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        os = new FileOutputStream(notExist);
-        f = new Formatter(os, Charset.defaultCharset().name(), null);
-        f.close();
-
-        try {
-            os = new PipedOutputStream();
-            f = new Formatter(os, "TMP-1111", Locale.getDefault());
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        os = new FileOutputStream(fileWithContent);
-        f = new Formatter(os, "UTF-16BE", Locale.ENGLISH);
-        assertEquals(Locale.ENGLISH, f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#locale()
-     */
-    public void test_locale() {
-        Formatter f = null;
-        f = new Formatter((Locale) null);
-        assertNull(f.locale());
-
-        f.close();
-        try {
-            f.locale();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#out()
-     */
-    public void test_out() {
-        Formatter f = null;
-        f = new Formatter();
-        assertNotNull(f.out());
-        assertTrue(f.out() instanceof StringBuilder);
-        f.close();
-        try {
-            f.out();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-
-    }
-
-    /**
-     * @tests java.util.Formatter#flush()
-     */
-    public void test_flush() throws IOException {
-        Formatter f = null;
-        f = new Formatter(notExist);
-        assertTrue(f instanceof Flushable);
-        f.close();
-        try {
-            f.flush();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        // For destination that does not implement Flushable
-        // No exception should be thrown
-        f.flush();
-    }
-
-    /**
-     * @tests java.util.Formatter#close()
-     */
-    public void test_close() throws IOException {
-        Formatter f = new Formatter(notExist);
-        assertTrue(f instanceof Closeable);
-        f.close();
-        // close next time will not throw exception
-        f.close();
-        assertNull(f.ioException());
-    }
-
-    /**
-     * @tests java.util.Formatter#toString()
-     */
-    public void test_toString() {
-        Formatter f = new Formatter();
-        assertNotNull(f.toString());
-        assertEquals(f.out().toString(), f.toString());
-        f.close();
-        try {
-            f.toString();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#ioException()
-     */
-    public void test_ioException() throws IOException {
-        Formatter f = null;
-        f = new Formatter(new MockDestination());
-        assertNull(f.ioException());
-        f.flush();
-        assertNotNull(f.ioException());
-        f.close();
-
-        MockDestination md = new MockDestination();
-        f = new Formatter(md);
-        f.format("%s%s", "1", "2");
-        // format stop working after IOException
-        assertNotNull(f.ioException());
-        assertEquals("", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null parameter
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_null() {
-        Formatter f = new Formatter();
-        try {
-            f.format((String) null, "parameter");
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        f.format("hello", (Object[]) null);
-        assertEquals("hello", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for argument index
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex() {
-        Formatter formatter = new Formatter(Locale.US);
-        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%11$s%10$s", "1",
-                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
-        assertEquals("1234567891110", formatter.toString());
-
-        formatter = new Formatter(Locale.JAPAN);
-        formatter.format("%0$s", "hello");
-        assertEquals("hello", formatter.toString());
-
-        try {
-            formatter = new Formatter(Locale.US);
-            formatter.format("%-1$s", "1", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            formatter = new Formatter(Locale.US);
-            formatter.format("%$s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-        
-        try {
-            Formatter f = new Formatter(Locale.US);
-            f.format("%", "string");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }       
-
-        formatter = new Formatter(Locale.FRANCE);
-        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%<s%s%s%<s", "1",
-                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
-        assertEquals("123456788122", formatter.toString());
-
-        formatter = new Formatter(Locale.FRANCE);
-        formatter.format(
-                "xx%1$s22%2$s%s%<s%5$s%<s&%7$h%2$s%8$s%<s%s%s%<ssuffix", "1",
-                "2", "3", "4", "5", "6", 7, "8", "9", "10", "11");
-        assertEquals("xx12221155&7288233suffix", formatter.toString());
-
-        try {
-            formatter.format("%<s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            formatter.format("%123$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            // 2147483648 is the value of Integer.MAX_VALUE + 1
-            formatter.format("%2147483648$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        try {
-            // 2147483647 is the value of Integer.MAX_VALUE
-            formatter.format("%2147483647$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            formatter.format("%s%s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        formatter.format("$100", 100);
-        assertEquals("$100", formatter.toString());
-
-        formatter = new Formatter(Locale.UK);
-        formatter.format("%01$s", "string");
-        assertEquals("string", formatter.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for width
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Width() {
-        Formatter f = new Formatter(Locale.US);
-        f.format("%1$8s", "1");
-        assertEquals("       1", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%1$-1%", "string");
-        assertEquals("%", f.toString());
-
-        f = new Formatter(Locale.ITALY);
-        // 2147483648 is the value of Integer.MAX_VALUE + 1
-        f.format("%2147483648s", "string");
-        assertEquals("string", f.toString());
-
-        // the value of Integer.MAX_VALUE will allocate about 4G bytes of
-        // memory.
-        // It may cause OutOfMemoryError, so this value is not tested
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for precision
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Precision() {
-        Formatter f = new Formatter(Locale.US);
-        f.format("%.5s", "123456");
-        assertEquals("12345", f.toString());
-
-        f = new Formatter(Locale.US);
-        // 2147483648 is the value of Integer.MAX_VALUE + 1
-        f.format("%.2147483648s", "...");
-        assertEquals("...", f.toString());
-
-        // the value of Integer.MAX_VALUE will allocate about 4G bytes of
-        // memory.
-        // It may cause OutOfMemoryError, so this value is not tested
-
-        f = new Formatter(Locale.US);
-        f.format("%10.0b", Boolean.TRUE);
-        assertEquals("          ", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%10.01s", "hello");
-        assertEquals("         h", f.toString());
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%.s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%.-5s", "123456");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%1.s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%5.1s", "hello");
-        assertEquals("    h", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%.0s", "hello", "2");
-        assertEquals("", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for line sperator
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_LineSeparator() {
-        Formatter f = null;
-
-        String oldSeparator = System.getProperty("line.separator");
-        System.setProperty("line.separator", "!\n");
-
-        f = new Formatter(Locale.US);
-        f.format("%1$n", 1);
-        assertEquals("!\n", f.toString());
-
-        f = new Formatter(Locale.KOREAN);
-        f.format("head%1$n%2$n", 1, new Date());
-        assertEquals("head!\n!\n", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%n%s", "hello");
-        assertEquals("!\nhello", f.toString());
-
-        System.setProperty("line.separator", oldSeparator);
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%-n");
-            fail("should throw IllegalFormatFlagsException: %-n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%+n");
-            fail("should throw IllegalFormatFlagsException: %+n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%#n");
-            fail("should throw IllegalFormatFlagsException: %#n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("% n");
-            fail("should throw IllegalFormatFlagsException: % n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%0n");
-            fail("should throw IllegalFormatFlagsException: %0n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%,n");
-            fail("should throw IllegalFormatFlagsException: %,n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%(n");
-            fail("should throw IllegalFormatFlagsException: %(n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%4n");
-            fail("should throw IllegalFormatWidthException");
-        } catch (IllegalFormatWidthException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%-4n");
-            fail("should throw IllegalFormatWidthException");
-        } catch (IllegalFormatWidthException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%.9n");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%5.9n");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-        
-        System.setProperty("line.separator", oldSeparator);
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for percent
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Percent() {
-        Formatter f = null;
-
-        f = new Formatter(Locale.ENGLISH);
-        f.format("%1$%", 100);
-        assertEquals("%", f.toString());
-
-        f = new Formatter(Locale.CHINA);
-        f.format("%1$%%%", "hello", new Object());
-        assertEquals("%%", f.toString());
-
-        f = new Formatter(Locale.CHINA);
-        f.format("%%%s", "hello");
-        assertEquals("%hello", f.toString());
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%.9%");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%5.9%");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        assertFormatFlagsConversionMismatchException(f, "%+%");
-        assertFormatFlagsConversionMismatchException(f, "%#%");
-        assertFormatFlagsConversionMismatchException(f, "% %");
-        assertFormatFlagsConversionMismatchException(f, "%0%");
-        assertFormatFlagsConversionMismatchException(f, "%,%");
-        assertFormatFlagsConversionMismatchException(f, "%(%");
-        
-
-        f = new Formatter(Locale.KOREAN);
-        f.format("%4%", 1);
-        /*
-         * fail on RI the output string should be right justified by appending
-         * spaces till the whole string is 4 chars width.
-         */
-        assertEquals("   %", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%-4%", 100);
-        /*
-         * fail on RI, throw UnknownFormatConversionException the output string
-         * should be left justified by appending spaces till the whole string is
-         * 4 chars width.
-         */
-        assertEquals("%   ", f.toString());
-    }
-
-    private void assertFormatFlagsConversionMismatchException(Formatter f, String str) {
-        try {
-            f.format(str);
-            fail("should throw FormatFlagsConversionMismatchException: "
-                    + str);
-             /*
-             * error on RI, throw IllegalFormatFlagsException specification
-             * says FormatFlagsConversionMismatchException should be thrown
-             */
-        } catch (FormatFlagsConversionMismatchException e) {
-           // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for flag
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Flag() {
-        Formatter f = new Formatter(Locale.US);
-        try {
-            f.format("%1$-#-8s", "something");
-            fail("should throw DuplicateFormatFlagsException");
-        } catch (DuplicateFormatFlagsException e) {
-            // expected
-        }
-
-        final char[] chars = { '-', '#', '+', ' ', '0', ',', '(', '%', '<' };
-        Arrays.sort(chars);
-        f = new Formatter(Locale.US);
-        for (char i = 0; i <= 256; i++) {
-            // test 8 bit character
-            if (Arrays.binarySearch(chars, i) >= 0 || Character.isDigit(i)
-                    || Character.isLetter(i)) {
-                // Do not test 0-9, a-z, A-Z and characters in the chars array.
-                // They are characters used as flags, width or conversions
-                continue;
-            }
-            try {
-                f.format("%" + i + "s", 1);
-                fail("should throw UnknownFormatConversionException");
-            } catch (UnknownFormatConversionException e) {
-                // expected
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion b/B
-     */
-    public void test_format_LString$LObject_GeneralConversionB() {
-        final Object[][] triple = { 
-                { Boolean.FALSE,                "%3.2b",  " fa", },
-                { Boolean.FALSE,                "%-4.6b", "false", },
-                { Boolean.FALSE,                "%.2b",   "fa", }, 
-                { Boolean.TRUE,                 "%3.2b",  " tr", },
-                { Boolean.TRUE,                 "%-4.6b", "true", },
-                { Boolean.TRUE,                 "%.2b",   "tr", },
-                { new Character('c'),           "%3.2b",  " tr", },
-                { new Character('c'),           "%-4.6b", "true", },
-                { new Character('c'),           "%.2b",   "tr", },
-                { new Byte((byte) 0x01),        "%3.2b",  " tr", },
-                { new Byte((byte) 0x01),        "%-4.6b", "true", },
-                { new Byte((byte) 0x01),        "%.2b",   "tr", },
-                { new Short((short) 0x0001),    "%3.2b",  " tr", },
-                { new Short((short) 0x0001),    "%-4.6b", "true", },
-                { new Short((short) 0x0001),    "%.2b",   "tr", },
-                { new Integer(1),               "%3.2b",  " tr", },
-                { new Integer(1),               "%-4.6b", "true", },
-                { new Integer(1),               "%.2b",   "tr", },
-                { new Float(1.1f),              "%3.2b",  " tr", },
-                { new Float(1.1f),              "%-4.6b", "true", },
-                { new Float(1.1f),              "%.2b",   "tr", },
-                { new Double(1.1d),             "%3.2b",  " tr", },
-                { new Double(1.1d),             "%-4.6b", "true", },
-                { new Double(1.1d),             "%.2b",   "tr", },
-                { "",                           "%3.2b",  " tr", },
-                { "",                           "%-4.6b", "true", },
-                { "",                           "%.2b",   "tr", },
-                { "string content",             "%3.2b",  " tr", },
-                { "string content",             "%-4.6b", "true", },
-                { "string content",             "%.2b",   "tr", },
-                { new MockFormattable(),        "%3.2b",  " tr", },
-                { new MockFormattable(),        "%-4.6b", "true", },
-                { new MockFormattable(),        "%.2b",   "tr", },
-                { (Object) null,                "%3.2b",  " fa", },
-                { (Object) null,                "%-4.6b", "false", },
-                { (Object) null,                "%.2b",   "fa", },
-                };
-
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2; 
-        Formatter f = null;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String)triple[i][pattern], triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])
-                    .toUpperCase(Locale.US), f.toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion type 's' and 'S'
-     */
-    public void test_format_LString$LObject_GeneralConversionS() {
-
-        final Object[][] triple = { 
-                { Boolean.FALSE,                "%2.3s",  "fal", },
-                { Boolean.FALSE,                "%-6.4s", "fals  ", },
-                { Boolean.FALSE,                "%.5s",   "false", }, 
-                { Boolean.TRUE,                 "%2.3s",  "tru", },
-                { Boolean.TRUE,                 "%-6.4s", "true  ", },
-                { Boolean.TRUE,                 "%.5s",   "true", },
-                { new Character('c'),           "%2.3s",  " c", },
-                { new Character('c'),           "%-6.4s", "c     ", },
-                { new Character('c'),           "%.5s",   "c", },
-                { new Byte((byte) 0x01),        "%2.3s",  " 1", },
-                { new Byte((byte) 0x01),        "%-6.4s", "1     ", },
-                { new Byte((byte) 0x01),        "%.5s",   "1", },
-                { new Short((short) 0x0001),    "%2.3s",  " 1", },
-                { new Short((short) 0x0001),    "%-6.4s", "1     ", },
-                { new Short((short) 0x0001),    "%.5s",   "1", },
-                { new Integer(1),               "%2.3s",  " 1", },
-                { new Integer(1),               "%-6.4s", "1     ", },
-                { new Integer(1),               "%.5s",   "1", },
-                { new Float(1.1f),              "%2.3s",  "1.1", },
-                { new Float(1.1f),              "%-6.4s", "1.1   ", },
-                { new Float(1.1f),              "%.5s",   "1.1", },
-                { new Double(1.1d),             "%2.3s",  "1.1", },
-                { new Double(1.1d),             "%-6.4s", "1.1   ", },
-                { new Double(1.1d),             "%.5s",   "1.1", },
-                { "",                           "%2.3s",  "  ", },
-                { "",                           "%-6.4s", "      ", },
-                { "",                           "%.5s",   "", },
-                { "string content",             "%2.3s",  "str", },
-                { "string content",             "%-6.4s", "stri  ", },
-                { "string content",             "%.5s",   "strin", },
-                { new MockFormattable(),        "%2.3s",  "customized format function width: 2 precision: 3", },
-                { new MockFormattable(),        "%-6.4s", "customized format function width: 6 precision: 4", },
-                { new MockFormattable(),        "%.5s",   "customized format function width: -1 precision: 5", },
-                { (Object) null,                "%2.3s",  "nul", },
-                { (Object) null,                "%-6.4s", "null  ", },
-                { (Object) null,                "%.5s",   "null", },
-                };
-
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        Formatter f = null;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String)triple[i][pattern], triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])
-                    .toUpperCase(Locale.US), f.toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion type 'h' and 'H'
-     */
-    public void test_format_LString$LObject_GeneralConversionH() {
-
-        final Object[] input = { 
-                 Boolean.FALSE,                 
-                 Boolean.TRUE,                  
-                 new Character('c'),            
-                 new Byte((byte) 0x01),         
-                 new Short((short) 0x0001),     
-                 new Integer(1),                
-                 new Float(1.1f),               
-                 new Double(1.1d),              
-                 "",                            
-                 "string content",              
-                 new MockFormattable(),         
-                 (Object) null,                 
-                };
-
-        Formatter f = null;
-        for (int i = 0; i < input.length - 1; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format("%h", input[i]);
-            assertEquals("triple[" + i + "]:" + input[i], 
-                    Integer.toHexString(input[i].hashCode()), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format("%H", input[i]);
-            assertEquals("triple[" + i + "]:" + input[i], 
-                    Integer.toHexString(input[i].hashCode()).toUpperCase(Locale.US), f.toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion other cases
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionOther() {
-        /*
-         * In Turkish locale, the upper case of '\u0069' is '\u0130'. The
-         * following test indicate that '\u0069' is coverted to upper case
-         * without using the turkish locale.
-         */
-        Formatter f = new Formatter(new Locale("tr"));
-        f.format("%S", "\u0069");
-        assertEquals("\u0049", f.toString());
-
-        final Object[] input = { 
-                Boolean.FALSE,                 
-                Boolean.TRUE,                  
-                new Character('c'),            
-                new Byte((byte) 0x01),         
-                new Short((short) 0x0001),     
-                new Integer(1),                
-                new Float(1.1f),               
-                new Double(1.1d),              
-                "",                            
-                "string content",              
-                new MockFormattable(),         
-                (Object) null,                 
-               };
-        f = new Formatter(Locale.GERMAN);
-        for (int i = 0; i < input.length; i++) {
-            if (!(input[i] instanceof Formattable)) {
-                try {
-                    f.format("%#s", input[i]);
-                    /*
-                     * fail on RI, spec says if the '#' flag is present and the
-                     * argument is not a Formattable , then a
-                     * FormatFlagsConversionMismatchException will be thrown.
-                     */
-                    fail("should throw FormatFlagsConversionMismatchException");
-                } catch (FormatFlagsConversionMismatchException e) {
-                    // expected
-                }
-            } else {
-                f.format("%#s%<-#8s", input[i]);
-                assertEquals(
-                        "customized format function width: -1 precision: -1customized format function width: 8 precision: -1",
-                        f.toString());
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion exception
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionException() {
-        final String[] flagMismatch = { "%#b", "%+b", "% b", "%0b", "%,b",
-                "%(b", "%#B", "%+B", "% B", "%0B", "%,B", "%(B", "%#h", "%+h",
-                "% h", "%0h", "%,h", "%(h", "%#H", "%+H", "% H", "%0H", "%,H",
-                "%(H", "%+s", "% s", "%0s", "%,s", "%(s", "%+S", "% S", "%0S",
-                "%,S", "%(S" };
-
-        Formatter f = new Formatter(Locale.US);
-
-        for (int i = 0; i < flagMismatch.length; i++) {
-            try {
-                f.format(flagMismatch[i], "something");
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingWidth = { "%-b", "%-B", "%-h", "%-H", "%-s",
-                "%-S", };
-        for (int i = 0; i < missingWidth.length; i++) {
-            try {
-                f.format(missingWidth[i], "something");
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-        
-        // Regression test
-        f = new Formatter();
-        try {
-            f.format("%c", (byte)-0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-        
-        f = new Formatter();
-        try {
-            f.format("%c", (short)-0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-        
-        f = new Formatter();
-        try {
-            f.format("%c", -0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Character
-     *        conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_CharacterConversion() {
-        Formatter f = new Formatter(Locale.US);
-        final Object[] illArgs = { Boolean.TRUE, new Float(1.1f),
-                new Double(1.1d), "string content", new Float(1.1f), new Date() };
-        for (int i = 0; i < illArgs.length; i++) {
-            try {
-                f.format("%c", illArgs[i]);
-                fail("should throw IllegalFormatConversionException");
-            } catch (IllegalFormatConversionException e) {
-                // expected
-            }
-        }
-
-        try {
-            f.format("%c", Integer.MAX_VALUE);
-            fail("should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-
-        try {
-            f.format("%#c", 'c');
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        final Object[][] triple = {
-                {'c',               "%c",   "c"},
-                {'c',               "%-2c", "c "},
-                {'\u0123',          "%c",   "\u0123"},
-                {'\u0123',          "%-2c", "\u0123 "},
-                {(byte) 0x11,       "%c",   "\u0011"},
-                {(byte) 0x11,       "%-2c", "\u0011 "},
-                {(short) 0x1111,    "%c",   "\u1111"},
-                {(short) 0x1111,    "%-2c", "\u1111 "},
-                {0x11,              "%c",   "\u0011"},
-                {0x11,              "%-2c", "\u0011 "},
-        };
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        for (int i = 0; i < triple.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)triple[i][pattern], triple[i][input]);
-                assertEquals(triple[i][output], f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%c", 0x10000);
-        assertEquals(0x10000, f.toString().codePointAt(0));
-
-        try {
-            f.format("%2.2c", 'c');
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%C", 'w');
-        // error on RI, throw UnknownFormatConversionException
-        // RI do not support converter 'C'
-        assertEquals("W", f.toString());
-
-        f = new Formatter(Locale.JAPAN);
-        f.format("%Ced", 0x1111);
-        // error on RI, throw UnknownFormatConversionException
-        // RI do not support converter 'C'
-        assertEquals("\u1111ed", f.toString());
-    }
-    
-    
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'd'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionD() {
-        final Object[][] triple = { 
-                { 0,                "%d",                  "0" }, 
-                { 0,                "%10d",       "         0" }, 
-                { 0,                "%-1d",                "0" }, 
-                { 0,                "%+d",                "+0" }, 
-                { 0,                "% d",                " 0" }, 
-                { 0,                "%,d",                 "0" }, 
-                { 0,                "%(d",                 "0" }, 
-                { 0,                "%08d",         "00000000" }, 
-                { 0,                "%-+,(11d",  "+0         " }, 
-                { 0,                "%0 ,(11d",  " 0000000000" }, 
-
-                { (byte) 0xff,      "%d",                 "-1" }, 
-                { (byte) 0xff,      "%10d",       "        -1" }, 
-                { (byte) 0xff,      "%-1d",               "-1" }, 
-                { (byte) 0xff,      "%+d",                "-1" }, 
-                { (byte) 0xff,      "% d",                "-1" }, 
-                { (byte) 0xff,      "%,d",                "-1" }, 
-                { (byte) 0xff,      "%(d",               "(1)" }, 
-                { (byte) 0xff,      "%08d",         "-0000001" }, 
-                { (byte) 0xff,      "%-+,(11d",  "(1)        " }, 
-                { (byte) 0xff,      "%0 ,(11d",  "(000000001)" }, 
-                
-                { (short) 0xf123,   "%d",              "-3805" }, 
-                { (short) 0xf123,   "%10d",       "     -3805" }, 
-                { (short) 0xf123,   "%-1d",            "-3805" }, 
-                { (short) 0xf123,   "%+d",             "-3805" }, 
-                { (short) 0xf123,   "% d",             "-3805" }, 
-                { (short) 0xf123,   "%,d",            "-3.805" }, 
-                { (short) 0xf123,   "%(d",            "(3805)" }, 
-                { (short) 0xf123,   "%08d",         "-0003805" }, 
-                { (short) 0xf123,   "%-+,(11d",  "(3.805)    " }, 
-                { (short) 0xf123,   "%0 ,(11d",  "(00003.805)" }, 
-                
-                {  0x123456,        "%d",            "1193046" }, 
-                {  0x123456,        "%10d",       "   1193046" }, 
-                {  0x123456,        "%-1d",          "1193046" }, 
-                {  0x123456,        "%+d",          "+1193046" }, 
-                {  0x123456,        "% d",          " 1193046" }, 
-                {  0x123456,        "%,d",         "1.193.046" }, 
-                {  0x123456,        "%(d",           "1193046" }, 
-                {  0x123456,        "%08d",         "01193046" }, 
-                {  0x123456,        "%-+,(11d",  "+1.193.046 " }, 
-                {  0x123456,        "%0 ,(11d",  " 01.193.046" }, 
-                
-                { -3,               "%d",                 "-3" }, 
-                { -3,               "%10d",       "        -3" }, 
-                { -3,               "%-1d",               "-3" }, 
-                { -3,               "%+d",                "-3" }, 
-                { -3,               "% d",                "-3" }, 
-                { -3,               "%,d",                "-3" }, 
-                { -3,               "%(d",               "(3)" }, 
-                { -3,               "%08d",         "-0000003" }, 
-                { -3,               "%-+,(11d",  "(3)        " }, 
-                { -3,               "%0 ,(11d",  "(000000003)" },
-                
-                { 0x7654321L,       "%d",          "124076833" }, 
-                { 0x7654321L,       "%10d",       " 124076833" }, 
-                { 0x7654321L,       "%-1d",        "124076833" }, 
-                { 0x7654321L,       "%+d",        "+124076833" }, 
-                { 0x7654321L,       "% d",        " 124076833" }, 
-                { 0x7654321L,       "%,d",       "124.076.833" }, 
-                { 0x7654321L,       "%(d",         "124076833" }, 
-                { 0x7654321L,       "%08d",        "124076833" }, 
-                { 0x7654321L,       "%-+,(11d", "+124.076.833" }, 
-                { 0x7654321L,       "%0 ,(11d", " 124.076.833" }, 
-                
-                { -1L,              "%d",                 "-1" }, 
-                { -1L,              "%10d",       "        -1" }, 
-                { -1L,              "%-1d",               "-1" }, 
-                { -1L,              "%+d",                "-1" }, 
-                { -1L,              "% d",                "-1" }, 
-                { -1L,              "%,d",                "-1" }, 
-                { -1L,              "%(d",               "(1)" }, 
-                { -1L,              "%08d",         "-0000001" }, 
-                { -1L,              "%-+,(11d",  "(1)        " }, 
-                { -1L,              "%0 ,(11d",  "(000000001)" }, 
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.GERMAN);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'o'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionO() {
-        final Object[][] triple = { 
-                { 0,                "%o",                 "0" }, 
-                { 0,                "%-6o",          "0     " }, 
-                { 0,                "%08o",        "00000000" }, 
-                { 0,                "%#o",               "00" }, 
-                { 0,                "%0#11o",   "00000000000" }, 
-                { 0,                "%-#9o",      "00       " }, 
-
-                { (byte) 0xff,      "%o",               "377" }, 
-                { (byte) 0xff,      "%-6o",          "377   " }, 
-                { (byte) 0xff,      "%08o",        "00000377" }, 
-                { (byte) 0xff,      "%#o",             "0377" }, 
-                { (byte) 0xff,      "%0#11o",   "00000000377" }, 
-                { (byte) 0xff,      "%-#9o",      "0377     " }, 
-                
-                { (short) 0xf123,   "%o",            "170443" }, 
-                { (short) 0xf123,   "%-6o",          "170443" }, 
-                { (short) 0xf123,   "%08o",        "00170443" }, 
-                { (short) 0xf123,   "%#o",          "0170443" }, 
-                { (short) 0xf123,   "%0#11o",   "00000170443" }, 
-                { (short) 0xf123,   "%-#9o",      "0170443  " }, 
-                
-                {  0x123456,        "%o",           "4432126" }, 
-                {  0x123456,        "%-6o",         "4432126" }, 
-                {  0x123456,        "%08o",        "04432126" }, 
-                {  0x123456,        "%#o",         "04432126" }, 
-                {  0x123456,        "%0#11o",   "00004432126" }, 
-                {  0x123456,        "%-#9o",      "04432126 " }, 
-                
-                { -3,               "%o",       "37777777775" }, 
-                { -3,               "%-6o",     "37777777775" }, 
-                { -3,               "%08o",     "37777777775" }, 
-                { -3,               "%#o",     "037777777775" }, 
-                { -3,               "%0#11o",  "037777777775" }, 
-                { -3,               "%-#9o",   "037777777775" }, 
-                
-                { 0x7654321L,       "%o",          "731241441" }, 
-                { 0x7654321L,       "%-6o",        "731241441" }, 
-                { 0x7654321L,       "%08o",        "731241441" }, 
-                { 0x7654321L,       "%#o",        "0731241441" }, 
-                { 0x7654321L,       "%0#11o",    "00731241441" }, 
-                { 0x7654321L,       "%-#9o",      "0731241441" }, 
-                
-                { -1L,              "%o",       "1777777777777777777777" }, 
-                { -1L,              "%-6o",     "1777777777777777777777" }, 
-                { -1L,              "%08o",     "1777777777777777777777" }, 
-                { -1L,              "%#o",     "01777777777777777777777" }, 
-                { -1L,              "%0#11o",  "01777777777777777777777" }, 
-                { -1L,              "%-#9o",   "01777777777777777777777" }, 
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.ITALY);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'x' and 'X'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionX() {
-        final Object[][] triple = { 
-                { 0,                "%x",                 "0" }, 
-                { 0,                "%-8x",        "0       " }, 
-                { 0,                "%06x",          "000000" }, 
-                { 0,                "%#x",              "0x0" }, 
-                { 0,                "%0#12x",  "0x0000000000" }, 
-                { 0,                "%-#9x",      "0x0      " }, 
-
-                { (byte) 0xff,      "%x",                "ff" }, 
-                { (byte) 0xff,      "%-8x",        "ff      " }, 
-                { (byte) 0xff,      "%06x",          "0000ff" }, 
-                { (byte) 0xff,      "%#x",             "0xff" }, 
-                { (byte) 0xff,      "%0#12x",  "0x00000000ff" }, 
-                { (byte) 0xff,      "%-#9x",      "0xff     " }, 
-                
-                { (short) 0xf123,   "%x",              "f123" }, 
-                { (short) 0xf123,   "%-8x",        "f123    " }, 
-                { (short) 0xf123,   "%06x",          "00f123" }, 
-                { (short) 0xf123,   "%#x",           "0xf123" }, 
-                { (short) 0xf123,   "%0#12x",  "0x000000f123" }, 
-                { (short) 0xf123,   "%-#9x",      "0xf123   " }, 
-                
-                {  0x123456,        "%x",            "123456" }, 
-                {  0x123456,        "%-8x",        "123456  " }, 
-                {  0x123456,        "%06x",          "123456" }, 
-                {  0x123456,        "%#x",         "0x123456" }, 
-                {  0x123456,        "%0#12x",  "0x0000123456" }, 
-                {  0x123456,        "%-#9x",      "0x123456 " }, 
-                
-                { -3,               "%x",          "fffffffd" }, 
-                { -3,               "%-8x",        "fffffffd" }, 
-                { -3,               "%06x",        "fffffffd" }, 
-                { -3,               "%#x",       "0xfffffffd" }, 
-                { -3,               "%0#12x",  "0x00fffffffd" }, 
-                { -3,               "%-#9x",     "0xfffffffd" }, 
-                
-                { 0x7654321L,       "%x",          "7654321" }, 
-                { 0x7654321L,       "%-8x",       "7654321 " }, 
-                { 0x7654321L,       "%06x",        "7654321" }, 
-                { 0x7654321L,       "%#x",       "0x7654321" }, 
-                { 0x7654321L,       "%0#12x", "0x0007654321" }, 
-                { 0x7654321L,       "%-#9x",     "0x7654321" }, 
-                
-                { -1L,              "%x",       "ffffffffffffffff" }, 
-                { -1L,              "%-8x",     "ffffffffffffffff" }, 
-                { -1L,              "%06x",     "ffffffffffffffff" }, 
-                { -1L,              "%#x",    "0xffffffffffffffff" }, 
-                { -1L,              "%0#12x", "0xffffffffffffffff" }, 
-                { -1L,              "%-#9x",  "0xffffffffffffffff" }, 
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-            
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Date/Time
-     *        conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_DateTimeConversion() {
-        Formatter f = null;
-        Date now = new Date(1147327147578L);
-
-        Calendar paris = Calendar.getInstance(TimeZone
-                .getTimeZone("Europe/Paris"), Locale.FRANCE);
-        paris.set(2006, 4, 8, 12, 0, 0);
-        paris.set(Calendar.MILLISECOND, 453);
-        Calendar china = Calendar.getInstance(
-                TimeZone.getTimeZone("GMT-08:00"), Locale.CHINA);
-        china.set(2006, 4, 8, 12, 0, 0);
-        china.set(Calendar.MILLISECOND, 609);
-
-        final Object[][] lowerCaseGermanTriple = {
-                {0L,                        'a', "Do."},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'a', "So."},  //$NON-NLS-2$
-                {-1000L,                    'a', "Do."},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'a', "Do."},  //$NON-NLS-2$
-                {paris,                     'a', "Mo."},  //$NON-NLS-2$
-                {china,                     'a', "Mo."},  //$NON-NLS-2$
-                {0L,                        'b', "Jan"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'b', "Aug"},  //$NON-NLS-2$
-                {-1000L,                    'b', "Jan"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'b', "Mai"},  //$NON-NLS-2$
-                {paris,                     'b', "Mai"},  //$NON-NLS-2$
-                {china,                     'b', "Mai"},  //$NON-NLS-2$
-                {0L,                        'c', "Do. Jan 01 08:00:00 GMT+08:00 1970"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'c', "So. Aug 17 15:18:47 GMT+08:00 292278994"},  //$NON-NLS-2$
-                {-1000L,                    'c', "Do. Jan 01 07:59:59 GMT+08:00 1970"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'c', "Do. Mai 11 13:59:07 GMT+08:00 2006"},  //$NON-NLS-2$
-                {paris,                     'c', "Mo. Mai 08 12:00:00 MESZ 2006"},  //$NON-NLS-2$
-                {china,                     'c', "Mo. Mai 08 12:00:00 GMT-08:00 2006"},  //$NON-NLS-2$
-                {0L,                        'd', "01"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'd', "17"},  //$NON-NLS-2$
-                {-1000L,                    'd', "01"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'd', "11"},  //$NON-NLS-2$
-                {paris,                     'd', "08"},  //$NON-NLS-2$
-                {china,                     'd', "08"},  //$NON-NLS-2$
-                {0L,                        'e', "1"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'e', "17"},  //$NON-NLS-2$
-                {-1000L,                    'e', "1"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'e', "11"},  //$NON-NLS-2$
-                {paris,                     'e', "8"},  //$NON-NLS-2$
-                {china,                     'e', "8"},  //$NON-NLS-2$
-                {0L,                        'h', "Jan"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'h', "Aug"},  //$NON-NLS-2$
-                {-1000L,                    'h', "Jan"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'h', "Mai"},  //$NON-NLS-2$
-                {paris,                     'h', "Mai"},  //$NON-NLS-2$
-                {china,                     'h', "Mai"},  //$NON-NLS-2$
-                {0L,                        'j', "001"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'j', "229"},  //$NON-NLS-2$
-                {-1000L,                    'j', "001"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'j', "131"},  //$NON-NLS-2$
-                {paris,                     'j', "128"},  //$NON-NLS-2$
-                {china,                     'j', "128"},  //$NON-NLS-2$
-                {0L,                        'k', "8"},  //$NON-NLS-2$
-                {Long.MAX_VALUE,            'k', "15"},  //$NON-NLS-2$
-                {-1000L,                    'k', "7"},  //$NON-NLS-2$
-                {new Date(1147327147578L),  'k', "13"},  //$NON-NLS-2$
-                {paris,                     'k', "12"},  //$NON-NLS-2$
-                {china,                     'k', "12"},  //$NON-NLS-2$
-                {0L,                        'l', "8"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$
-                {-1000L,                    'l', "7"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$
-                {paris,                     'l', "12"}, //$NON-NLS-2$
-                {china,                     'l', "12"}, //$NON-NLS-2$
-                {0L,                        'm', "01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$
-                {-1000L,                    'm', "01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$
-                {paris,                     'm', "05"}, //$NON-NLS-2$
-                {china,                     'm', "05"}, //$NON-NLS-2$
-                {0L,                        'p', "vorm."}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'p', "nachm."}, //$NON-NLS-2$
-                {-1000L,                    'p', "vorm."}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'p', "nachm."}, //$NON-NLS-2$
-                {paris,                     'p', "nachm."}, //$NON-NLS-2$
-                {china,                     'p', "nachm."}, //$NON-NLS-2$
-                {0L,                        'r', "08:00:00 vorm."}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'r', "03:18:47 nachm."}, //$NON-NLS-2$
-                {-1000L,                    'r', "07:59:59 vorm."}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'r', "01:59:07 nachm."}, //$NON-NLS-2$
-                {paris,                     'r', "12:00:00 nachm."}, //$NON-NLS-2$
-                {china,                     'r', "12:00:00 nachm."}, //$NON-NLS-2$
-                {0L,                        's', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$
-                {-1000L,                    's', "-1"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$
-                {paris,                     's', "1147082400"}, //$NON-NLS-2$
-                {china,                     's', "1147118400"}, //$NON-NLS-2$
-                {0L,                        'y', "70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$
-                {-1000L,                    'y', "70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$
-                {paris,                     'y', "06"}, //$NON-NLS-2$
-                {china,                     'y', "06"}, //$NON-NLS-2$
-                {0L,                        'z', "+0800"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$
-                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$
-                {paris,                     'z', "+0100"}, //$NON-NLS-2$
-                {china,                     'z', "-0800"}, //$NON-NLS-2$
-                
-        };
-        
-        final Object[][] lowerCaseFranceTriple = {
-                {0L,                        'a', "jeu."}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'a', "dim."}, //$NON-NLS-2$
-                {-1000L,                    'a', "jeu."}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'a', "jeu."}, //$NON-NLS-2$
-                {paris,                     'a', "lun."}, //$NON-NLS-2$
-                {china,                     'a', "lun."}, //$NON-NLS-2$
-                {0L,                        'b', "janv."}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'b', "ao\u00fbt"}, //$NON-NLS-2$
-                {-1000L,                    'b', "janv."}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'b', "mai"}, //$NON-NLS-2$
-                {paris,                     'b', "mai"}, //$NON-NLS-2$
-                {china,                     'b', "mai"}, //$NON-NLS-2$
-                {0L,                        'c', "jeu. janv. 01 08:00:00 UTC+08:00 1970"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'c', "dim. ao\u00fbt 17 15:18:47 UTC+08:00 292278994"}, //$NON-NLS-2$
-                {-1000L,                    'c', "jeu. janv. 01 07:59:59 UTC+08:00 1970"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'c', "jeu. mai 11 13:59:07 UTC+08:00 2006"}, //$NON-NLS-2$
-                {paris,                     'c', "lun. mai 08 12:00:00 HAEC 2006"}, //$NON-NLS-2$
-                {china,                     'c', "lun. mai 08 12:00:00 UTC-08:00 2006"}, //$NON-NLS-2$
-                {0L,                        'd', "01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'd', "17"}, //$NON-NLS-2$
-                {-1000L,                    'd', "01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'd', "11"}, //$NON-NLS-2$
-                {paris,                     'd', "08"}, //$NON-NLS-2$
-                {china,                     'd', "08"}, //$NON-NLS-2$
-                {0L,                        'e', "1"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'e', "17"}, //$NON-NLS-2$
-                {-1000L,                    'e', "1"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'e', "11"}, //$NON-NLS-2$
-                {paris,                     'e', "8"}, //$NON-NLS-2$
-                {china,                     'e', "8"}, //$NON-NLS-2$
-                {0L,                        'h', "janv."}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'h', "ao\u00fbt"}, //$NON-NLS-2$
-                {-1000L,                    'h', "janv."}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'h', "mai"}, //$NON-NLS-2$
-                {paris,                     'h', "mai"}, //$NON-NLS-2$
-                {china,                     'h', "mai"}, //$NON-NLS-2$
-                {0L,                        'j', "001"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'j', "229"}, //$NON-NLS-2$
-                {-1000L,                    'j', "001"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'j', "131"}, //$NON-NLS-2$
-                {paris,                     'j', "128"}, //$NON-NLS-2$
-                {china,                     'j', "128"}, //$NON-NLS-2$
-                {0L,                        'k', "8"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'k', "15"}, //$NON-NLS-2$
-                {-1000L,                    'k', "7"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'k', "13"}, //$NON-NLS-2$
-                {paris,                     'k', "12"}, //$NON-NLS-2$
-                {china,                     'k', "12"}, //$NON-NLS-2$
-                {0L,                        'l', "8"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$
-                {-1000L,                    'l', "7"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$
-                {paris,                     'l', "12"}, //$NON-NLS-2$
-                {china,                     'l', "12"}, //$NON-NLS-2$
-                {0L,                        'm', "01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$
-                {-1000L,                    'm', "01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$
-                {paris,                     'm', "05"}, //$NON-NLS-2$
-                {china,                     'm', "05"}, //$NON-NLS-2$
-                {0L,                        'p', "am"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'p', "pm"}, //$NON-NLS-2$
-                {-1000L,                    'p', "am"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'p', "pm"}, //$NON-NLS-2$
-                {paris,                     'p', "pm"}, //$NON-NLS-2$
-                {china,                     'p', "pm"}, //$NON-NLS-2$
-                {0L,                        'r', "08:00:00 AM"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'r', "03:18:47 PM"}, //$NON-NLS-2$
-                {-1000L,                    'r', "07:59:59 AM"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'r', "01:59:07 PM"}, //$NON-NLS-2$
-                {paris,                     'r', "12:00:00 PM"}, //$NON-NLS-2$
-                {china,                     'r', "12:00:00 PM"}, //$NON-NLS-2$
-                {0L,                        's', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$
-                {-1000L,                    's', "-1"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$
-                {paris,                     's', "1147082400"}, //$NON-NLS-2$
-                {china,                     's', "1147118400"}, //$NON-NLS-2$
-                {0L,                        'y', "70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$
-                {-1000L,                    'y', "70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$
-                {paris,                     'y', "06"}, //$NON-NLS-2$
-                {china,                     'y', "06"}, //$NON-NLS-2$
-                {0L,                        'z', "+0800"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$
-                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$
-                {paris,                     'z', "+0100"}, //$NON-NLS-2$
-                {china,                     'z', "-0800"}, //$NON-NLS-2$
-                
-        };
-        
-        final Object[][] lowerCaseJapanTriple = {
-                {0L,                        'a', "\u6728"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'a', "\u65e5"}, //$NON-NLS-2$
-                {-1000L,                    'a', "\u6728"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'a', "\u6728"}, //$NON-NLS-2$
-                {paris,                     'a', "\u6708"}, //$NON-NLS-2$
-                {china,                     'a', "\u6708"}, //$NON-NLS-2$
-                {0L,                        'b', "1\u6708"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'b', "8\u6708"}, //$NON-NLS-2$
-                {-1000L,                    'b', "1\u6708"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'b', "5\u6708"}, //$NON-NLS-2$
-                {paris,                     'b', "5\u6708"}, //$NON-NLS-2$
-                {china,                     'b', "5\u6708"}, //$NON-NLS-2$
-                {0L,                        'c', "\u6728 1\u6708 01 08:00:00 GMT+08:00 1970"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'c', "\u65e5 8\u6708 17 15:18:47 GMT+08:00 292278994"}, //$NON-NLS-2$
-                {-1000L,                    'c', "\u6728 1\u6708 01 07:59:59 GMT+08:00 1970"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'c', "\u6728 5\u6708 11 13:59:07 GMT+08:00 2006"}, //$NON-NLS-2$
-                {paris,                     'c', "\u6708 5\u6708 08 12:00:00 GMT+02:00 2006"}, //$NON-NLS-2$
-                {china,                     'c', "\u6708 5\u6708 08 12:00:00 GMT-08:00 2006"}, //$NON-NLS-2$
-                {0L,                        'd', "01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'd', "17"}, //$NON-NLS-2$
-                {-1000L,                    'd', "01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'd', "11"}, //$NON-NLS-2$
-                {paris,                     'd', "08"}, //$NON-NLS-2$
-                {china,                     'd', "08"}, //$NON-NLS-2$
-                {0L,                        'e', "1"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'e', "17"}, //$NON-NLS-2$
-                {-1000L,                    'e', "1"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'e', "11"}, //$NON-NLS-2$
-                {paris,                     'e', "8"}, //$NON-NLS-2$
-                {china,                     'e', "8"}, //$NON-NLS-2$
-                {0L,                        'h', "1\u6708"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'h', "8\u6708"}, //$NON-NLS-2$
-                {-1000L,                    'h', "1\u6708"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'h', "5\u6708"}, //$NON-NLS-2$
-                {paris,                     'h', "5\u6708"}, //$NON-NLS-2$
-                {china,                     'h', "5\u6708"}, //$NON-NLS-2$
-                {0L,                        'j', "001"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'j', "229"}, //$NON-NLS-2$
-                {-1000L,                    'j', "001"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'j', "131"}, //$NON-NLS-2$
-                {paris,                     'j', "128"}, //$NON-NLS-2$
-                {china,                     'j', "128"}, //$NON-NLS-2$
-                {0L,                        'k', "8"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'k', "15"}, //$NON-NLS-2$
-                {-1000L,                    'k', "7"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'k', "13"}, //$NON-NLS-2$
-                {paris,                     'k', "12"}, //$NON-NLS-2$
-                {china,                     'k', "12"}, //$NON-NLS-2$
-                {0L,                        'l', "8"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$
-                {-1000L,                    'l', "7"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$
-                {paris,                     'l', "12"}, //$NON-NLS-2$
-                {china,                     'l', "12"}, //$NON-NLS-2$
-                {0L,                        'm', "01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$
-                {-1000L,                    'm', "01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$
-                {paris,                     'm', "05"}, //$NON-NLS-2$
-                {china,                     'm', "05"}, //$NON-NLS-2$
-                {0L,                        'p', "\u5348\u524d"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'p', "\u5348\u5f8c"}, //$NON-NLS-2$
-                {-1000L,                    'p', "\u5348\u524d"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'p', "\u5348\u5f8c"}, //$NON-NLS-2$
-                {paris,                     'p', "\u5348\u5f8c"}, //$NON-NLS-2$
-                {china,                     'p', "\u5348\u5f8c"}, //$NON-NLS-2$
-                {0L,                        'r', "08:00:00 \u5348\u524d"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'r', "03:18:47 \u5348\u5f8c"}, //$NON-NLS-2$
-                {-1000L,                    'r', "07:59:59 \u5348\u524d"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'r', "01:59:07 \u5348\u5f8c"}, //$NON-NLS-2$
-                {paris,                     'r', "12:00:00 \u5348\u5f8c"}, //$NON-NLS-2$
-                {china,                     'r', "12:00:00 \u5348\u5f8c"}, //$NON-NLS-2$
-                {0L,                        's', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$
-                {-1000L,                    's', "-1"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$
-                {paris,                     's', "1147082400"}, //$NON-NLS-2$
-                {china,                     's', "1147118400"}, //$NON-NLS-2$
-                {0L,                        'y', "70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$
-                {-1000L,                    'y', "70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$
-                {paris,                     'y', "06"}, //$NON-NLS-2$
-                {china,                     'y', "06"}, //$NON-NLS-2$
-                {0L,                        'z', "+0800"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$
-                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$
-                {paris,                     'z', "+0100"}, //$NON-NLS-2$
-                {china,                     'z', "-0800"}, //$NON-NLS-2$
-        };
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        for (int i = 0; i < 90; i++) {
-            // go through legal conversion 
-            String formatSpecifier = "%t" + lowerCaseGermanTriple[i][pattern]; //$NON-NLS-2$
-            String formatSpecifierUpper = "%T" + lowerCaseGermanTriple[i][pattern]; //$NON-NLS-2$
-            // test '%t'
-            f = new Formatter(Locale.GERMAN);
-            f.format(formatSpecifier, lowerCaseGermanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + lowerCaseGermanTriple[i][input], //$NON-NLS-2$
-                            lowerCaseGermanTriple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.FRANCE, formatSpecifier, lowerCaseFranceTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + lowerCaseFranceTriple[i][input], //$NON-NLS-2$
-                            lowerCaseFranceTriple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.JAPAN, formatSpecifier, lowerCaseJapanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + lowerCaseJapanTriple[i][input], //$NON-NLS-2$
-                            lowerCaseJapanTriple[i][output], f.toString());
-
-            // test '%T'
-            f = new Formatter(Locale.GERMAN);
-            f.format(formatSpecifierUpper, lowerCaseGermanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + lowerCaseGermanTriple[i][input], //$NON-NLS-2$
-                            ((String)lowerCaseGermanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.FRANCE, formatSpecifierUpper, lowerCaseFranceTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + lowerCaseFranceTriple[i][input], //$NON-NLS-2$
-                            ((String)lowerCaseFranceTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.JAPAN, formatSpecifierUpper, lowerCaseJapanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + lowerCaseJapanTriple[i][input], //$NON-NLS-2$
-                            ((String)lowerCaseJapanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-        }
-
-        final Object[][] upperCaseGermanTriple = {
-                {0L,                        'A', "Donnerstag"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'A', "Sonntag"}, //$NON-NLS-2$
-                {-1000L,                    'A', "Donnerstag"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'A', "Donnerstag"}, //$NON-NLS-2$
-                {paris,                     'A', "Montag"}, //$NON-NLS-2$
-                {china,                     'A', "Montag"}, //$NON-NLS-2$
-                {0L,                        'B', "Januar"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'B', "August"}, //$NON-NLS-2$
-                {-1000L,                    'B', "Januar"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'B', "Mai"}, //$NON-NLS-2$
-                {paris,                     'B', "Mai"}, //$NON-NLS-2$ 
-                {china,                     'B', "Mai"}, //$NON-NLS-2$
-                {0L,                        'C', "19"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$
-                {-1000L,                    'C', "19"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$
-                {paris,                     'C', "20"}, //$NON-NLS-2$
-                {china,                     'C', "20"}, //$NON-NLS-2$
-                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$
-                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$
-                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {china,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$
-                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$
-                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {0L,                        'H', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$
-                {-1000L,                    'H', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$
-                {paris,                     'H', "12"}, //$NON-NLS-2$
-                {china,                     'H', "12"}, //$NON-NLS-2$
-                {0L,                        'I', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$
-                {-1000L,                    'I', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$
-                {paris,                     'I', "12"}, //$NON-NLS-2$
-                {china,                     'I', "12"}, //$NON-NLS-2$
-                {0L,                        'L', "000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$
-                {-1000L,                    'L', "000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$
-                {paris,                     'L', "453"}, //$NON-NLS-2$
-                {china,                     'L', "609"}, //$NON-NLS-2$
-                {0L,                        'M', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$
-                {-1000L,                    'M', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$
-                {paris,                     'M', "00"}, //$NON-NLS-2$
-                {china,                     'M', "00"}, //$NON-NLS-2$
-                {0L,                        'N', "000000000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$
-                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$
-                {paris,                     'N', "609000000"}, //$NON-NLS-2$
-                {china,                     'N', "609000000"}, //$NON-NLS-2$
-                {0L,                        'Q', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$
-                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$
-                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$
-                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$
-                {0L,                        'R', "08:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$
-                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$
-                {paris,                     'R', "12:00"}, //$NON-NLS-2$
-                {china,                     'R', "12:00"}, //$NON-NLS-2$
-                {0L,                        'S', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$
-                {-1000L,                    'S', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$
-                {paris,                     'S', "00"}, //$NON-NLS-2$
-                {china,                     'S', "00"}, //$NON-NLS-2$
-                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$
-                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$
-                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {china,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {0L,                        'Y', "1970"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$
-                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$
-                {paris,                     'Y', "2006"}, //$NON-NLS-2$
-                {china,                     'Y', "2006"}, //$NON-NLS-2$
-                {0L,                        'Z', "CST"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$
-                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$
-                {paris,                     'Z', "CEST"}, //$NON-NLS-2$
-                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$
-                
-        };
-        
-        final Object[][] upperCaseFranceTriple = {
-                {0L,                        'A', "jeudi"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'A', "dimanche"}, //$NON-NLS-2$
-                {-1000L,                    'A', "jeudi"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'A', "jeudi"}, //$NON-NLS-2$
-                {paris,                     'A', "lundi"}, //$NON-NLS-2$
-                {china,                     'A', "lundi"}, //$NON-NLS-2$
-                {0L,                        'B', "janvier"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'B', "ao\u00fbt"}, //$NON-NLS-2$
-                {-1000L,                    'B', "janvier"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'B', "mai"}, //$NON-NLS-2$
-                {paris,                     'B', "mai"}, //$NON-NLS-2$
-                {china,                     'B', "mai"}, //$NON-NLS-2$
-                {0L,                        'C', "19"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$
-                {-1000L,                    'C', "19"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$
-                {paris,                     'C', "20"}, //$NON-NLS-2$
-                {china,                     'C', "20"}, //$NON-NLS-2$
-                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$
-                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$
-                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {china,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$
-                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$
-                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {0L,                        'H', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$
-                {-1000L,                    'H', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$
-                {paris,                     'H', "12"}, //$NON-NLS-2$
-                {china,                     'H', "12"}, //$NON-NLS-2$
-                {0L,                        'I', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$
-                {-1000L,                    'I', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$
-                {paris,                     'I', "12"}, //$NON-NLS-2$
-                {china,                     'I', "12"}, //$NON-NLS-2$
-                {0L,                        'L', "000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$
-                {-1000L,                    'L', "000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$
-                {paris,                     'L', "453"}, //$NON-NLS-2$
-                {china,                     'L', "609"}, //$NON-NLS-2$
-                {0L,                        'M', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$
-                {-1000L,                    'M', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$
-                {paris,                     'M', "00"}, //$NON-NLS-2$
-                {china,                     'M', "00"}, //$NON-NLS-2$
-                {0L,                        'N', "000000000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$
-                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$
-                {paris,                     'N', "453000000"}, //$NON-NLS-2$
-                {china,                     'N', "468000000"}, //$NON-NLS-2$
-                {0L,                        'Q', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$
-                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$
-                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$
-                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$
-                {0L,                        'R', "08:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$
-                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$
-                {paris,                     'R', "12:00"}, //$NON-NLS-2$
-                {china,                     'R', "12:00"}, //$NON-NLS-2$
-                {0L,                        'S', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$
-                {-1000L,                    'S', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$
-                {paris,                     'S', "00"}, //$NON-NLS-2$
-                {china,                     'S', "00"}, //$NON-NLS-2$
-                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$
-                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$
-                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {china,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {0L,                        'Y', "1970"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$
-                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$
-                {paris,                     'Y', "2006"}, //$NON-NLS-2$
-                {china,                     'Y', "2006"}, //$NON-NLS-2$
-                {0L,                        'Z', "CST"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$
-                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$
-                {paris,                     'Z', "CEST"}, //$NON-NLS-2$
-                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$
-                
-        };
-
-        final Object[][] upperCaseJapanTriple = {
-                {0L,                        'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'A', "\u65e5\u66dc\u65e5"}, //$NON-NLS-2$
-                {-1000L,                    'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$
-                {paris,                     'A', "\u6708\u66dc\u65e5"}, //$NON-NLS-2$
-                {china,                     'A', "\u6708\u66dc\u65e5"}, //$NON-NLS-2$
-                {0L,                        'B', "1\u6708"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'B', "8\u6708"}, //$NON-NLS-2$
-                {-1000L,                    'B', "1\u6708"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'B', "5\u6708"}, //$NON-NLS-2$
-                {paris,                     'B', "5\u6708"}, //$NON-NLS-2$
-                {china,                     'B', "5\u6708"}, //$NON-NLS-2$
-                {0L,                        'C', "19"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$
-                {-1000L,                    'C', "19"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$ 
-                {paris,                     'C', "20"}, //$NON-NLS-2$
-                {china,                     'C', "20"}, //$NON-NLS-2$
-                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$
-                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$
-                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {china,                     'D', "05/08/06"}, //$NON-NLS-2$
-                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$
-                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$
-                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$
-                {0L,                        'H', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$
-                {-1000L,                    'H', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$
-                {paris,                     'H', "12"}, //$NON-NLS-2$
-                {china,                     'H', "12"}, //$NON-NLS-2$
-                {0L,                        'I', "08"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$
-                {-1000L,                    'I', "07"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$
-                {paris,                     'I', "12"}, //$NON-NLS-2$
-                {china,                     'I', "12"}, //$NON-NLS-2$
-                {0L,                        'L', "000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$
-                {-1000L,                    'L', "000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$
-                {paris,                     'L', "453"}, //$NON-NLS-2$
-                {china,                     'L', "609"}, //$NON-NLS-2$
-                {0L,                        'M', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$
-                {-1000L,                    'M', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$
-                {paris,                     'M', "00"}, //$NON-NLS-2$
-                {china,                     'M', "00"}, //$NON-NLS-2$
-                {0L,                        'N', "000000000"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$
-                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$
-                {paris,                     'N', "453000000"}, //$NON-NLS-2$
-                {china,                     'N', "468000000"}, //$NON-NLS-2$
-                {0L,                        'Q', "0"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$
-                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$
-                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$
-                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$
-                {0L,                        'R', "08:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$
-                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$
-                {paris,                     'R', "12:00"}, //$NON-NLS-2$
-                {china,                     'R', "12:00"}, //$NON-NLS-2$
-                {0L,                        'S', "00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$
-                {-1000L,                    'S', "59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$
-                {paris,                     'S', "00"}, //$NON-NLS-2$
-                {china,                     'S', "00"}, //$NON-NLS-2$
-                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$
-                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$
-                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {china,                     'T', "12:00:00"}, //$NON-NLS-2$
-                {0L,                        'Y', "1970"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$
-                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$
-                {paris,                     'Y', "2006"}, //$NON-NLS-2$
-                {china,                     'Y', "2006"}, //$NON-NLS-2$
-                {0L,                        'Z', "CST"}, //$NON-NLS-2$
-                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$
-                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$
-                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$
-                {paris,                     'Z', "CEST"}, //$NON-NLS-2$
-                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$
-        };
-
-
-        for (int i = 0; i < 90; i++) {
-            String formatSpecifier = "%t" + upperCaseGermanTriple[i][pattern]; //$NON-NLS-2$
-            String formatSpecifierUpper = "%T" + upperCaseGermanTriple[i][pattern]; //$NON-NLS-2$
-                    if ((Character)upperCaseGermanTriple[i][pattern] == 'N') {
-                        // result can't be predicted on RI, so skip this test
-                        continue;
-                    }
-                    // test '%t'
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(formatSpecifier, upperCaseJapanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + upperCaseJapanTriple[i][input], //$NON-NLS-2$
-                            upperCaseJapanTriple[i][output], f.toString());
-
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(Locale.GERMAN, formatSpecifier, upperCaseGermanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + upperCaseGermanTriple[i][input], //$NON-NLS-2$
-                            upperCaseGermanTriple[i][output], f.toString());
-
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(Locale.FRANCE, formatSpecifier, upperCaseFranceTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$
-                            + " Argument: " + upperCaseFranceTriple[i][input], //$NON-NLS-2$
-                            upperCaseFranceTriple[i][output], f.toString());
-
-                    // test '%T'
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(formatSpecifierUpper, upperCaseGermanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + upperCaseGermanTriple[i][input], //$NON-NLS-2$
-                            ((String)upperCaseGermanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(Locale.JAPAN, formatSpecifierUpper, upperCaseJapanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + upperCaseJapanTriple[i][input], //$NON-NLS-2$
-                            ((String)upperCaseJapanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(Locale.FRANCE, formatSpecifierUpper, upperCaseFranceTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$
-                            + " Argument: " + upperCaseFranceTriple[i][input], //$NON-NLS-2$
-                            ((String)upperCaseFranceTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%-10ta", now); //$NON-NLS-2$
-        assertEquals("Thu       ", f.toString()); //$NON-NLS-2$
-
-        f = new Formatter(Locale.US);
-        f.format("%10000000000000000000000000000000001ta", now); //$NON-NLS-2$
-        assertEquals("Thu", f.toString().trim()); //$NON-NLS-2$
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null argment for
-     *        Byte/Short/Integer/Long/BigInteger conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongNullConversion() {
-
-        Formatter f = new Formatter(Locale.FRANCE);
-        f.format("%d%<o%<x%<5X", (Integer) null);
-        assertEquals("nullnullnull NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%d%<#03o %<0#4x%<6X", (Long) null);
-        assertEquals("nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,07d%<o %<x%<6X", (Byte) null);
-        assertEquals("   nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.ITALY);
-        f.format("%(+,07d%<o %<x%<0#6X", (Short) null);
-        assertEquals("   nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);
-        assertEquals("null   nullnull   NULL", f.toString());
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        BigInteger conversion type 'd'
-     */
-    public void test_formatLjava_lang_String$LBigInteger() {
-        final Object[][] tripleD = {
-                {new BigInteger("123456789012345678901234567890"),          "%d",       "123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%10d",     "123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-1d",     "123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%+d",      "+123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "% d",      " 123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%,d",      "123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%(d",      "123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%08d",     "123456789012345678901234567890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-+,(11d", "+123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%0 ,(11d", " 123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%d",       "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%10d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-1d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%+d",      "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "% d",      "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%,d",      "-9.876.543.210.987.654.321.098.765.432.100.000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%(d",      "(9876543210987654321098765432100000)"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%08d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-+,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0 ,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"}, //$NON-NLS-2$
-        };
-        
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < tripleD.length; i++) {
-            f = new Formatter(Locale.GERMAN);
-            f.format((String) tripleD[i][pattern],
-                    tripleD[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleD[i][input] + ",pattern["
-                    + i + "]:" + tripleD[i][pattern], tripleD[i][output], f
-                    .toString());
-            
-        }
-        
-        final Object[][] tripleO = {
-                {new BigInteger("123456789012345678901234567890"),          "%o",       "143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-6o",     "143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%08o",     "143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%#o",      "0143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%0#11o",   "0143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-#9o",    "0143564417755415637016711617605322"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%o",       "-36336340043453651353467270113157312240"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-6o",     "-36336340043453651353467270113157312240"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%08o",     "-36336340043453651353467270113157312240"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%#o",      "-036336340043453651353467270113157312240"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0#11o",   "-036336340043453651353467270113157312240"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9o",    "-036336340043453651353467270113157312240"}, //$NON-NLS-2$
-        };
-        for (int i = 0; i < tripleO.length; i++) {
-            f = new Formatter(Locale.ITALY);
-            f.format((String) tripleO[i][pattern],
-                    tripleO[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleO[i][input] + ",pattern["
-                    + i + "]:" + tripleO[i][pattern], tripleO[i][output], f
-                    .toString());
-            
-        }
-        
-        final Object[][] tripleX = {
-                {new BigInteger("123456789012345678901234567890"),          "%x",       "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-8x",     "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%06x",     "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%#x",      "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%0#12x",   "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("123456789012345678901234567890"),          "%-#9x",    "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%x",       "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-8x",     "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%06x",     "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%#x",      "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0#12x",   "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9x",    "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$
-        };
-        
-        for (int i = 0; i < tripleX.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) tripleX[i][pattern],
-                    tripleX[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleX[i][input] + ",pattern["
-                    + i + "]:" + tripleX[i][pattern], tripleX[i][output], f
-                    .toString());
-            
-        }
-        
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);
-        assertEquals("null   nullnull   NULL", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for padding of
-     *        BigInteger conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerPaddingConversion() {
-        Formatter f = null;
-
-        BigInteger bigInt = new BigInteger("123456789012345678901234567890");
-        f = new Formatter(Locale.GERMAN);
-        f.format("%32d", bigInt);
-        assertEquals("  123456789012345678901234567890", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+32x", bigInt);
-        assertEquals("      +18ee90ff6c373e0ee4e3f0ad2", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% 32o", bigInt);
-        assertEquals(" 143564417755415637016711617605322", f.toString());
-
-        BigInteger negBigInt = new BigInteger(
-                "-1234567890123456789012345678901234567890");
-        f = new Formatter(Locale.GERMAN);
-        f.format("%( 040X", negBigInt);
-        assertEquals("(000003A0C92075C0DBF3B8ACBC5F96CE3F0AD2)", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+(045d", negBigInt);
-        assertEquals("(0001234567890123456789012345678901234567890)", f
-                .toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+,-(60d", negBigInt);
-        assertEquals(
-                "(1.234.567.890.123.456.789.012.345.678.901.234.567.890)     ",
-                f.toString());
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigInteger
-     *        conversion exception
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerConversionException() {
-        Formatter f = null;
-
-        final String[] flagsConversionMismatches = { "%#d", "%,o", "%,x", "%,X" };
-        for (int i = 0; i < flagsConversionMismatches.length; i++) {
-            try {
-                f = new Formatter(Locale.CHINA);
-                f.format(flagsConversionMismatches[i], new BigInteger("1"));
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingFormatWidths = { "%-0d", "%0d", "%-d", "%-0o",
-                "%0o", "%-o", "%-0x", "%0x", "%-x", "%-0X", "%0X", "%-X" };
-        for (int i = 0; i < missingFormatWidths.length; i++) {
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], new BigInteger("1"));
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-
-        final String[] illFlags = { "%+ d", "%-08d", "%+ o", "%-08o", "%+ x",
-                "%-08x", "%+ X", "%-08X" };
-        for (int i = 0; i < illFlags.length; i++) {
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], new BigInteger("1"));
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-        }
-
-        final String[] precisionExceptions = { "%.4d", "%2.5o", "%8.6x",
-                "%11.17X" };
-        for (int i = 0; i < precisionExceptions.length; i++) {
-            try {
-                f = new Formatter(Locale.US);
-                f.format(precisionExceptions[i], new BigInteger("1"));
-                fail("should throw IllegalFormatPrecisionException");
-            } catch (IllegalFormatPrecisionException e) {
-                // expected
-            }
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%D", new BigInteger("1"));
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%O", new BigInteger("1"));
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter();
-            f.format("%010000000000000000000000000000000001d", new BigInteger(
-                    "1"));
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigInteger
-     *        exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerExceptionOrder() {
-        Formatter f = null;
-        BigInteger big = new BigInteger("100");
-
-        /*
-         * Order summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * IllegalFormatPrecisionException > IllegalFormatConversionException >
-         * FormatFlagsConversionMismatchException
-         * 
-         */
-        f = new Formatter(Locale.US);
-        try {
-            // compare IllegalFormatConversionException and
-            // FormatFlagsConversionMismatchException
-            f.format("%(o", false);
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatPrecisionException and
-            // IllegalFormatConversionException
-            f.format("%.4o", false);
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // IllegalFormatPrecisionException
-            f.format("%+ .4o", big);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f.format("%+ -o", big);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        try {
-            // compare UnknownFormatConversionException and
-            // MissingFormatWidthException
-            f.format("%-O", big);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-    
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'e' and 'E'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionE() {
-        Formatter f = null;
-        final Object[][] tripleE = {
-                {0f, "%e",          "0.000000e+00"},
-                {0f, "%#.0e",       "0.e+00"},
-                {0f, "%#- (9.8e",   " 0.00000000e+00"},
-                {0f, "%#+0(8.4e",   "+0.0000e+00"},
-                {0f, "%-+(1.6e",    "+0.000000e+00"},
-                {0f, "% 0(12e",     " 0.000000e+00"},
-                
-                {101f, "%e",          "1.010000e+02"},
-                {101f, "%#.0e",       "1.e+02"},
-                {101f, "%#- (9.8e",   " 1.01000000e+02"},
-                {101f, "%#+0(8.4e",   "+1.0100e+02"},
-                {101f, "%-+(1.6e",    "+1.010000e+02"},
-                {101f, "% 0(12e",     " 1.010000e+02"},
-                
-                {1.f, "%e",          "1.000000e+00"},
-                {1.f, "%#.0e",       "1.e+00"},
-                {1.f, "%#- (9.8e",   " 1.00000000e+00"},
-                {1.f, "%#+0(8.4e",   "+1.0000e+00"},
-                {1.f, "%-+(1.6e",    "+1.000000e+00"},
-                {1.f, "% 0(12e",     " 1.000000e+00"},
-                
-                {-98f, "%e",          "-9.800000e+01"},
-                {-98f, "%#.0e",       "-1.e+02"},
-                {-98f, "%#- (9.8e",   "(9.80000000e+01)"},
-                {-98f, "%#+0(8.4e",   "(9.8000e+01)"},
-                {-98f, "%-+(1.6e",    "(9.800000e+01)"},
-                {-98f, "% 0(12e",     "(9.800000e+01)"},
-                
-                {1.23f, "%e",          "1.230000e+00"},
-                {1.23f, "%#.0e",       "1.e+00"},
-                {1.23f, "%#- (9.8e",   " 1.23000002e+00"},
-                {1.23f, "%#+0(8.4e",   "+1.2300e+00"},
-                {1.23f, "%-+(1.6e",    "+1.230000e+00"},
-                {1.23f, "% 0(12e",     " 1.230000e+00"},
-                
-                {34.1234567f, "%e",          "3.412346e+01"},
-                {34.1234567f, "%#.0e",       "3.e+01"},
-                {34.1234567f, "%#- (9.8e",   " 3.41234550e+01"},
-                {34.1234567f, "%#+0(8.4e",   "+3.4123e+01"},
-                {34.1234567f, "%-+(1.6e",    "+3.412346e+01"},
-                {34.1234567f, "% 0(12e",     " 3.412346e+01"},
-                
-                {-.12345f, "%e",          "-1.234500e-01"},
-                {-.12345f, "%#.0e",       "-1.e-01"},
-                {-.12345f, "%#- (9.8e",   "(1.23450004e-01)"},
-                {-.12345f, "%#+0(8.4e",   "(1.2345e-01)"},
-                {-.12345f, "%-+(1.6e",    "(1.234500e-01)"},
-                {-.12345f, "% 0(12e",     "(1.234500e-01)"},
-                
-                {-9876.1234567f, "%e",          "-9.876123e+03"},
-                {-9876.1234567f, "%#.0e",       "-1.e+04"},
-                {-9876.1234567f, "%#- (9.8e",   "(9.87612305e+03)"},
-                {-9876.1234567f, "%#+0(8.4e",   "(9.8761e+03)"},
-                {-9876.1234567f, "%-+(1.6e",    "(9.876123e+03)"},
-                {-9876.1234567f, "% 0(12e",     "(9.876123e+03)"},
-                
-                {Float.MAX_VALUE, "%e",          "3.402823e+38"},
-                {Float.MAX_VALUE, "%#.0e",       "3.e+38"},
-                {Float.MAX_VALUE, "%#- (9.8e",   " 3.40282347e+38"},
-                {Float.MAX_VALUE, "%#+0(8.4e",   "+3.4028e+38"},
-                {Float.MAX_VALUE, "%-+(1.6e",    "+3.402823e+38"},
-                {Float.MAX_VALUE, "% 0(12e",     " 3.402823e+38"},
-                
-                {Float.MIN_VALUE, "%e",          "1.401298e-45"},
-                {Float.MIN_VALUE, "%#.0e",       "1.e-45"},
-                {Float.MIN_VALUE, "%#- (9.8e",   " 1.40129846e-45"},
-                {Float.MIN_VALUE, "%#+0(8.4e",   "+1.4013e-45"},
-                {Float.MIN_VALUE, "%-+(1.6e",    "+1.401298e-45"},
-                {Float.MIN_VALUE, "% 0(12e",     " 1.401298e-45"},
-                
-                {Float.NaN, "%e",          "NaN"},
-                {Float.NaN, "%#.0e",       "NaN"},
-                {Float.NaN, "%#- (9.8e",   "NaN      "},
-                {Float.NaN, "%#+0(8.4e",   "     NaN"},
-                {Float.NaN, "%-+(1.6e",    "NaN"},
-                {Float.NaN, "% 0(12e",     "         NaN"},
-                
-                
-                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-                
-                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-                
-                {0d, "%e",          "0.000000e+00"},
-                {0d, "%#.0e",       "0.e+00"},
-                {0d, "%#- (9.8e",   " 0.00000000e+00"},
-                {0d, "%#+0(8.4e",   "+0.0000e+00"},
-                {0d, "%-+(1.6e",    "+0.000000e+00"},
-                {0d, "% 0(12e",     " 0.000000e+00"},
-                
-                {1d, "%e",          "1.000000e+00"},
-                {1d, "%#.0e",       "1.e+00"},
-                {1d, "%#- (9.8e",   " 1.00000000e+00"},
-                {1d, "%#+0(8.4e",   "+1.0000e+00"},
-                {1d, "%-+(1.6e",    "+1.000000e+00"},
-                {1d, "% 0(12e",     " 1.000000e+00"},
-                
-                {-1d, "%e",          "-1.000000e+00"},
-                {-1d, "%#.0e",       "-1.e+00"},
-                {-1d, "%#- (9.8e",   "(1.00000000e+00)"},
-                {-1d, "%#+0(8.4e",   "(1.0000e+00)"},
-                {-1d, "%-+(1.6e",    "(1.000000e+00)"},
-                {-1d, "% 0(12e",     "(1.000000e+00)"},
-                
-                
-                {.00000001d, "%e",          "1.000000e-08"},
-                {.00000001d, "%#.0e",       "1.e-08"},
-                {.00000001d, "%#- (9.8e",   " 1.00000000e-08"},
-                {.00000001d, "%#+0(8.4e",   "+1.0000e-08"},
-                {.00000001d, "%-+(1.6e",    "+1.000000e-08"},
-                {.00000001d, "% 0(12e",     " 1.000000e-08"},
-                
-                {9122.10d, "%e",          "9.122100e+03"},
-                {9122.10d, "%#.0e",       "9.e+03"},
-                {9122.10d, "%#- (9.8e",   " 9.12210000e+03"},
-                {9122.10d, "%#+0(8.4e",   "+9.1221e+03"},
-                {9122.10d, "%-+(1.6e",    "+9.122100e+03"},
-                {9122.10d, "% 0(12e",     " 9.122100e+03"},
-                
-                {0.1d, "%e",          "1.000000e-01"},
-                {0.1d, "%#.0e",       "1.e-01"},
-                {0.1d, "%#- (9.8e",   " 1.00000000e-01"},
-                {0.1d, "%#+0(8.4e",   "+1.0000e-01"},
-                {0.1d, "%-+(1.6e",    "+1.000000e-01"},
-                {0.1d, "% 0(12e",     " 1.000000e-01"},
-                
-                {-2.d, "%e",          "-2.000000e+00"},
-                {-2.d, "%#.0e",       "-2.e+00"},
-                {-2.d, "%#- (9.8e",   "(2.00000000e+00)"},
-                {-2.d, "%#+0(8.4e",   "(2.0000e+00)"},
-                {-2.d, "%-+(1.6e",    "(2.000000e+00)"},
-                {-2.d, "% 0(12e",     "(2.000000e+00)"},
-                
-                {-.39d, "%e",          "-3.900000e-01"},
-                {-.39d, "%#.0e",       "-4.e-01"},
-                {-.39d, "%#- (9.8e",   "(3.90000000e-01)"},
-                {-.39d, "%#+0(8.4e",   "(3.9000e-01)"},
-                {-.39d, "%-+(1.6e",    "(3.900000e-01)"},
-                {-.39d, "% 0(12e",     "(3.900000e-01)"},
-                
-                {-1234567890.012345678d, "%e",          "-1.234568e+09"},
-                {-1234567890.012345678d, "%#.0e",       "-1.e+09"},
-                {-1234567890.012345678d, "%#- (9.8e",   "(1.23456789e+09)"},
-                {-1234567890.012345678d, "%#+0(8.4e",   "(1.2346e+09)"},
-                {-1234567890.012345678d, "%-+(1.6e",    "(1.234568e+09)"},
-                {-1234567890.012345678d, "% 0(12e",     "(1.234568e+09)"},
-                
-                {Double.MAX_VALUE, "%e",          "1.797693e+308"},
-                {Double.MAX_VALUE, "%#.0e",       "2.e+308"},
-                {Double.MAX_VALUE, "%#- (9.8e",   " 1.79769313e+308"},
-                {Double.MAX_VALUE, "%#+0(8.4e",   "+1.7977e+308"},
-                {Double.MAX_VALUE, "%-+(1.6e",    "+1.797693e+308"},
-                {Double.MAX_VALUE, "% 0(12e",     " 1.797693e+308"},
-                
-                {Double.MIN_VALUE, "%e",          "4.900000e-324"},
-                {Double.MIN_VALUE, "%#.0e",       "5.e-324"},
-                {Double.MIN_VALUE, "%#- (9.8e",   " 4.90000000e-324"},
-                {Double.MIN_VALUE, "%#+0(8.4e",   "+4.9000e-324"},
-                {Double.MIN_VALUE, "%-+(1.6e",    "+4.900000e-324"},
-                {Double.MIN_VALUE, "% 0(12e",     " 4.900000e-324"},
-                
-                {Double.NaN, "%e",          "NaN"},
-                {Double.NaN, "%#.0e",       "NaN"},
-                {Double.NaN, "%#- (9.8e",   "NaN      "},
-                {Double.NaN, "%#+0(8.4e",   "     NaN"},
-                {Double.NaN, "%-+(1.6e",    "NaN"},
-                {Double.NaN, "% 0(12e",     "         NaN"},
-                
-                {Double.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-                
-                {Double.POSITIVE_INFINITY, "%e",          "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.0e",       "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#- (9.8e",   " Infinity"},
-                {Double.POSITIVE_INFINITY, "%#+0(8.4e",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(1.6e",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0(12e",     "    Infinity"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleE.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleE[i][pattern], tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern],
-                        tripleE[i][output], f.toString());
-
-                // test for conversion type 'E'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%e", 1001f);
-        /*
-         * fail on RI, spec says 'e' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 1.001000e+03, which does not
-         * conform to the German Locale
-         */
-        assertEquals("1,001000e+03", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'g' and 'G'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG() {
-        Formatter f = null;
-        final Object[][] tripleG = {
-                {1001f, "%g",           "1001.00"},
-                {1001f, "%- (,9.8g",    " 1,001.0000"},
-                {1001f, "%+0(,8.4g",    "+001,001"},
-                {1001f, "%-+(,1.6g",    "+1,001.00"},
-                {1001f, "% 0(,12.0g",   " 0000001e+03"},
-                
-                {1.f, "%g",           "1.00000"},
-                {1.f, "%- (,9.8g",    " 1.0000000"},
-                {1.f, "%+0(,8.4g",    "+001.000"},
-                {1.f, "%-+(,1.6g",    "+1.00000"},
-                {1.f, "% 0(,12.0g",   " 00000000001"},
-                
-                {-98f, "%g",           "-98.0000"},
-                {-98f, "%- (,9.8g",    "(98.000000)"},
-                {-98f, "%+0(,8.4g",    "(098.00)"},
-                {-98f, "%-+(,1.6g",    "(98.0000)"},
-                {-98f, "% 0(,12.0g",   "(000001e+02)"},
-                
-                {0.000001f, "%g",           "1.00000e-06"},
-                {0.000001f, "%- (,9.8g",    " 1.0000000e-06"},
-                {0.000001f, "%+0(,8.4g",    "+1.000e-06"},
-                {0.000001f, "%-+(,1.6g",    "+1.00000e-06"},
-                {0.000001f, "% 0(,12.0g",   " 0000001e-06"},
-                
-                {345.1234567f, "%g",           "345.123"},
-                {345.1234567f, "%- (,9.8g",    " 345.12344"},
-                {345.1234567f, "%+0(,8.4g",    "+00345.1"},
-                {345.1234567f, "%-+(,1.6g",    "+345.123"},
-                {345.1234567f, "% 0(,12.0g",   " 0000003e+02"},
-
-                {-.00000012345f, "%g",           "-1.23450e-07"},
-                {-.00000012345f, "%- (,9.8g",    "(1.2344999e-07)"},
-                {-.00000012345f, "%+0(,8.4g",    "(1.234e-07)"},
-                {-.00000012345f, "%-+(,1.6g",    "(1.23450e-07)"},
-                {-.00000012345f, "% 0(,12.0g",   "(000001e-07)"},
-                
-                {-987.1234567f, "%g",           "-987.123"},
-                {-987.1234567f, "%- (,9.8g",    "(987.12347)"},
-                {-987.1234567f, "%+0(,8.4g",    "(0987.1)"},
-                {-987.1234567f, "%-+(,1.6g",    "(987.123)"},
-                {-987.1234567f, "% 0(,12.0g",   "(000001e+03)"},
-                
-                {Float.MAX_VALUE, "%g",           "3.40282e+38"},
-                {Float.MAX_VALUE, "%- (,9.8g",    " 3.4028235e+38"},
-                {Float.MAX_VALUE, "%+0(,8.4g",    "+3.403e+38"},
-                {Float.MAX_VALUE, "%-+(,1.6g",    "+3.40282e+38"},
-                {Float.MAX_VALUE, "% 0(,12.0g",   " 0000003e+38"},
-                
-                {Float.MIN_VALUE, "%g",           "1.40130e-45"},
-                {Float.MIN_VALUE, "%- (,9.8g",    " 1.4012985e-45"},
-                {Float.MIN_VALUE, "%+0(,8.4g",    "+1.401e-45"},
-                {Float.MIN_VALUE, "%-+(,1.6g",    "+1.40130e-45"},
-                {Float.MIN_VALUE, "% 0(,12.0g",   " 0000001e-45"},
-                
-                {Float.NaN, "%g",           "NaN"},
-                {Float.NaN, "%- (,9.8g",    "NaN      "},
-                {Float.NaN, "%+0(,8.4g",    "     NaN"},
-                {Float.NaN, "%-+(,1.6g",    "NaN"},
-                {Float.NaN, "% 0(,12.0g",   "         NaN"},
-                
-                {Float.NEGATIVE_INFINITY, "%g",           "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},
-                
-                {Float.POSITIVE_INFINITY, "%g",           "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},
-                {Float.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},
-                
-                {1d, "%g",           "1.00000"},
-                {1d, "%- (,9.8g",    " 1.0000000"},
-                {1d, "%+0(,8.4g",    "+001.000"},
-                {1d, "%-+(,1.6g",    "+1.00000"},
-                {1d, "% 0(,12.0g",   " 00000000001"},
-                
-                {-1d, "%g",           "-1.00000"},
-                {-1d, "%- (,9.8g",    "(1.0000000)"},
-                {-1d, "%+0(,8.4g",    "(01.000)"},
-                {-1d, "%-+(,1.6g",    "(1.00000)"},
-                {-1d, "% 0(,12.0g",   "(0000000001)"},
-                
-                {.00000001d, "%g",           "1.00000e-08"},
-                {.00000001d, "%- (,9.8g",    " 1.0000000e-08"},
-                {.00000001d, "%+0(,8.4g",    "+1.000e-08"},
-                {.00000001d, "%-+(,1.6g",    "+1.00000e-08"},
-                {.00000001d, "% 0(,12.0g",   " 0000001e-08"},
-                
-                {1912.10d, "%g",           "1912.10"},
-                {1912.10d, "%- (,9.8g",    " 1,912.1000"},
-                {1912.10d, "%+0(,8.4g",    "+001,912"},
-                {1912.10d, "%-+(,1.6g",    "+1,912.10"},
-                {1912.10d, "% 0(,12.0g",   " 0000002e+03"},
-                
-                {0.1d, "%g",           "0.100000"},
-                {0.1d, "%- (,9.8g",    " 0.10000000"},
-                {0.1d, "%+0(,8.4g",    "+00.1000"},
-                {0.1d, "%-+(,1.6g",    "+0.100000"},
-                {0.1d, "% 0(,12.0g",   " 000000000.1"},
-                
-                {-2.d, "%g",           "-2.00000"},
-                {-2.d, "%- (,9.8g",    "(2.0000000)"},
-                {-2.d, "%+0(,8.4g",    "(02.000)"},
-                {-2.d, "%-+(,1.6g",    "(2.00000)"},
-                {-2.d, "% 0(,12.0g",   "(0000000002)"},
-                
-                {-.00039d, "%g",           "-0.000390000"},
-                {-.00039d, "%- (,9.8g",    "(0.00039000000)"},
-                {-.00039d, "%+0(,8.4g",    "(0.0003900)"},
-                {-.00039d, "%-+(,1.6g",    "(0.000390000)"},
-                {-.00039d, "% 0(,12.0g",   "(00000.0004)"},
-                
-                {-1234567890.012345678d, "%g",           "-1.23457e+09"},
-                {-1234567890.012345678d, "%- (,9.8g",    "(1.2345679e+09)"},
-                {-1234567890.012345678d, "%+0(,8.4g",    "(1.235e+09)"},
-                {-1234567890.012345678d, "%-+(,1.6g",    "(1.23457e+09)"},
-                {-1234567890.012345678d, "% 0(,12.0g",   "(000001e+09)"},
-                
-                {Double.MAX_VALUE, "%g",           "1.79769e+308"},
-                {Double.MAX_VALUE, "%- (,9.8g",    " 1.7976931e+308"},
-                {Double.MAX_VALUE, "%+0(,8.4g",    "+1.798e+308"},
-                {Double.MAX_VALUE, "%-+(,1.6g",    "+1.79769e+308"},
-                {Double.MAX_VALUE, "% 0(,12.0g",   " 000002e+308"},
-                
-                {Double.MIN_VALUE, "%g",           "4.90000e-324"},
-                {Double.MIN_VALUE, "%- (,9.8g",    " 4.9000000e-324"},
-                {Double.MIN_VALUE, "%+0(,8.4g",    "+4.900e-324"},
-                {Double.MIN_VALUE, "%-+(,1.6g",    "+4.90000e-324"},
-                {Double.MIN_VALUE, "% 0(,12.0g",   " 000005e-324"},
-                
-                {Double.NaN, "%g",           "NaN"},
-                {Double.NaN, "%- (,9.8g",    "NaN      "},
-                {Double.NaN, "%+0(,8.4g",    "     NaN"},
-                {Double.NaN, "%-+(,1.6g",    "NaN"},
-                {Double.NaN, "% 0(,12.0g",   "         NaN"},
-                
-                {Double.NEGATIVE_INFINITY, "%g",           "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},
-                
-                {Double.POSITIVE_INFINITY, "%g",           "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},
-                {Double.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},
-                
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleG.length; i++) {
-                
-                f = new Formatter(Locale.US);
-                f.format((String)tripleG[i][pattern], tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern],
-                        tripleG[i][output], f.toString());
-
-                // test for conversion type 'G'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-
-        f = new Formatter(Locale.US);
-        f.format("%.5g", 0f);
-        assertEquals("0.0000", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%.0g", 0f);
-        /*
-         * fail on RI, spec says if the precision is 0, then it is taken to be
-         * 1. but RI throws ArrayIndexOutOfBoundsException.
-         */
-        assertEquals("0", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%g", 1001f);
-        /*
-         * fail on RI, spec says 'g' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 1001.00, which does not conform
-         * to the German Locale
-         */
-        assertEquals("1001,00", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'g' and 'G' overflow
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG_Overflow() {
-        Formatter f = new Formatter();
-        f.format("%g", 999999.5);
-        assertEquals("1.00000e+06", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 99999.5);
-        assertEquals("99999.5", f.toString());
-
-        f = new Formatter();
-        f.format("%.4g", 99.95);
-        assertEquals("99.95", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 99.95);
-        assertEquals("99.9500", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.9);
-        assertEquals("0.900000", f.toString());
-
-        f = new Formatter();
-        f.format("%.0g", 0.000095);
-        assertEquals("0.0001", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.0999999);
-        assertEquals("0.0999999", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.00009);
-        assertEquals("9.00000e-05", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'f'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionF() {
-        Formatter f = null;
-
-        final Object[][] tripleF = {
-                {0f, "%f",          "0,000000"},
-                {0f, "%#.3f",       "0,000"},
-                {0f, "%,5f",        "0,000000"},
-                {0f, "%- (12.0f",   " 0          "},
-                {0f, "%#+0(1.6f",   "+0,000000"},
-                {0f, "%-+(8.4f",    "+0,0000 "},
-                {0f, "% 0#(9.8f",   " 0,00000000"},
-                
-                {1234f, "%f",          "1234,000000"},
-                {1234f, "%#.3f",       "1234,000"},
-                {1234f, "%,5f",        "1.234,000000"},
-                {1234f, "%- (12.0f",   " 1234       "},
-                {1234f, "%#+0(1.6f",   "+1234,000000"},
-                {1234f, "%-+(8.4f",    "+1234,0000"},
-                {1234f, "% 0#(9.8f",   " 1234,00000000"},
-                
-                {1.f, "%f",          "1,000000"},
-                {1.f, "%#.3f",       "1,000"},
-                {1.f, "%,5f",        "1,000000"},
-                {1.f, "%- (12.0f",   " 1          "},
-                {1.f, "%#+0(1.6f",   "+1,000000"},
-                {1.f, "%-+(8.4f",    "+1,0000 "},
-                {1.f, "% 0#(9.8f",   " 1,00000000"},
-                
-                {-98f, "%f",          "-98,000000"},
-                {-98f, "%#.3f",       "-98,000"},
-                {-98f, "%,5f",        "-98,000000"},
-                {-98f, "%- (12.0f",   "(98)        "},
-                {-98f, "%#+0(1.6f",   "(98,000000)"},
-                {-98f, "%-+(8.4f",    "(98,0000)"},
-                {-98f, "% 0#(9.8f",   "(98,00000000)"},
-                
-                {0.000001f, "%f",          "0,000001"},
-                {0.000001f, "%#.3f",       "0,000"},
-                {0.000001f, "%,5f",        "0,000001"},
-                {0.000001f, "%- (12.0f",   " 0          "},
-                {0.000001f, "%#+0(1.6f",   "+0,000001"},
-                {0.000001f, "%-+(8.4f",    "+0,0000 "},
-                {0.000001f, "% 0#(9.8f",   " 0,00000100"},
-                
-                {345.1234567f, "%f",          "345,123444"},
-                {345.1234567f, "%#.3f",       "345,123"},
-                {345.1234567f, "%,5f",        "345,123444"},
-                {345.1234567f, "%- (12.0f",   " 345        "},
-                {345.1234567f, "%#+0(1.6f",   "+345,123444"},
-                {345.1234567f, "%-+(8.4f",    "+345,1234"},
-                {345.1234567f, "% 0#(9.8f",   " 345,12344360"},
-                
-                {-.00000012345f, "%f",          "-0,000000"},
-                {-.00000012345f, "%#.3f",       "-0,000"},
-                {-.00000012345f, "%,5f",        "-0,000000"},
-                {-.00000012345f, "%- (12.0f",   "(0)         "},
-                {-.00000012345f, "%#+0(1.6f",   "(0,000000)"},
-                {-.00000012345f, "%-+(8.4f",    "(0,0000)"},
-                {-.00000012345f, "% 0#(9.8f",   "(0,00000012)"},
-                
-                {-987654321.1234567f, "%f",          "-987654336,000000"},
-                {-987654321.1234567f, "%#.3f",       "-987654336,000"},
-                {-987654321.1234567f, "%,5f",        "-987.654.336,000000"},
-                {-987654321.1234567f, "%- (12.0f",   "(987654336) "},
-                {-987654321.1234567f, "%#+0(1.6f",   "(987654336,000000)"},
-                {-987654321.1234567f, "%-+(8.4f",    "(987654336,0000)"},
-                {-987654321.1234567f, "% 0#(9.8f",   "(987654336,00000000)"},
-                
-                {Float.MAX_VALUE, "%f",          "340282346638528860000000000000000000000,000000"},
-                {Float.MAX_VALUE, "%#.3f",       "340282346638528860000000000000000000000,000"},
-                {Float.MAX_VALUE, "%,5f",        "340.282.346.638.528.860.000.000.000.000.000.000.000,000000"},
-                {Float.MAX_VALUE, "%- (12.0f",   " 340282346638528860000000000000000000000"},
-                {Float.MAX_VALUE, "%#+0(1.6f",   "+340282346638528860000000000000000000000,000000"},
-                {Float.MAX_VALUE, "%-+(8.4f",    "+340282346638528860000000000000000000000,0000"},
-                {Float.MAX_VALUE, "% 0#(9.8f",   " 340282346638528860000000000000000000000,00000000"},
-                
-                {Float.MIN_VALUE, "%f",          "0,000000"},
-                {Float.MIN_VALUE, "%#.3f",       "0,000"},
-                {Float.MIN_VALUE, "%,5f",        "0,000000"},
-                {Float.MIN_VALUE, "%- (12.0f",   " 0          "},
-                {Float.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},
-                {Float.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},
-                {Float.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},
-                
-                {Float.NaN, "%f",          "NaN"},
-                {Float.NaN, "%#.3f",       "NaN"},
-                {Float.NaN, "%,5f",        "  NaN"},
-                {Float.NaN, "%- (12.0f",   "NaN         "},
-                {Float.NaN, "%#+0(1.6f",   "NaN"},
-                {Float.NaN, "%-+(8.4f",    "NaN     "},
-                {Float.NaN, "% 0#(9.8f",   "      NaN"},
-                
-                {Float.NEGATIVE_INFINITY, "%f",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},
-                {Float.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},
-                
-                {Float.POSITIVE_INFINITY, "%f",          "Infinity"},
-                {Float.POSITIVE_INFINITY, "%#.3f",       "Infinity"},
-                {Float.POSITIVE_INFINITY, "%,5f",        "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},
-                {Float.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},
-                
-                
-                {0d, "%f",          "0,000000"},
-                {0d, "%#.3f",       "0,000"},
-                {0d, "%,5f",        "0,000000"},
-                {0d, "%- (12.0f",   " 0          "},
-                {0d, "%#+0(1.6f",   "+0,000000"},
-                {0d, "%-+(8.4f",    "+0,0000 "},
-                {0d, "% 0#(9.8f",   " 0,00000000"},
-                
-                {1d, "%f",          "1,000000"},
-                {1d, "%#.3f",       "1,000"},
-                {1d, "%,5f",        "1,000000"},
-                {1d, "%- (12.0f",   " 1          "},
-                {1d, "%#+0(1.6f",   "+1,000000"},
-                {1d, "%-+(8.4f",    "+1,0000 "},
-                {1d, "% 0#(9.8f",   " 1,00000000"},
-                
-                {-1d, "%f",          "-1,000000"},
-                {-1d, "%#.3f",       "-1,000"},
-                {-1d, "%,5f",        "-1,000000"},
-                {-1d, "%- (12.0f",   "(1)         "},
-                {-1d, "%#+0(1.6f",   "(1,000000)"},
-                {-1d, "%-+(8.4f",    "(1,0000)"},
-                {-1d, "% 0#(9.8f",   "(1,00000000)"},
-                
-                {.00000001d, "%f",          "0,000000"},
-                {.00000001d, "%#.3f",       "0,000"},
-                {.00000001d, "%,5f",        "0,000000"},
-                {.00000001d, "%- (12.0f",   " 0          "},
-                {.00000001d, "%#+0(1.6f",   "+0,000000"},
-                {.00000001d, "%-+(8.4f",    "+0,0000 "},
-                {.00000001d, "% 0#(9.8f",   " 0,00000001"},
-                
-                {1000.10d, "%f",          "1000,100000"},
-                {1000.10d, "%#.3f",       "1000,100"},
-                {1000.10d, "%,5f",        "1.000,100000"},
-                {1000.10d, "%- (12.0f",   " 1000       "},
-                {1000.10d, "%#+0(1.6f",   "+1000,100000"},
-                {1000.10d, "%-+(8.4f",    "+1000,1000"},
-                {1000.10d, "% 0#(9.8f",   " 1000,10000000"},
-                
-                {0.1d, "%f",          "0,100000"},
-                {0.1d, "%#.3f",       "0,100"},
-                {0.1d, "%,5f",        "0,100000"},
-                {0.1d, "%- (12.0f",   " 0          "},
-                {0.1d, "%#+0(1.6f",   "+0,100000"},
-                {0.1d, "%-+(8.4f",    "+0,1000 "},
-                {0.1d, "% 0#(9.8f",   " 0,10000000"},
-                
-                {-2.d, "%f",          "-2,000000"},
-                {-2.d, "%#.3f",       "-2,000"},
-                {-2.d, "%,5f",        "-2,000000"},
-                {-2.d, "%- (12.0f",   "(2)         "},
-                {-2.d, "%#+0(1.6f",   "(2,000000)"},
-                {-2.d, "%-+(8.4f",    "(2,0000)"},
-                {-2.d, "% 0#(9.8f",   "(2,00000000)"},
-                
-                {-.00009d, "%f",          "-0,000090"},
-                {-.00009d, "%#.3f",       "-0,000"},
-                {-.00009d, "%,5f",        "-0,000090"},
-                {-.00009d, "%- (12.0f",   "(0)         "},
-                {-.00009d, "%#+0(1.6f",   "(0,000090)"},
-                {-.00009d, "%-+(8.4f",    "(0,0001)"},
-                {-.00009d, "% 0#(9.8f",   "(0,00009000)"},
-                
-                {-1234567890.012345678d, "%f",          "-1234567890,012346"},
-                {-1234567890.012345678d, "%#.3f",       "-1234567890,012"},
-                {-1234567890.012345678d, "%,5f",        "-1.234.567.890,012346"},
-                {-1234567890.012345678d, "%- (12.0f",   "(1234567890)"},
-                {-1234567890.012345678d, "%#+0(1.6f",   "(1234567890,012346)"},
-                {-1234567890.012345678d, "%-+(8.4f",    "(1234567890,0123)"},
-                {-1234567890.012345678d, "% 0#(9.8f",   "(1234567890,01234580)"},
-                
-                {Double.MAX_VALUE, "%f",          "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},
-                {Double.MAX_VALUE, "%#.3f",       "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000"},
-                {Double.MAX_VALUE, "%,5f",        "179.769.313.486.231.570.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,000000"},
-                {Double.MAX_VALUE, "%- (12.0f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},
-                {Double.MAX_VALUE, "%#+0(1.6f",   "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},
-                {Double.MAX_VALUE, "%-+(8.4f",    "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,0000"},
-                {Double.MAX_VALUE, "% 0#(9.8f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,00000000"},
-                
-                {Double.MIN_VALUE, "%f",          "0,000000"},
-                {Double.MIN_VALUE, "%#.3f",       "0,000"},
-                {Double.MIN_VALUE, "%,5f",        "0,000000"},
-                {Double.MIN_VALUE, "%- (12.0f",   " 0          "},
-                {Double.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},
-                {Double.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},
-                {Double.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},
-                
-                {Double.NaN, "%f",          "NaN"},
-                {Double.NaN, "%#.3f",       "NaN"},
-                {Double.NaN, "%,5f",        "  NaN"},
-                {Double.NaN, "%- (12.0f",   "NaN         "},
-                {Double.NaN, "%#+0(1.6f",   "NaN"},
-                {Double.NaN, "%-+(8.4f",    "NaN     "},
-                {Double.NaN, "% 0#(9.8f",   "      NaN"},
-                
-                {Double.POSITIVE_INFINITY, "%f",          "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.3f",       "Infinity"},
-                {Double.POSITIVE_INFINITY, "%,5f",        "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},
-                {Double.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},
-                
-                {Double.NEGATIVE_INFINITY, "%f",          "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},
-                {Double.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleF.length; i++) {
-                f = new Formatter(Locale.GERMAN);
-                f.format((String)tripleF[i][pattern], tripleF[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["
-                        + i + "]:" + tripleF[i][pattern],
-                        tripleF[i][output], f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'a' and 'A'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionA() {
-        Formatter f = null;
-        final Object[][] tripleA = {
-                {-0f, "%a",         "-0x0.0p0"},
-                {-0f, "%#.3a",      "-0x0.000p0"},
-                {-0f, "%5a",        "-0x0.0p0"},
-                {-0f, "%- 12.0a",   "-0x0.0p0    "},
-                {-0f, "%#+01.6a",   "-0x0.000000p0"},
-                {-0f, "%-+8.4a",    "-0x0.0000p0"},
-                
-                {0f, "%a",         "0x0.0p0"},
-                {0f, "%#.3a",      "0x0.000p0"},
-                {0f, "%5a",        "0x0.0p0"},
-                {0f, "%- 12.0a",   " 0x0.0p0    "},
-                {0f, "%#+01.6a",   "+0x0.000000p0"},
-                {0f, "%-+8.4a",    "+0x0.0000p0"},
-                
-                {1234f, "%a",         "0x1.348p10"},
-                {1234f, "%#.3a",      "0x1.348p10"},
-                {1234f, "%5a",        "0x1.348p10"},
-                {1234f, "%- 12.0a",   " 0x1.3p10   "},
-                {1234f, "%#+01.6a",   "+0x1.348000p10"},
-                {1234f, "%-+8.4a",    "+0x1.3480p10"},
-                
-                {1.f, "%a",         "0x1.0p0"},
-                {1.f, "%#.3a",      "0x1.000p0"},
-                {1.f, "%5a",        "0x1.0p0"},
-                {1.f, "%- 12.0a",   " 0x1.0p0    "},
-                {1.f, "%#+01.6a",   "+0x1.000000p0"},
-                {1.f, "%-+8.4a",    "+0x1.0000p0"},
-                
-                {-98f, "%a",         "-0x1.88p6"},
-                {-98f, "%#.3a",      "-0x1.880p6"},
-                {-98f, "%5a",        "-0x1.88p6"},
-                {-98f, "%- 12.0a",   "-0x1.8p6    "},
-                {-98f, "%#+01.6a",   "-0x1.880000p6"},
-                {-98f, "%-+8.4a",    "-0x1.8800p6"},
-                
-                {345.1234567f, "%a",         "0x1.591f9ap8"},
-                {345.1234567f, "%5a",        "0x1.591f9ap8"},
-                {345.1234567f, "%#+01.6a",   "+0x1.591f9ap8"},
-                
-                {-987654321.1234567f, "%a",         "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%#.3a",      "-0x1.d6fp29"},
-                {-987654321.1234567f, "%5a",        "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%- 12.0a",   "-0x1.dp29   "},
-                {-987654321.1234567f, "%#+01.6a",   "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%-+8.4a",    "-0x1.d6f3p29"},
-                
-                {Float.MAX_VALUE, "%a",         "0x1.fffffep127"},
-                {Float.MAX_VALUE, "%5a",        "0x1.fffffep127"},
-                {Float.MAX_VALUE, "%#+01.6a",   "+0x1.fffffep127"},
-                
-                {Float.NaN, "%a",         "NaN"},
-                {Float.NaN, "%#.3a",      "NaN"},
-                {Float.NaN, "%5a",        "  NaN"},
-                {Float.NaN, "%- 12.0a",   "NaN         "},
-                {Float.NaN, "%#+01.6a",   "NaN"},
-                {Float.NaN, "%-+8.4a",    "NaN     "},
-                
-                {Float.NEGATIVE_INFINITY, "%a",         "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%5a",        "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},
-                {Float.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},
-                
-                {Float.POSITIVE_INFINITY, "%a",         "Infinity"},
-                {Float.POSITIVE_INFINITY, "%#.3a",      "Infinity"},
-                {Float.POSITIVE_INFINITY, "%5a",        "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},
-                {Float.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},
-                
-                {-0d, "%a",         "-0x0.0p0"},
-                {-0d, "%#.3a",      "-0x0.000p0"},
-                {-0d, "%5a",        "-0x0.0p0"},
-                {-0d, "%- 12.0a",   "-0x0.0p0    "},
-                {-0d, "%#+01.6a",   "-0x0.000000p0"},
-                {-0d, "%-+8.4a",    "-0x0.0000p0"},
-
-                {0d, "%a",         "0x0.0p0"},
-                {0d, "%#.3a",      "0x0.000p0"},
-                {0d, "%5a",        "0x0.0p0"},
-                {0d, "%- 12.0a",   " 0x0.0p0    "},
-                {0d, "%#+01.6a",   "+0x0.000000p0"},
-                {0d, "%-+8.4a",    "+0x0.0000p0"},
-                
-                {1d, "%a",         "0x1.0p0"},
-                {1d, "%#.3a",      "0x1.000p0"},
-                {1d, "%5a",        "0x1.0p0"},
-                {1d, "%- 12.0a",   " 0x1.0p0    "},
-                {1d, "%#+01.6a",   "+0x1.000000p0"},
-                {1d, "%-+8.4a",    "+0x1.0000p0"},
-                
-                {-1d, "%a",         "-0x1.0p0"},
-                {-1d, "%#.3a",      "-0x1.000p0"},
-                {-1d, "%5a",        "-0x1.0p0"},
-                {-1d, "%- 12.0a",   "-0x1.0p0    "},
-                {-1d, "%#+01.6a",   "-0x1.000000p0"},
-                {-1d, "%-+8.4a",    "-0x1.0000p0"},
-                
-                {.00000001d, "%a",         "0x1.5798ee2308c3ap-27"},
-                {.00000001d, "%5a",        "0x1.5798ee2308c3ap-27"},
-                {.00000001d, "%- 12.0a",   " 0x1.5p-27  "},
-                {.00000001d, "%#+01.6a",   "+0x1.5798eep-27"},
-                
-                {1000.10d, "%a",         "0x1.f40cccccccccdp9"},
-                {1000.10d, "%5a",        "0x1.f40cccccccccdp9"},
-                {1000.10d, "%- 12.0a",   " 0x1.fp9    "},
-                
-                {0.1d, "%a",         "0x1.999999999999ap-4"},
-                {0.1d, "%5a",        "0x1.999999999999ap-4"},
-                
-                {-2.d, "%a",         "-0x1.0p1"},
-                {-2.d, "%#.3a",      "-0x1.000p1"},
-                {-2.d, "%5a",        "-0x1.0p1"},
-                {-2.d, "%- 12.0a",   "-0x1.0p1    "},
-                {-2.d, "%#+01.6a",   "-0x1.000000p1"},
-                {-2.d, "%-+8.4a",    "-0x1.0000p1"},
-                
-                {-.00009d, "%a",         "-0x1.797cc39ffd60fp-14"},
-                {-.00009d, "%5a",        "-0x1.797cc39ffd60fp-14"},
-                
-                {-1234567890.012345678d, "%a",         "-0x1.26580b480ca46p30"},
-                {-1234567890.012345678d, "%5a",        "-0x1.26580b480ca46p30"},
-                {-1234567890.012345678d, "%- 12.0a",   "-0x1.2p30   "},
-                {-1234567890.012345678d, "%#+01.6a",   "-0x1.26580bp30"},
-                {-1234567890.012345678d, "%-+8.4a",    "-0x1.2658p30"},
-                
-                {Double.MAX_VALUE, "%a",         "0x1.fffffffffffffp1023"},
-                {Double.MAX_VALUE, "%5a",        "0x1.fffffffffffffp1023"},
-                
-                {Double.MIN_VALUE, "%a",         "0x0.0000000000001p-1022"},
-                {Double.MIN_VALUE, "%5a",        "0x0.0000000000001p-1022"},
-                
-                {Double.NaN, "%a",         "NaN"},
-                {Double.NaN, "%#.3a",      "NaN"},
-                {Double.NaN, "%5a",        "  NaN"},
-                {Double.NaN, "%- 12.0a",   "NaN         "},
-                {Double.NaN, "%#+01.6a",   "NaN"},
-                {Double.NaN, "%-+8.4a",    "NaN     "},
-                
-                {Double.NEGATIVE_INFINITY, "%a",         "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%5a",        "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},
-                {Double.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},
-                
-                {Double.POSITIVE_INFINITY, "%a",         "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.3a",      "Infinity"},
-                {Double.POSITIVE_INFINITY, "%5a",        "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},
-                {Double.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},
-                
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleA.length; i++) {
-                f = new Formatter(Locale.UK);
-                f.format((String)tripleA[i][pattern], tripleA[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["
-                        + i + "]:" + tripleA[i][pattern],
-                        tripleA[i][output], f.toString());
-
-                // test for conversion type 'A'
-                f = new Formatter(Locale.UK);
-                f.format(((String)tripleA[i][pattern]).toUpperCase(), tripleA[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["
-                        + i + "]:" + tripleA[i][pattern], ((String)tripleA[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'e' and 'E'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionE() {
-        Formatter f = null;
-        final Object[][] tripleE = {
-                {BigDecimal.ZERO, "%e",         "0.000000e+00"},
-                {BigDecimal.ZERO, "%#.0e",      "0.e+00"},
-                {BigDecimal.ZERO, "%# 9.8e",    " 0.00000000e+00"},
-                {BigDecimal.ZERO, "%#+0(8.4e",  "+0.0000e+00"},
-                {BigDecimal.ZERO, "%-+17.6e",   "+0.000000e+00    "},
-                {BigDecimal.ZERO, "% 0(20e",    " 00000000.000000e+00"},
-                
-                {BigDecimal.ONE, "%e",         "1.000000e+00"},
-                {BigDecimal.ONE, "%#.0e",      "1.e+00"},
-                {BigDecimal.ONE, "%# 9.8e",    " 1.00000000e+00"},
-                {BigDecimal.ONE, "%#+0(8.4e",  "+1.0000e+00"},
-                {BigDecimal.ONE, "%-+17.6e",   "+1.000000e+00    "},
-                {BigDecimal.ONE, "% 0(20e",    " 00000001.000000e+00"},
-                
-                {BigDecimal.TEN, "%e",         "1.000000e+01"},
-                {BigDecimal.TEN, "%#.0e",      "1.e+01"},
-                {BigDecimal.TEN, "%# 9.8e",    " 1.00000000e+01"},
-                {BigDecimal.TEN, "%#+0(8.4e",  "+1.0000e+01"},
-                {BigDecimal.TEN, "%-+17.6e",   "+1.000000e+01    "},
-                {BigDecimal.TEN, "% 0(20e",    " 00000001.000000e+01"},
-                
-                {new BigDecimal(-1), "%e",         "-1.000000e+00"},
-                {new BigDecimal(-1), "%#.0e",      "-1.e+00"},
-                {new BigDecimal(-1), "%# 9.8e",    "-1.00000000e+00"},
-                {new BigDecimal(-1), "%#+0(8.4e",  "(1.0000e+00)"},
-                {new BigDecimal(-1), "%-+17.6e",   "-1.000000e+00    "},
-                {new BigDecimal(-1), "% 0(20e",    "(0000001.000000e+00)"},
-                
-                {new BigDecimal("5.000E999"), "%e",         "5.000000e+999"},
-                {new BigDecimal("5.000E999"), "%#.0e",      "5.e+999"},
-                {new BigDecimal("5.000E999"), "%# 9.8e",    " 5.00000000e+999"},
-                {new BigDecimal("5.000E999"), "%#+0(8.4e",  "+5.0000e+999"},
-                {new BigDecimal("5.000E999"), "%-+17.6e",   "+5.000000e+999   "},
-                {new BigDecimal("5.000E999"), "% 0(20e",    " 0000005.000000e+999"},
-                
-                {new BigDecimal("-5.000E999"), "%e",         "-5.000000e+999"},
-                {new BigDecimal("-5.000E999"), "%#.0e",      "-5.e+999"},
-                {new BigDecimal("-5.000E999"), "%# 9.8e",    "-5.00000000e+999"},
-                {new BigDecimal("-5.000E999"), "%#+0(8.4e",  "(5.0000e+999)"},
-                {new BigDecimal("-5.000E999"), "%-+17.6e",   "-5.000000e+999   "},
-                {new BigDecimal("-5.000E999"), "% 0(20e",    "(000005.000000e+999)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleE.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleE[i][pattern], tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern],
-                        tripleE[i][output], f.toString());
-
-                // test for conversion type 'E'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])
-                        .toUpperCase(Locale.US), f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'g' and 'G'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionG() {
-        Formatter f = null;
-        final Object[][] tripleG = {
-                {BigDecimal.ZERO, "%g",         "0.00000"},
-                {BigDecimal.ZERO, "%.5g",       "0.0000"},
-                {BigDecimal.ZERO, "%- (,9.8g",  " 0.0000000"},
-                {BigDecimal.ZERO, "%+0(,8.4g",  "+000.000"},
-                {BigDecimal.ZERO, "%-+10.6g",   "+0.00000  "},
-                {BigDecimal.ZERO, "% 0(,12.0g", " 00000000000"},
-                {BigDecimal.ONE, "%g",          "1.00000"},
-                {BigDecimal.ONE, "%.5g",        "1.0000"},
-                {BigDecimal.ONE, "%- (,9.8g",   " 1.0000000"},
-                {BigDecimal.ONE, "%+0(,8.4g",   "+001.000"},
-                {BigDecimal.ONE, "%-+10.6g",    "+1.00000  "},
-                {BigDecimal.ONE, "% 0(,12.0g",  " 00000000001"},
-                
-                {new BigDecimal(-1), "%g",          "-1.00000"},
-                {new BigDecimal(-1), "%.5g",        "-1.0000"},
-                {new BigDecimal(-1), "%- (,9.8g",   "(1.0000000)"},
-                {new BigDecimal(-1), "%+0(,8.4g",   "(01.000)"},
-                {new BigDecimal(-1), "%-+10.6g",    "-1.00000  "},
-                {new BigDecimal(-1), "% 0(,12.0g",  "(0000000001)"},
-                
-                {new BigDecimal(-0.000001), "%g",           "-1.00000e-06"},
-                {new BigDecimal(-0.000001), "%.5g",         "-1.0000e-06"},
-                {new BigDecimal(-0.000001), "%- (,9.8g",    "(1.0000000e-06)"},
-                {new BigDecimal(-0.000001), "%+0(,8.4g",    "(1.000e-06)"},
-                {new BigDecimal(-0.000001), "%-+10.6g",     "-1.00000e-06"},
-                {new BigDecimal(-0.000001), "% 0(,12.0g",   "(000001e-06)"},
-                
-                {new BigDecimal(0.0002), "%g",          "0.000200000"},
-                {new BigDecimal(0.0002), "%.5g",        "0.00020000"},
-                {new BigDecimal(0.0002), "%- (,9.8g",   " 0.00020000000"},
-                {new BigDecimal(0.0002), "%+0(,8.4g",   "+0.0002000"},
-                {new BigDecimal(0.0002), "%-+10.6g",    "+0.000200000"},
-                {new BigDecimal(0.0002), "% 0(,12.0g",  " 000000.0002"},
-                
-                {new BigDecimal(-0.003), "%g",          "-0.00300000"},
-                {new BigDecimal(-0.003), "%.5g",        "-0.0030000"},
-                {new BigDecimal(-0.003), "%- (,9.8g",   "(0.0030000000)"},
-                {new BigDecimal(-0.003), "%+0(,8.4g",   "(0.003000)"},
-                {new BigDecimal(-0.003), "%-+10.6g",    "-0.00300000"},
-                {new BigDecimal(-0.003), "% 0(,12.0g",  "(000000.003)"},
-                
-                {new BigDecimal("5.000E999"), "%g",             "5.00000e+999"},
-                {new BigDecimal("5.000E999"), "%.5g",           "5.0000e+999"},
-                {new BigDecimal("5.000E999"), "%- (,9.8g",      " 5.0000000e+999"},
-                {new BigDecimal("5.000E999"), "%+0(,8.4g",      "+5.000e+999"},
-                {new BigDecimal("5.000E999"), "%-+10.6g",       "+5.00000e+999"},
-                {new BigDecimal("5.000E999"), "% 0(,12.0g",     " 000005e+999"},
-                
-                {new BigDecimal("-5.000E999"), "%g",            "-5.00000e+999"},
-                {new BigDecimal("-5.000E999"), "%.5g",          "-5.0000e+999"},
-                {new BigDecimal("-5.000E999"), "%- (,9.8g",     "(5.0000000e+999)"},
-                {new BigDecimal("-5.000E999"), "%+0(,8.4g",     "(5.000e+999)"},
-                {new BigDecimal("-5.000E999"), "%-+10.6g",      "-5.00000e+999"},
-                {new BigDecimal("-5.000E999"), "% 0(,12.0g",    "(00005e+999)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleG.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleG[i][pattern], tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern],
-                        tripleG[i][output], f.toString());
-
-                // test for conversion type 'G'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])
-                        .toUpperCase(Locale.US), f.toString());
-            }
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (,9.6g", new BigDecimal("4E6"));
-        /*
-         * fail on RI, spec says 'g' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 4.00000e+06, which does not
-         * conform to the German Locale
-         */
-        assertEquals(" 4,00000e+06", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'f'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionF() {
-
-        Formatter f = null;
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        final Object[][] tripleF = {
-                {BigDecimal.ZERO,                                               "%f",           "0.000000"},
-                {BigDecimal.ZERO,                                               "%#.3f",        "0.000"},
-                {BigDecimal.ZERO,                                               "%#,5f",        "0.000000"},
-                {BigDecimal.ZERO,                                               "%- #(12.0f",   " 0.         "},
-                {BigDecimal.ZERO,                                               "%#+0(1.6f",    "+0.000000"},
-                {BigDecimal.ZERO,                                               "%-+(8.4f",     "+0.0000 "},
-                {BigDecimal.ZERO,                                               "% 0#(9.8f",    " 0.00000000"},
-                {BigDecimal.ONE,                                                "%f",           "1.000000"},
-                {BigDecimal.ONE,                                                "%#.3f",        "1.000"},
-                {BigDecimal.ONE,                                                "%#,5f",        "1.000000"},
-                {BigDecimal.ONE,                                                "%- #(12.0f",   " 1.         "},
-                {BigDecimal.ONE,                                                "%#+0(1.6f",    "+1.000000"},
-                {BigDecimal.ONE,                                                "%-+(8.4f",     "+1.0000 "},
-                {BigDecimal.ONE,                                                "% 0#(9.8f",    " 1.00000000"},
-                {BigDecimal.TEN,                                                "%f",           "10.000000"},
-                {BigDecimal.TEN,                                                "%#.3f",        "10.000"},
-                {BigDecimal.TEN,                                                "%#,5f",        "10.000000"},
-                {BigDecimal.TEN,                                                "%- #(12.0f",   " 10.        "},
-                {BigDecimal.TEN,                                                "%#+0(1.6f",    "+10.000000"},
-                {BigDecimal.TEN,                                                "%-+(8.4f",     "+10.0000"},
-                {BigDecimal.TEN,                                                "% 0#(9.8f",    " 10.00000000"},
-                {new BigDecimal(-1),                                            "%f",           "-1.000000"},
-                {new BigDecimal(-1),                                            "%#.3f",        "-1.000"},
-                {new BigDecimal(-1),                                            "%#,5f",        "-1.000000"},
-                {new BigDecimal(-1),                                            "%- #(12.0f",   "(1.)        "},
-                {new BigDecimal(-1),                                            "%#+0(1.6f",    "(1.000000)"},
-                {new BigDecimal(-1),                                            "%-+(8.4f",     "(1.0000)"},
-                {new BigDecimal(-1),                                            "% 0#(9.8f",    "(1.00000000)"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%f",           "9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#.3f",        "9999999999999999999999999999999999999999999.000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#,5f",        "9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%- #(12.0f",   " 9999999999999999999999999999999999999999999."},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#+0(1.6f",    "+9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%-+(8.4f",     "+9999999999999999999999999999999999999999999.0000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "% 0#(9.8f",    " 9999999999999999999999999999999999999999999.00000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%f",          "-9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#.3f",       "-9999999999999999999999999999999999999999999.000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#,5f",       "-9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%- #(12.0f",  "(9999999999999999999999999999999999999999999.)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#+0(1.6f",   "(9999999999999999999999999999999999999999999.000000)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%-+(8.4f",    "(9999999999999999999999999999999999999999999.0000)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "% 0#(9.8f",   "(9999999999999999999999999999999999999999999.00000000)"},
-        }; 
-        for (int i = 0; i < tripleF.length; i++) {
-            f = new Formatter(Locale.US);
-            f.format((String)tripleF[i][pattern], tripleF[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["
-                    + i + "]:" + tripleF[i][pattern], tripleF[i][output], f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%f", new BigDecimal("5.0E9"));
-        // error on RI
-        // RI throw ArrayIndexOutOfBoundsException
-        assertEquals("5000000000.000000", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for exceptions in
-     *        Float/Double/BigDecimal conversion type 'e', 'E', 'g', 'G', 'f', 'a', 'A'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalConversionException() {
-        Formatter f = null;
-
-        final char[] conversions = { 'e', 'E', 'g', 'G', 'f', 'a', 'A' };
-        final Object[] illArgs = { false, (byte) 1, (short) 2, 3, (long) 4,
-                new BigInteger("5"), new Character('c'), new Object(),
-                new Date() };
-        for (int i = 0; i < illArgs.length; i++) {
-            for (int j = 0; j < conversions.length; j++) {
-                try {
-                    f = new Formatter(Locale.UK);
-                    f.format("%" + conversions[j], illArgs[i]);
-                    fail("should throw IllegalFormatConversionException");
-                } catch (IllegalFormatConversionException e) {
-                    // expected
-                }
-            }
-        }
-
-        try {
-            f = new Formatter(Locale.UK);
-            f.format("%a", new BigDecimal(1));
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.UK);
-            f.format("%A", new BigDecimal(1));
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        final String[] flagsConversionMismatches = { "%,e", "%,E", "%#g",
-                "%#G", "%,a", "%,A", "%(a", "%(A" };
-        for (int i = 0; i < flagsConversionMismatches.length; i++) {
-            try {
-                f = new Formatter(Locale.CHINA);
-                f.format(flagsConversionMismatches[i], new BigDecimal(1));
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-            try {
-                f = new Formatter(Locale.JAPAN);
-                f.format(flagsConversionMismatches[i], (BigDecimal) null);
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingFormatWidths = { "%-0e", "%0e", "%-e", "%-0E",
-                "%0E", "%-E", "%-0g", "%0g", "%-g", "%-0G", "%0G", "%-G",
-                "%-0f", "%0f", "%-f", "%-0a", "%0a", "%-a", "%-0A", "%0A",
-                "%-A" };
-        for (int i = 0; i < missingFormatWidths.length; i++) {
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], 1f);
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], (Float) null);
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-
-        final String[] illFlags = { "%+ e", "%+ E", "%+ g", "%+ G", "%+ f",
-                "%+ a", "%+ A", "%-03e", "%-03E", "%-03g", "%-03G", "%-03f",
-                "%-03a", "%-03A" };
-        for (int i = 0; i < illFlags.length; i++) {
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], 1.23d);
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], (Double) null);
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%F", 1);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for
-     *        Float/Double/BigDecimal exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalExceptionOrder() {
-        Formatter f = null;
-
-        /*
-         * Summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * FormatFlagsConversionMismatchException >
-         * IllegalFormatConversionException
-         * 
-         */
-        try {
-            // compare FormatFlagsConversionMismatchException and
-            // IllegalFormatConversionException
-            f = new Formatter(Locale.US);
-            f.format("%,e", (byte) 1);
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // FormatFlagsConversionMismatchException
-            f = new Formatter(Locale.US);
-            f.format("%+ ,e", 1f);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f = new Formatter(Locale.US);
-            f.format("%+ -e", 1f);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        try {
-            // compare UnknownFormatConversionException and
-            // MissingFormatWidthException
-            f = new Formatter(Locale.US);
-            f.format("%-F", 1f);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalExceptionOrder() {
-        Formatter f = null;
-        BigDecimal bd = new BigDecimal("1.0");
-
-        /*
-         * Summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * FormatFlagsConversionMismatchException >
-         * IllegalFormatConversionException
-         * 
-         */
-        try {
-            // compare FormatFlagsConversionMismatchException and
-            // IllegalFormatConversionException
-            f = new Formatter(Locale.US);
-            f.format("%,e", (byte) 1);
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // FormatFlagsConversionMismatchException
-            f = new Formatter(Locale.US);
-            f.format("%+ ,e", bd);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f = new Formatter(Locale.US);
-            f.format("%+ -e", bd);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        // compare UnknownFormatConversionException and
-        // MissingFormatWidthException
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%-F", bd);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null argment for
-     *        Float/Double/BigDecimal conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalNullConversion() {
-        Formatter f = null;
-
-        // test (Float)null
-        f = new Formatter(Locale.FRANCE);
-        f.format("%#- (9.0e", (Float) null);
-        assertEquals("         ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%-+(1.6E", (Float) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%+0(,8.4g", (Float) null);
-        assertEquals("    null", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%- (9.8G", (Float) null);
-        assertEquals("NULL     ", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%- (12.1f", (Float) null);
-        assertEquals("n           ", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("% .4a", (Float) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%06A", (Float) null);
-        assertEquals("  NULL", f.toString());
-
-        // test (Double)null
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (9e", (Double) null);
-        assertEquals("null     ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%#-+(1.6E", (Double) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+0(6.4g", (Double) null);
-        assertEquals("  null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (,5.8G", (Double) null);
-        assertEquals("NULL ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% (.4f", (Double) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%#.6a", (Double) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% 2.5A", (Double) null);
-        assertEquals("NULL", f.toString());
-
-        // test (BigDecimal)null
-        f = new Formatter(Locale.UK);
-        f.format("%#- (6.2e", (BigDecimal) null);
-        assertEquals("nu    ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%-+(1.6E", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%+-(,5.3g", (BigDecimal) null);
-        assertEquals("nul  ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%0 3G", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%0 (9.0G", (BigDecimal) null);
-        assertEquals("         ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("% (.5f", (BigDecimal) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%06a", (BigDecimal) null);
-        assertEquals("  null", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("% .5A", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-    }
-    
-    /**
-     * @tests java.util.Formatter.BigDecimalLayoutForm#values()
-     */
-    public void test_values() {
-        BigDecimalLayoutForm[] vals = BigDecimalLayoutForm.values();
-        assertEquals("Invalid length of enum values", 2, vals.length);
-        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, vals[0]);
-        assertEquals("Wrong dec float value in enum", BigDecimalLayoutForm.DECIMAL_FLOAT, vals[1]);
-    }
-    
-    /**
-     * @tests java.util.Formatter.BigDecimalLayoutForm#valueOf(String)
-     */
-    public void test_valueOfLjava_lang_String() {
-        BigDecimalLayoutForm sci = BigDecimalLayoutForm.valueOf("SCIENTIFIC");
-        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, sci);
-
-        BigDecimalLayoutForm decFloat = BigDecimalLayoutForm.valueOf("DECIMAL_FLOAT");
-        assertEquals("Wrong dec float value from valueOf ", BigDecimalLayoutForm.DECIMAL_FLOAT, decFloat);
-    }
-    
-    /*
-     * Regression test for Harmony-5845
-     * test the short name for timezone whether uses DaylightTime or not
-     */
-    public void test_DaylightTime() {
-        Calendar c1 = new GregorianCalendar(2007, 0, 1);
-        Calendar c2 = new GregorianCalendar(2007, 7, 1);
-
-        for (String tz : TimeZone.getAvailableIDs()) {
-            if (tz.equals("America/Los_Angeles")) {
-                c1.setTimeZone(TimeZone.getTimeZone(tz));
-                c2.setTimeZone(TimeZone.getTimeZone(tz));
-                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("PSTPDT"));
-            }
-            if (tz.equals("America/Panama")) {
-                c1.setTimeZone(TimeZone.getTimeZone(tz));
-                c2.setTimeZone(TimeZone.getTimeZone(tz));
-                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("ESTEST"));
-            }
-        }
-    }
-    
-    /*
-     * Regression test for Harmony-5845
-     * test scientific notation to follow RI's behavior
-     */
-    public void test_ScientificNotation() {
-        Formatter f = new Formatter();
-        MathContext mc = new MathContext(30);
-        BigDecimal value = new BigDecimal(0.1, mc);
-        f.format("%.30G", value);
-
-        String result = f.toString();
-        String expected = "0.100000000000000005551115123126";
-        assertEquals(expected, result);
-    }
-
-    
-    /**
-     * Setup resource files for testing
-     */
-    protected void setUp() throws IOException {
-        root = System.getProperty("user.name").equalsIgnoreCase("root");
-        notExist = File.createTempFile("notexist", null);
-        notExist.delete();
-
-        fileWithContent = File.createTempFile("filewithcontent", null);
-        BufferedOutputStream bw = new BufferedOutputStream(
-                new FileOutputStream(fileWithContent));
-        bw.write(1);// write something into the file
-        bw.close();
-
-        readOnly = File.createTempFile("readonly", null);
-        readOnly.setReadOnly();
-
-        secret = File.createTempFile("secret", null);
-        
-        defaultTimeZone = TimeZone.getDefault();
-        TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai");
-        TimeZone.setDefault(cst);
-    }
-
-    /**
-     * Delete the resource files if they exist
-     */
-    protected void tearDown() {
-        if (notExist.exists()) {
-            notExist.delete();
-        }
-
-        if (fileWithContent.exists()) {
-            fileWithContent.delete();
-        }
-        if (readOnly.exists()) {
-            readOnly.delete();
-        }
-        if (secret.exists()) {
-            secret.delete();
-        }
-        
-        TimeZone.setDefault(defaultTimeZone);
-    }
-}
+/* Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

+ * the License.  You may obtain a copy of the License at

+ * 

+ *     http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+package org.apache.harmony.luni.tests.java.util;

+

+import java.io.BufferedOutputStream;

+import java.io.Closeable;

+import java.io.File;

+import java.io.FileNotFoundException;

+import java.io.FileOutputStream;

+import java.io.FilePermission;

+import java.io.Flushable;

+import java.io.IOException;

+import java.io.OutputStream;

+import java.io.PipedOutputStream;

+import java.io.PrintStream;

+import java.io.UnsupportedEncodingException;

+import java.math.BigDecimal;

+import java.math.BigInteger;

+import java.math.MathContext;

+import java.nio.charset.Charset;

+import java.security.Permission;

+import java.util.Arrays;

+import java.util.Calendar;

+import java.util.Date;

+import java.util.GregorianCalendar;

+import java.util.DuplicateFormatFlagsException;

+import java.util.FormatFlagsConversionMismatchException;

+import java.util.Formattable;

+import java.util.FormattableFlags;

+import java.util.Formatter;

+import java.util.FormatterClosedException;

+import java.util.IllegalFormatCodePointException;

+import java.util.IllegalFormatConversionException;

+import java.util.IllegalFormatException;

+import java.util.IllegalFormatFlagsException;

+import java.util.IllegalFormatPrecisionException;

+import java.util.IllegalFormatWidthException;

+import java.util.Locale;

+import java.util.MissingFormatArgumentException;

+import java.util.MissingFormatWidthException;

+import java.util.TimeZone;

+import java.util.UnknownFormatConversionException;

+import java.util.Formatter.BigDecimalLayoutForm;

+

+import junit.framework.TestCase;

+

+public class FormatterTest extends TestCase {

+	private boolean root;

+

+    class MockAppendable implements Appendable {

+        public Appendable append(CharSequence arg0) throws IOException {

+            return null;

+        }

+

+        public Appendable append(char arg0) throws IOException {

+            return null;

+        }

+

+        public Appendable append(CharSequence arg0, int arg1, int arg2)

+                throws IOException {

+            return null;

+        }

+    }

+

+    class MockSecurityManager extends SecurityManager {

+        public void checkPermission(Permission p) {

+            if (p.getActions().equals("write") && p instanceof FilePermission) {

+                throw new SecurityException("Always throw security exception");

+            }

+        }

+

+        public void checkPermission(Permission p, Object ctx) {

+            checkPermission(p);

+        }

+    }

+

+    class MockFormattable implements Formattable {

+        public void formatTo(Formatter formatter, int flags, int width,

+                int precision) throws IllegalFormatException {

+            if ((flags & FormattableFlags.UPPERCASE) != 0) {

+                formatter.format("CUSTOMIZED FORMAT FUNCTION" + " WIDTH: "

+                        + width + " PRECISION: " + precision);

+            } else {

+                formatter.format("customized format function" + " width: "

+                        + width + " precision: " + precision);

+            }

+        }

+

+        public String toString() {

+            return "formattable object";

+        }

+

+        public int hashCode() {

+            return 0xf;

+        }

+    }

+

+    class MockDestination implements Appendable, Flushable {

+

+        private StringBuilder data = new StringBuilder();

+

+        private boolean enabled = false;

+

+        public Appendable append(char c) throws IOException {

+            if (enabled) {

+                data.append(c);

+                enabled = true; // enable it after the first append

+            } else {

+                throw new IOException();

+            }

+            return this;

+        }

+

+        public Appendable append(CharSequence csq) throws IOException {

+            if (enabled) {

+                data.append(csq);

+                enabled = true; // enable it after the first append

+            } else {

+                throw new IOException();

+            }

+            return this;

+        }

+

+        public Appendable append(CharSequence csq, int start, int end)

+                throws IOException {

+            if (enabled) {

+                data.append(csq, start, end);

+                enabled = true; // enable it after the first append

+            } else {

+                throw new IOException();

+            }

+            return this;

+        }

+

+        public void flush() throws IOException {

+            throw new IOException("Always throw IOException");

+        }

+

+        public String toString() {

+            return data.toString();

+        }

+    }

+

+    private File notExist;

+

+    private File fileWithContent;

+

+    private File readOnly;

+

+    private File secret;

+    

+    private TimeZone defaultTimeZone;

+

+    /**

+     * @tests java.util.Formatter#Formatter()

+     */

+    public void test_Constructor() {

+        Formatter f = new Formatter();

+        assertNotNull(f);

+        assertTrue(f.out() instanceof StringBuilder);

+        assertEquals(f.locale(), Locale.getDefault());

+        assertNotNull(f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(Appendable)

+     */

+    public void test_ConstructorLjava_lang_Appendable() {

+        MockAppendable ma = new MockAppendable();

+        Formatter f1 = new Formatter(ma);

+        assertEquals(ma, f1.out());

+        assertEquals(f1.locale(), Locale.getDefault());

+        assertNotNull(f1.toString());

+

+        Formatter f2 = new Formatter((Appendable) null);

+        /*

+         * If a(the input param) is null then a StringBuilder will be created

+         * and the output can be attained by invoking the out() method. But RI

+         * raises an error of FormatterClosedException when invoking out() or

+         * toString().

+         */

+        Appendable sb = f2.out();

+        assertTrue(sb instanceof StringBuilder);

+        assertNotNull(f2.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(Locale)

+     */

+    public void test_ConstructorLjava_util_Locale() {

+        Formatter f1 = new Formatter(Locale.FRANCE);

+        assertTrue(f1.out() instanceof StringBuilder);

+        assertEquals(f1.locale(), Locale.FRANCE);

+        assertNotNull(f1.toString());

+

+        Formatter f2 = new Formatter((Locale) null);

+        assertNull(f2.locale());

+        assertTrue(f2.out() instanceof StringBuilder);

+        assertNotNull(f2.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(Appendable, Locale)

+     */

+    public void test_ConstructorLjava_lang_AppendableLjava_util_Locale() {

+        MockAppendable ma = new MockAppendable();

+        Formatter f1 = new Formatter(ma, Locale.CANADA);

+        assertEquals(ma, f1.out());

+        assertEquals(f1.locale(), Locale.CANADA);

+

+        Formatter f2 = new Formatter(ma, null);

+        assertNull(f2.locale());

+        assertEquals(ma, f1.out());

+

+        Formatter f3 = new Formatter(null, Locale.GERMAN);

+        assertEquals(f3.locale(), Locale.GERMAN);

+        assertTrue(f3.out() instanceof StringBuilder);

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(String)

+     */

+    public void test_ConstructorLjava_lang_String() throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((String) null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        f = new Formatter(notExist.getPath());

+        assertEquals(f.locale(), Locale.getDefault());

+        f.close();

+

+        f = new Formatter(fileWithContent.getPath());

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly.getPath());

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret.getPath());

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(String, String)

+     */

+    public void test_ConstructorLjava_lang_StringLjava_lang_String()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((String) null, Charset.defaultCharset().name());

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(notExist.getPath(), null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        }

+

+        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name());

+        assertEquals(f.locale(), Locale.getDefault());

+        f.close();

+

+        try {

+            f = new Formatter(notExist.getPath(), "ISO 1111-1");

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        }

+

+        f = new Formatter(fileWithContent.getPath(), "UTF-16BE");

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly.getPath(), "UTF-16BE");

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret.getPath(), "UTF-16BE");

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(String, String, Locale)

+     */

+    public void test_ConstructorLjava_lang_StringLjava_lang_StringLjava_util_Locale()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((String) null, Charset.defaultCharset().name(),

+                    Locale.KOREA);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(notExist.getPath(), null, Locale.KOREA);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        }

+

+        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),

+                null);

+        assertNotNull(f);

+        f.close();

+

+        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),

+                Locale.KOREA);

+        assertEquals(f.locale(), Locale.KOREA);

+        f.close();

+

+        try {

+            f = new Formatter(notExist.getPath(), "ISO 1111-1", Locale.CHINA);

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        }

+

+        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",

+                Locale.CANADA_FRENCH);

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()

+                        .name(), Locale.ITALY);

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+        

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret.getPath(),

+                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(File)

+     */

+    public void test_ConstructorLjava_io_File() throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((File) null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        f = new Formatter(notExist);

+        assertEquals(f.locale(), Locale.getDefault());

+        f.close();

+

+        f = new Formatter(fileWithContent);

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly);

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+        

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret);

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(File, String)

+     */

+    public void test_ConstructorLjava_io_FileLjava_lang_String()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((File) null, Charset.defaultCharset().name());

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        f = new Formatter(notExist, Charset.defaultCharset().name());

+        assertEquals(f.locale(), Locale.getDefault());

+        f.close();

+

+        f = new Formatter(fileWithContent, "UTF-16BE");

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly, Charset.defaultCharset().name());

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret, Charset.defaultCharset().name());

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+

+        try {

+            f = new Formatter(notExist, null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        } finally {

+            if (notExist.exists()) {

+                // Fail on RI on Windows, because output stream is created and

+                // not closed when exception thrown

+                assertTrue(notExist.delete());

+            }

+        }

+

+        try {

+            f = new Formatter(notExist, "ISO 1111-1");

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        } finally {

+            if (notExist.exists()) {

+                // Fail on RI on Windows, because output stream is created and

+                // not closed when exception thrown

+                assertTrue(notExist.delete());

+            }

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(File, String, Locale)

+     */

+    public void test_ConstructorLjava_io_FileLjava_lang_StringLjava_util_Locale()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((File) null, Charset.defaultCharset().name(),

+                    Locale.KOREA);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(notExist, null, Locale.KOREA);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        }

+

+        f = new Formatter(notExist, Charset.defaultCharset().name(), null);

+        assertNotNull(f);

+        f.close();

+

+        f = new Formatter(notExist, Charset.defaultCharset().name(),

+                Locale.KOREA);

+        assertEquals(f.locale(), Locale.KOREA);

+        f.close();

+

+        try {

+            f = new Formatter(notExist, "ISO 1111-1", Locale.CHINA);

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        }

+        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",

+                Locale.CANADA_FRENCH);

+        assertEquals(0, fileWithContent.length());

+        f.close();

+

+        if(!root){

+        	try {

+                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()

+                        .name(), Locale.ITALY);

+                fail("should throw FileNotFoundException");

+            } catch (FileNotFoundException e) {

+                // expected

+            }

+        }

+

+        SecurityManager oldsm = System.getSecurityManager();

+        System.setSecurityManager(new MockSecurityManager());

+        try {

+            f = new Formatter(secret.getPath(),

+                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);

+            fail("should throw SecurityException");

+        } catch (SecurityException se) {

+            // expected

+        } finally {

+            System.setSecurityManager(oldsm);

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(PrintStream)

+     */

+    public void test_ConstructorLjava_io_PrintStream() throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((PrintStream) null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        PrintStream ps = new PrintStream(notExist, "UTF-16BE");

+        f = new Formatter(ps);

+        assertEquals(Locale.getDefault(), f.locale());

+        f.close();

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(OutputStream)

+     */

+    public void test_ConstructorLjava_io_OutputStream() throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((OutputStream) null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        OutputStream os = new FileOutputStream(notExist);

+        f = new Formatter(os);

+        assertEquals(Locale.getDefault(), f.locale());

+        f.close();

+    }

+

+    /**

+     * @tests java.util.Formatter#Formatter(OutputStream, String)

+     */

+    public void test_ConstructorLjava_io_OutputStreamLjava_lang_String()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((OutputStream) null, Charset.defaultCharset()

+                    .name());

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        OutputStream os = null;

+        try {

+            os = new FileOutputStream(notExist);

+            f = new Formatter(os, null);

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        } finally {

+            os.close();

+        }

+

+        try {

+            os = new PipedOutputStream();

+            f = new Formatter(os, "TMP-1111");

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        } finally {

+            os.close();

+        }

+

+        os = new FileOutputStream(fileWithContent);

+        f = new Formatter(os, "UTF-16BE");

+        assertEquals(Locale.getDefault(), f.locale());

+        f.close();

+    }

+

+    /**

+     * Test method for 'java.util.Formatter.Formatter(OutputStream, String,

+     * Locale)

+     */

+    public void test_ConstructorLjava_io_OutputStreamLjava_lang_StringLjava_util_Locale()

+            throws IOException {

+        Formatter f = null;

+        try {

+            f = new Formatter((OutputStream) null, Charset.defaultCharset()

+                    .name(), Locale.getDefault());

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e1) {

+            // expected

+        }

+

+        OutputStream os = null;

+        try {

+            os = new FileOutputStream(notExist);

+            f = new Formatter(os, null, Locale.getDefault());

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e2) {

+            // expected

+        } finally {

+            os.close();

+        }

+

+        os = new FileOutputStream(notExist);

+        f = new Formatter(os, Charset.defaultCharset().name(), null);

+        f.close();

+

+        try {

+            os = new PipedOutputStream();

+            f = new Formatter(os, "TMP-1111", Locale.getDefault());

+            fail("should throw UnsupportedEncodingException");

+        } catch (UnsupportedEncodingException e1) {

+            // expected

+        }

+

+        os = new FileOutputStream(fileWithContent);

+        f = new Formatter(os, "UTF-16BE", Locale.ENGLISH);

+        assertEquals(Locale.ENGLISH, f.locale());

+        f.close();

+    }

+

+    /**

+     * @tests java.util.Formatter#locale()

+     */

+    public void test_locale() {

+        Formatter f = null;

+        f = new Formatter((Locale) null);

+        assertNull(f.locale());

+

+        f.close();

+        try {

+            f.locale();

+            fail("should throw FormatterClosedException");

+        } catch (FormatterClosedException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#out()

+     */

+    public void test_out() {

+        Formatter f = null;

+        f = new Formatter();

+        assertNotNull(f.out());

+        assertTrue(f.out() instanceof StringBuilder);

+        f.close();

+        try {

+            f.out();

+            fail("should throw FormatterClosedException");

+        } catch (FormatterClosedException e) {

+            // expected

+        }

+

+    }

+

+    /**

+     * @tests java.util.Formatter#flush()

+     */

+    public void test_flush() throws IOException {

+        Formatter f = null;

+        f = new Formatter(notExist);

+        assertTrue(f instanceof Flushable);

+        f.close();

+        try {

+            f.flush();

+            fail("should throw FormatterClosedException");

+        } catch (FormatterClosedException e) {

+            // expected

+        }

+

+        f = new Formatter();

+        // For destination that does not implement Flushable

+        // No exception should be thrown

+        f.flush();

+    }

+

+    /**

+     * @tests java.util.Formatter#close()

+     */

+    public void test_close() throws IOException {

+        Formatter f = new Formatter(notExist);

+        assertTrue(f instanceof Closeable);

+        f.close();

+        // close next time will not throw exception

+        f.close();

+        assertNull(f.ioException());

+    }

+

+    /**

+     * @tests java.util.Formatter#toString()

+     */

+    public void test_toString() {

+        Formatter f = new Formatter();

+        assertNotNull(f.toString());

+        assertEquals(f.out().toString(), f.toString());

+        f.close();

+        try {

+            f.toString();

+            fail("should throw FormatterClosedException");

+        } catch (FormatterClosedException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#ioException()

+     */

+    public void test_ioException() throws IOException {

+        Formatter f = null;

+        f = new Formatter(new MockDestination());

+        assertNull(f.ioException());

+        f.flush();

+        assertNotNull(f.ioException());

+        f.close();

+

+        MockDestination md = new MockDestination();

+        f = new Formatter(md);

+        f.format("%s%s", "1", "2");

+        // format stop working after IOException

+        assertNotNull(f.ioException());

+        assertEquals("", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for null parameter

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_null() {

+        Formatter f = new Formatter();

+        try {

+            f.format((String) null, "parameter");

+            fail("should throw NullPointerException");

+        } catch (NullPointerException e) {

+            // expected

+        }

+

+        f = new Formatter();

+        f.format("hello", (Object[]) null);

+        assertEquals("hello", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for argument index

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex() {

+        Formatter formatter = new Formatter(Locale.US);

+        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%11$s%10$s", "1",

+                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");

+        assertEquals("1234567891110", formatter.toString());

+

+        formatter = new Formatter(Locale.JAPAN);

+        formatter.format("%0$s", "hello");

+        assertEquals("hello", formatter.toString());

+

+        try {

+            formatter = new Formatter(Locale.US);

+            formatter.format("%-1$s", "1", "2");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            formatter = new Formatter(Locale.US);

+            formatter.format("%$s", "hello", "2");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+        

+        try {

+            Formatter f = new Formatter(Locale.US);

+            f.format("%", "string");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }       

+

+        formatter = new Formatter(Locale.FRANCE);

+        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%<s%s%s%<s", "1",

+                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");

+        assertEquals("123456788122", formatter.toString());

+

+        formatter = new Formatter(Locale.FRANCE);

+        formatter.format(

+                "xx%1$s22%2$s%s%<s%5$s%<s&%7$h%2$s%8$s%<s%s%s%<ssuffix", "1",

+                "2", "3", "4", "5", "6", 7, "8", "9", "10", "11");

+        assertEquals("xx12221155&7288233suffix", formatter.toString());

+

+        try {

+            formatter.format("%<s", "hello");

+            fail("should throw MissingFormatArgumentException");

+        } catch (MissingFormatArgumentException e) {

+            // expected

+        }

+

+        formatter = new Formatter(Locale.US);

+        try {

+            formatter.format("%123$s", "hello");

+            fail("should throw MissingFormatArgumentException");

+        } catch (MissingFormatArgumentException e) {

+            // expected

+        }

+

+        formatter = new Formatter(Locale.US);

+        try {

+            // 2147483648 is the value of Integer.MAX_VALUE + 1

+            formatter.format("%2147483648$s", "hello");

+            fail("should throw MissingFormatArgumentException");

+        } catch (MissingFormatArgumentException e) {

+            // expected

+        }

+

+        try {

+            // 2147483647 is the value of Integer.MAX_VALUE

+            formatter.format("%2147483647$s", "hello");

+            fail("should throw MissingFormatArgumentException");

+        } catch (MissingFormatArgumentException e) {

+            // expected

+        }

+

+        formatter = new Formatter(Locale.US);

+        try {

+            formatter.format("%s%s", "hello");

+            fail("should throw MissingFormatArgumentException");

+        } catch (MissingFormatArgumentException e) {

+            // expected

+        }

+

+        formatter = new Formatter(Locale.US);

+        formatter.format("$100", 100);

+        assertEquals("$100", formatter.toString());

+

+        formatter = new Formatter(Locale.UK);

+        formatter.format("%01$s", "string");

+        assertEquals("string", formatter.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for width

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_Width() {

+        Formatter f = new Formatter(Locale.US);

+        f.format("%1$8s", "1");

+        assertEquals("       1", f.toString());

+

+        f = new Formatter(Locale.US);

+        f.format("%1$-1%", "string");

+        assertEquals("%", f.toString());

+

+        f = new Formatter(Locale.ITALY);

+        // 2147483648 is the value of Integer.MAX_VALUE + 1

+        f.format("%2147483648s", "string");

+        assertEquals("string", f.toString());

+

+        // the value of Integer.MAX_VALUE will allocate about 4G bytes of

+        // memory.

+        // It may cause OutOfMemoryError, so this value is not tested

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for precision

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_Precision() {

+        Formatter f = new Formatter(Locale.US);

+        f.format("%.5s", "123456");

+        assertEquals("12345", f.toString());

+

+        f = new Formatter(Locale.US);

+        // 2147483648 is the value of Integer.MAX_VALUE + 1

+        f.format("%.2147483648s", "...");

+        assertEquals("...", f.toString());

+

+        // the value of Integer.MAX_VALUE will allocate about 4G bytes of

+        // memory.

+        // It may cause OutOfMemoryError, so this value is not tested

+

+        f = new Formatter(Locale.US);

+        f.format("%10.0b", Boolean.TRUE);

+        assertEquals("          ", f.toString());

+

+        f = new Formatter(Locale.US);

+        f.format("%10.01s", "hello");

+        assertEquals("         h", f.toString());

+

+        try {

+            f = new Formatter(Locale.US);

+            f.format("%.s", "hello", "2");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(Locale.US);

+            f.format("%.-5s", "123456");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(Locale.US);

+            f.format("%1.s", "hello", "2");

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        f.format("%5.1s", "hello");

+        assertEquals("    h", f.toString());

+

+        f = new Formatter(Locale.FRANCE);

+        f.format("%.0s", "hello", "2");

+        assertEquals("", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for line sperator

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_LineSeparator() {

+        Formatter f = null;

+

+        String oldSeparator = System.getProperty("line.separator");

+        System.setProperty("line.separator", "!\n");

+

+        f = new Formatter(Locale.US);

+        f.format("%1$n", 1);

+        assertEquals("!\n", f.toString());

+

+        f = new Formatter(Locale.KOREAN);

+        f.format("head%1$n%2$n", 1, new Date());

+        assertEquals("head!\n!\n", f.toString());

+

+        f = new Formatter(Locale.US);

+        f.format("%n%s", "hello");

+        assertEquals("!\nhello", f.toString());

+

+        System.setProperty("line.separator", oldSeparator);

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%-n");

+            fail("should throw IllegalFormatFlagsException: %-n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("%+n");

+            fail("should throw IllegalFormatFlagsException: %+n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("%#n");

+            fail("should throw IllegalFormatFlagsException: %#n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("% n");

+            fail("should throw IllegalFormatFlagsException: % n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("%0n");

+            fail("should throw IllegalFormatFlagsException: %0n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("%,n");

+            fail("should throw IllegalFormatFlagsException: %,n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+        try {

+            f.format("%(n");

+            fail("should throw IllegalFormatFlagsException: %(n");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%4n");

+            fail("should throw IllegalFormatWidthException");

+        } catch (IllegalFormatWidthException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%-4n");

+            fail("should throw IllegalFormatWidthException");

+        } catch (IllegalFormatWidthException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%.9n");

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%5.9n");

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+        

+        System.setProperty("line.separator", oldSeparator);

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for percent

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_Percent() {

+        Formatter f = null;

+

+        f = new Formatter(Locale.ENGLISH);

+        f.format("%1$%", 100);

+        assertEquals("%", f.toString());

+

+        f = new Formatter(Locale.CHINA);

+        f.format("%1$%%%", "hello", new Object());

+        assertEquals("%%", f.toString());

+

+        f = new Formatter(Locale.CHINA);

+        f.format("%%%s", "hello");

+        assertEquals("%hello", f.toString());

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%.9%");

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%5.9%");

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        assertFormatFlagsConversionMismatchException(f, "%+%");

+        assertFormatFlagsConversionMismatchException(f, "%#%");

+        assertFormatFlagsConversionMismatchException(f, "% %");

+        assertFormatFlagsConversionMismatchException(f, "%0%");

+        assertFormatFlagsConversionMismatchException(f, "%,%");

+        assertFormatFlagsConversionMismatchException(f, "%(%");

+        

+

+        f = new Formatter(Locale.KOREAN);

+        f.format("%4%", 1);

+        /*

+         * fail on RI the output string should be right justified by appending

+         * spaces till the whole string is 4 chars width.

+         */

+        assertEquals("   %", f.toString());

+

+        f = new Formatter(Locale.US);

+        f.format("%-4%", 100);

+        /*

+         * fail on RI, throw UnknownFormatConversionException the output string

+         * should be left justified by appending spaces till the whole string is

+         * 4 chars width.

+         */

+        assertEquals("%   ", f.toString());

+    }

+

+    private void assertFormatFlagsConversionMismatchException(Formatter f, String str) {

+        try {

+            f.format(str);

+            fail("should throw FormatFlagsConversionMismatchException: "

+                    + str);

+             /*

+             * error on RI, throw IllegalFormatFlagsException specification

+             * says FormatFlagsConversionMismatchException should be thrown

+             */

+        } catch (FormatFlagsConversionMismatchException e) {

+           // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for flag

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_Flag() {

+        Formatter f = new Formatter(Locale.US);

+        try {

+            f.format("%1$-#-8s", "something");

+            fail("should throw DuplicateFormatFlagsException");

+        } catch (DuplicateFormatFlagsException e) {

+            // expected

+        }

+

+        final char[] chars = { '-', '#', '+', ' ', '0', ',', '(', '%', '<' };

+        Arrays.sort(chars);

+        f = new Formatter(Locale.US);

+        for (char i = 0; i <= 256; i++) {

+            // test 8 bit character

+            if (Arrays.binarySearch(chars, i) >= 0 || Character.isDigit(i)

+                    || Character.isLetter(i)) {

+                // Do not test 0-9, a-z, A-Z and characters in the chars array.

+                // They are characters used as flags, width or conversions

+                continue;

+            }

+            try {

+                f.format("%" + i + "s", 1);

+                fail("should throw UnknownFormatConversionException");

+            } catch (UnknownFormatConversionException e) {

+                // expected

+            }

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for general

+     *        conversion b/B

+     */

+    public void test_format_LString$LObject_GeneralConversionB() {

+        final Object[][] triple = { 

+                { Boolean.FALSE,                "%3.2b",  " fa", },

+                { Boolean.FALSE,                "%-4.6b", "false", },

+                { Boolean.FALSE,                "%.2b",   "fa", }, 

+                { Boolean.TRUE,                 "%3.2b",  " tr", },

+                { Boolean.TRUE,                 "%-4.6b", "true", },

+                { Boolean.TRUE,                 "%.2b",   "tr", },

+                { new Character('c'),           "%3.2b",  " tr", },

+                { new Character('c'),           "%-4.6b", "true", },

+                { new Character('c'),           "%.2b",   "tr", },

+                { new Byte((byte) 0x01),        "%3.2b",  " tr", },

+                { new Byte((byte) 0x01),        "%-4.6b", "true", },

+                { new Byte((byte) 0x01),        "%.2b",   "tr", },

+                { new Short((short) 0x0001),    "%3.2b",  " tr", },

+                { new Short((short) 0x0001),    "%-4.6b", "true", },

+                { new Short((short) 0x0001),    "%.2b",   "tr", },

+                { new Integer(1),               "%3.2b",  " tr", },

+                { new Integer(1),               "%-4.6b", "true", },

+                { new Integer(1),               "%.2b",   "tr", },

+                { new Float(1.1f),              "%3.2b",  " tr", },

+                { new Float(1.1f),              "%-4.6b", "true", },

+                { new Float(1.1f),              "%.2b",   "tr", },

+                { new Double(1.1d),             "%3.2b",  " tr", },

+                { new Double(1.1d),             "%-4.6b", "true", },

+                { new Double(1.1d),             "%.2b",   "tr", },

+                { "",                           "%3.2b",  " tr", },

+                { "",                           "%-4.6b", "true", },

+                { "",                           "%.2b",   "tr", },

+                { "string content",             "%3.2b",  " tr", },

+                { "string content",             "%-4.6b", "true", },

+                { "string content",             "%.2b",   "tr", },

+                { new MockFormattable(),        "%3.2b",  " tr", },

+                { new MockFormattable(),        "%-4.6b", "true", },

+                { new MockFormattable(),        "%.2b",   "tr", },

+                { (Object) null,                "%3.2b",  " fa", },

+                { (Object) null,                "%-4.6b", "false", },

+                { (Object) null,                "%.2b",   "fa", },

+                };

+

+

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2; 

+        Formatter f = null;

+        for (int i = 0; i < triple.length; i++) {

+            f = new Formatter(Locale.FRANCE);

+            f.format((String)triple[i][pattern], triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input]

+                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input]

+                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])

+                    .toUpperCase(Locale.US), f.toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for general

+     *        conversion type 's' and 'S'

+     */

+    public void test_format_LString$LObject_GeneralConversionS() {

+

+        final Object[][] triple = { 

+                { Boolean.FALSE,                "%2.3s",  "fal", },

+                { Boolean.FALSE,                "%-6.4s", "fals  ", },

+                { Boolean.FALSE,                "%.5s",   "false", }, 

+                { Boolean.TRUE,                 "%2.3s",  "tru", },

+                { Boolean.TRUE,                 "%-6.4s", "true  ", },

+                { Boolean.TRUE,                 "%.5s",   "true", },

+                { new Character('c'),           "%2.3s",  " c", },

+                { new Character('c'),           "%-6.4s", "c     ", },

+                { new Character('c'),           "%.5s",   "c", },

+                { new Byte((byte) 0x01),        "%2.3s",  " 1", },

+                { new Byte((byte) 0x01),        "%-6.4s", "1     ", },

+                { new Byte((byte) 0x01),        "%.5s",   "1", },

+                { new Short((short) 0x0001),    "%2.3s",  " 1", },

+                { new Short((short) 0x0001),    "%-6.4s", "1     ", },

+                { new Short((short) 0x0001),    "%.5s",   "1", },

+                { new Integer(1),               "%2.3s",  " 1", },

+                { new Integer(1),               "%-6.4s", "1     ", },

+                { new Integer(1),               "%.5s",   "1", },

+                { new Float(1.1f),              "%2.3s",  "1.1", },

+                { new Float(1.1f),              "%-6.4s", "1.1   ", },

+                { new Float(1.1f),              "%.5s",   "1.1", },

+                { new Double(1.1d),             "%2.3s",  "1.1", },

+                { new Double(1.1d),             "%-6.4s", "1.1   ", },

+                { new Double(1.1d),             "%.5s",   "1.1", },

+                { "",                           "%2.3s",  "  ", },

+                { "",                           "%-6.4s", "      ", },

+                { "",                           "%.5s",   "", },

+                { "string content",             "%2.3s",  "str", },

+                { "string content",             "%-6.4s", "stri  ", },

+                { "string content",             "%.5s",   "strin", },

+                { new MockFormattable(),        "%2.3s",  "customized format function width: 2 precision: 3", },

+                { new MockFormattable(),        "%-6.4s", "customized format function width: 6 precision: 4", },

+                { new MockFormattable(),        "%.5s",   "customized format function width: -1 precision: 5", },

+                { (Object) null,                "%2.3s",  "nul", },

+                { (Object) null,                "%-6.4s", "null  ", },

+                { (Object) null,                "%.5s",   "null", },

+                };

+

+

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+        Formatter f = null;

+        for (int i = 0; i < triple.length; i++) {

+            f = new Formatter(Locale.FRANCE);

+            f.format((String)triple[i][pattern], triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input]

+                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input]

+                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])

+                    .toUpperCase(Locale.US), f.toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for general

+     *        conversion type 'h' and 'H'

+     */

+    public void test_format_LString$LObject_GeneralConversionH() {

+

+        final Object[] input = { 

+                 Boolean.FALSE,                 

+                 Boolean.TRUE,                  

+                 new Character('c'),            

+                 new Byte((byte) 0x01),         

+                 new Short((short) 0x0001),     

+                 new Integer(1),                

+                 new Float(1.1f),               

+                 new Double(1.1d),              

+                 "",                            

+                 "string content",              

+                 new MockFormattable(),         

+                 (Object) null,                 

+                };

+

+        Formatter f = null;

+        for (int i = 0; i < input.length - 1; i++) {

+            f = new Formatter(Locale.FRANCE);

+            f.format("%h", input[i]);

+            assertEquals("triple[" + i + "]:" + input[i], 

+                    Integer.toHexString(input[i].hashCode()), f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format("%H", input[i]);

+            assertEquals("triple[" + i + "]:" + input[i], 

+                    Integer.toHexString(input[i].hashCode()).toUpperCase(Locale.US), f.toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for general

+     *        conversion other cases

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionOther() {

+        /*

+         * In Turkish locale, the upper case of '\u0069' is '\u0130'. The

+         * following test indicate that '\u0069' is coverted to upper case

+         * without using the turkish locale.

+         */

+        Formatter f = new Formatter(new Locale("tr"));

+        f.format("%S", "\u0069");

+        assertEquals("\u0049", f.toString());

+

+        final Object[] input = { 

+                Boolean.FALSE,                 

+                Boolean.TRUE,                  

+                new Character('c'),            

+                new Byte((byte) 0x01),         

+                new Short((short) 0x0001),     

+                new Integer(1),                

+                new Float(1.1f),               

+                new Double(1.1d),              

+                "",                            

+                "string content",              

+                new MockFormattable(),         

+                (Object) null,                 

+               };

+        f = new Formatter(Locale.GERMAN);

+        for (int i = 0; i < input.length; i++) {

+            if (!(input[i] instanceof Formattable)) {

+                try {

+                    f.format("%#s", input[i]);

+                    /*

+                     * fail on RI, spec says if the '#' flag is present and the

+                     * argument is not a Formattable , then a

+                     * FormatFlagsConversionMismatchException will be thrown.

+                     */

+                    fail("should throw FormatFlagsConversionMismatchException");

+                } catch (FormatFlagsConversionMismatchException e) {

+                    // expected

+                }

+            } else {

+                f.format("%#s%<-#8s", input[i]);

+                assertEquals(

+                        "customized format function width: -1 precision: -1customized format function width: 8 precision: -1",

+                        f.toString());

+            }

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for general

+     *        conversion exception

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionException() {

+        final String[] flagMismatch = { "%#b", "%+b", "% b", "%0b", "%,b",

+                "%(b", "%#B", "%+B", "% B", "%0B", "%,B", "%(B", "%#h", "%+h",

+                "% h", "%0h", "%,h", "%(h", "%#H", "%+H", "% H", "%0H", "%,H",

+                "%(H", "%+s", "% s", "%0s", "%,s", "%(s", "%+S", "% S", "%0S",

+                "%,S", "%(S" };

+

+        Formatter f = new Formatter(Locale.US);

+

+        for (int i = 0; i < flagMismatch.length; i++) {

+            try {

+                f.format(flagMismatch[i], "something");

+                fail("should throw FormatFlagsConversionMismatchException");

+            } catch (FormatFlagsConversionMismatchException e) {

+                // expected

+            }

+        }

+

+        final String[] missingWidth = { "%-b", "%-B", "%-h", "%-H", "%-s",

+                "%-S", };

+        for (int i = 0; i < missingWidth.length; i++) {

+            try {

+                f.format(missingWidth[i], "something");

+                fail("should throw MissingFormatWidthException");

+            } catch (MissingFormatWidthException e) {

+                // expected

+            }

+        }

+        

+        // Regression test

+        f = new Formatter();

+        try {

+            f.format("%c", (byte)-0x0001);

+            fail("Should throw IllegalFormatCodePointException");

+        } catch (IllegalFormatCodePointException e) {

+            // expected

+        }

+        

+        f = new Formatter();

+        try {

+            f.format("%c", (short)-0x0001);

+            fail("Should throw IllegalFormatCodePointException");

+        } catch (IllegalFormatCodePointException e) {

+            // expected

+        }

+        

+        f = new Formatter();

+        try {

+            f.format("%c", -0x0001);

+            fail("Should throw IllegalFormatCodePointException");

+        } catch (IllegalFormatCodePointException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Character

+     *        conversion

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_CharacterConversion() {

+        Formatter f = new Formatter(Locale.US);

+        final Object[] illArgs = { Boolean.TRUE, new Float(1.1f),

+                new Double(1.1d), "string content", new Float(1.1f), new Date() };

+        for (int i = 0; i < illArgs.length; i++) {

+            try {

+                f.format("%c", illArgs[i]);

+                fail("should throw IllegalFormatConversionException");

+            } catch (IllegalFormatConversionException e) {

+                // expected

+            }

+        }

+

+        try {

+            f.format("%c", Integer.MAX_VALUE);

+            fail("should throw IllegalFormatCodePointException");

+        } catch (IllegalFormatCodePointException e) {

+            // expected

+        }

+

+        try {

+            f.format("%#c", 'c');

+            fail("should throw FormatFlagsConversionMismatchException");

+        } catch (FormatFlagsConversionMismatchException e) {

+            // expected

+        }

+

+        final Object[][] triple = {

+                {'c',               "%c",   "c"},

+                {'c',               "%-2c", "c "},

+                {'\u0123',          "%c",   "\u0123"},

+                {'\u0123',          "%-2c", "\u0123 "},

+                {(byte) 0x11,       "%c",   "\u0011"},

+                {(byte) 0x11,       "%-2c", "\u0011 "},

+                {(short) 0x1111,    "%c",   "\u1111"},

+                {(short) 0x1111,    "%-2c", "\u1111 "},

+                {0x11,              "%c",   "\u0011"},

+                {0x11,              "%-2c", "\u0011 "},

+        };

+

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+        for (int i = 0; i < triple.length; i++) {

+                f = new Formatter(Locale.US);

+                f.format((String)triple[i][pattern], triple[i][input]);

+                assertEquals(triple[i][output], f.toString());

+        }

+

+        f = new Formatter(Locale.US);

+        f.format("%c", 0x10000);

+        assertEquals(0x10000, f.toString().codePointAt(0));

+

+        try {

+            f.format("%2.2c", 'c');

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        f.format("%C", 'w');

+        // error on RI, throw UnknownFormatConversionException

+        // RI do not support converter 'C'

+        assertEquals("W", f.toString());

+

+        f = new Formatter(Locale.JAPAN);

+        f.format("%Ced", 0x1111);

+        // error on RI, throw UnknownFormatConversionException

+        // RI do not support converter 'C'

+        assertEquals("\u1111ed", f.toString());

+    }

+    

+    

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for legal

+     *        Byte/Short/Integer/Long conversion type 'd'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionD() {

+        final Object[][] triple = { 

+                { 0,                "%d",                  "0" }, 

+                { 0,                "%10d",       "         0" }, 

+                { 0,                "%-1d",                "0" }, 

+                { 0,                "%+d",                "+0" }, 

+                { 0,                "% d",                " 0" }, 

+                { 0,                "%,d",                 "0" }, 

+                { 0,                "%(d",                 "0" }, 

+                { 0,                "%08d",         "00000000" }, 

+                { 0,                "%-+,(11d",  "+0         " }, 

+                { 0,                "%0 ,(11d",  " 0000000000" }, 

+

+                { (byte) 0xff,      "%d",                 "-1" }, 

+                { (byte) 0xff,      "%10d",       "        -1" }, 

+                { (byte) 0xff,      "%-1d",               "-1" }, 

+                { (byte) 0xff,      "%+d",                "-1" }, 

+                { (byte) 0xff,      "% d",                "-1" }, 

+                { (byte) 0xff,      "%,d",                "-1" }, 

+                { (byte) 0xff,      "%(d",               "(1)" }, 

+                { (byte) 0xff,      "%08d",         "-0000001" }, 

+                { (byte) 0xff,      "%-+,(11d",  "(1)        " }, 

+                { (byte) 0xff,      "%0 ,(11d",  "(000000001)" }, 

+                

+                { (short) 0xf123,   "%d",              "-3805" }, 

+                { (short) 0xf123,   "%10d",       "     -3805" }, 

+                { (short) 0xf123,   "%-1d",            "-3805" }, 

+                { (short) 0xf123,   "%+d",             "-3805" }, 

+                { (short) 0xf123,   "% d",             "-3805" }, 

+                { (short) 0xf123,   "%,d",            "-3.805" }, 

+                { (short) 0xf123,   "%(d",            "(3805)" }, 

+                { (short) 0xf123,   "%08d",         "-0003805" }, 

+                { (short) 0xf123,   "%-+,(11d",  "(3.805)    " }, 

+                { (short) 0xf123,   "%0 ,(11d",  "(00003.805)" }, 

+                

+                {  0x123456,        "%d",            "1193046" }, 

+                {  0x123456,        "%10d",       "   1193046" }, 

+                {  0x123456,        "%-1d",          "1193046" }, 

+                {  0x123456,        "%+d",          "+1193046" }, 

+                {  0x123456,        "% d",          " 1193046" }, 

+                {  0x123456,        "%,d",         "1.193.046" }, 

+                {  0x123456,        "%(d",           "1193046" }, 

+                {  0x123456,        "%08d",         "01193046" }, 

+                {  0x123456,        "%-+,(11d",  "+1.193.046 " }, 

+                {  0x123456,        "%0 ,(11d",  " 01.193.046" }, 

+                

+                { -3,               "%d",                 "-3" }, 

+                { -3,               "%10d",       "        -3" }, 

+                { -3,               "%-1d",               "-3" }, 

+                { -3,               "%+d",                "-3" }, 

+                { -3,               "% d",                "-3" }, 

+                { -3,               "%,d",                "-3" }, 

+                { -3,               "%(d",               "(3)" }, 

+                { -3,               "%08d",         "-0000003" }, 

+                { -3,               "%-+,(11d",  "(3)        " }, 

+                { -3,               "%0 ,(11d",  "(000000003)" },

+                

+                { 0x7654321L,       "%d",          "124076833" }, 

+                { 0x7654321L,       "%10d",       " 124076833" }, 

+                { 0x7654321L,       "%-1d",        "124076833" }, 

+                { 0x7654321L,       "%+d",        "+124076833" }, 

+                { 0x7654321L,       "% d",        " 124076833" }, 

+                { 0x7654321L,       "%,d",       "124.076.833" }, 

+                { 0x7654321L,       "%(d",         "124076833" }, 

+                { 0x7654321L,       "%08d",        "124076833" }, 

+                { 0x7654321L,       "%-+,(11d", "+124.076.833" }, 

+                { 0x7654321L,       "%0 ,(11d", " 124.076.833" }, 

+                

+                { -1L,              "%d",                 "-1" }, 

+                { -1L,              "%10d",       "        -1" }, 

+                { -1L,              "%-1d",               "-1" }, 

+                { -1L,              "%+d",                "-1" }, 

+                { -1L,              "% d",                "-1" }, 

+                { -1L,              "%,d",                "-1" }, 

+                { -1L,              "%(d",               "(1)" }, 

+                { -1L,              "%08d",         "-0000001" }, 

+                { -1L,              "%-+,(11d",  "(1)        " }, 

+                { -1L,              "%0 ,(11d",  "(000000001)" }, 

+                };

+

+        final int input = 0;

+        final int pattern = 1;

+        final int output = 2;

+        Formatter f;

+        for (int i = 0; i < triple.length; i++) {

+            f = new Formatter(Locale.GERMAN);

+            f.format((String) triple[i][pattern],

+                    triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["

+                    + i + "]:" + triple[i][pattern], triple[i][output], f

+                    .toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for legal

+     *        Byte/Short/Integer/Long conversion type 'o'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionO() {

+        final Object[][] triple = { 

+                { 0,                "%o",                 "0" }, 

+                { 0,                "%-6o",          "0     " }, 

+                { 0,                "%08o",        "00000000" }, 

+                { 0,                "%#o",               "00" }, 

+                { 0,                "%0#11o",   "00000000000" }, 

+                { 0,                "%-#9o",      "00       " }, 

+

+                { (byte) 0xff,      "%o",               "377" }, 

+                { (byte) 0xff,      "%-6o",          "377   " }, 

+                { (byte) 0xff,      "%08o",        "00000377" }, 

+                { (byte) 0xff,      "%#o",             "0377" }, 

+                { (byte) 0xff,      "%0#11o",   "00000000377" }, 

+                { (byte) 0xff,      "%-#9o",      "0377     " }, 

+                

+                { (short) 0xf123,   "%o",            "170443" }, 

+                { (short) 0xf123,   "%-6o",          "170443" }, 

+                { (short) 0xf123,   "%08o",        "00170443" }, 

+                { (short) 0xf123,   "%#o",          "0170443" }, 

+                { (short) 0xf123,   "%0#11o",   "00000170443" }, 

+                { (short) 0xf123,   "%-#9o",      "0170443  " }, 

+                

+                {  0x123456,        "%o",           "4432126" }, 

+                {  0x123456,        "%-6o",         "4432126" }, 

+                {  0x123456,        "%08o",        "04432126" }, 

+                {  0x123456,        "%#o",         "04432126" }, 

+                {  0x123456,        "%0#11o",   "00004432126" }, 

+                {  0x123456,        "%-#9o",      "04432126 " }, 

+                

+                { -3,               "%o",       "37777777775" }, 

+                { -3,               "%-6o",     "37777777775" }, 

+                { -3,               "%08o",     "37777777775" }, 

+                { -3,               "%#o",     "037777777775" }, 

+                { -3,               "%0#11o",  "037777777775" }, 

+                { -3,               "%-#9o",   "037777777775" }, 

+                

+                { 0x7654321L,       "%o",          "731241441" }, 

+                { 0x7654321L,       "%-6o",        "731241441" }, 

+                { 0x7654321L,       "%08o",        "731241441" }, 

+                { 0x7654321L,       "%#o",        "0731241441" }, 

+                { 0x7654321L,       "%0#11o",    "00731241441" }, 

+                { 0x7654321L,       "%-#9o",      "0731241441" }, 

+                

+                { -1L,              "%o",       "1777777777777777777777" }, 

+                { -1L,              "%-6o",     "1777777777777777777777" }, 

+                { -1L,              "%08o",     "1777777777777777777777" }, 

+                { -1L,              "%#o",     "01777777777777777777777" }, 

+                { -1L,              "%0#11o",  "01777777777777777777777" }, 

+                { -1L,              "%-#9o",   "01777777777777777777777" }, 

+                };

+

+        final int input = 0;

+        final int pattern = 1;

+        final int output = 2;

+        Formatter f;

+        for (int i = 0; i < triple.length; i++) {

+            f = new Formatter(Locale.ITALY);

+            f.format((String) triple[i][pattern],

+                    triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["

+                    + i + "]:" + triple[i][pattern], triple[i][output], f

+                    .toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for legal

+     *        Byte/Short/Integer/Long conversion type 'x' and 'X'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionX() {

+        final Object[][] triple = { 

+                { 0,                "%x",                 "0" }, 

+                { 0,                "%-8x",        "0       " }, 

+                { 0,                "%06x",          "000000" }, 

+                { 0,                "%#x",              "0x0" }, 

+                { 0,                "%0#12x",  "0x0000000000" }, 

+                { 0,                "%-#9x",      "0x0      " }, 

+

+                { (byte) 0xff,      "%x",                "ff" }, 

+                { (byte) 0xff,      "%-8x",        "ff      " }, 

+                { (byte) 0xff,      "%06x",          "0000ff" }, 

+                { (byte) 0xff,      "%#x",             "0xff" }, 

+                { (byte) 0xff,      "%0#12x",  "0x00000000ff" }, 

+                { (byte) 0xff,      "%-#9x",      "0xff     " }, 

+                

+                { (short) 0xf123,   "%x",              "f123" }, 

+                { (short) 0xf123,   "%-8x",        "f123    " }, 

+                { (short) 0xf123,   "%06x",          "00f123" }, 

+                { (short) 0xf123,   "%#x",           "0xf123" }, 

+                { (short) 0xf123,   "%0#12x",  "0x000000f123" }, 

+                { (short) 0xf123,   "%-#9x",      "0xf123   " }, 

+                

+                {  0x123456,        "%x",            "123456" }, 

+                {  0x123456,        "%-8x",        "123456  " }, 

+                {  0x123456,        "%06x",          "123456" }, 

+                {  0x123456,        "%#x",         "0x123456" }, 

+                {  0x123456,        "%0#12x",  "0x0000123456" }, 

+                {  0x123456,        "%-#9x",      "0x123456 " }, 

+                

+                { -3,               "%x",          "fffffffd" }, 

+                { -3,               "%-8x",        "fffffffd" }, 

+                { -3,               "%06x",        "fffffffd" }, 

+                { -3,               "%#x",       "0xfffffffd" }, 

+                { -3,               "%0#12x",  "0x00fffffffd" }, 

+                { -3,               "%-#9x",     "0xfffffffd" }, 

+                

+                { 0x7654321L,       "%x",          "7654321" }, 

+                { 0x7654321L,       "%-8x",       "7654321 " }, 

+                { 0x7654321L,       "%06x",        "7654321" }, 

+                { 0x7654321L,       "%#x",       "0x7654321" }, 

+                { 0x7654321L,       "%0#12x", "0x0007654321" }, 

+                { 0x7654321L,       "%-#9x",     "0x7654321" }, 

+                

+                { -1L,              "%x",       "ffffffffffffffff" }, 

+                { -1L,              "%-8x",     "ffffffffffffffff" }, 

+                { -1L,              "%06x",     "ffffffffffffffff" }, 

+                { -1L,              "%#x",    "0xffffffffffffffff" }, 

+                { -1L,              "%0#12x", "0xffffffffffffffff" }, 

+                { -1L,              "%-#9x",  "0xffffffffffffffff" }, 

+                };

+

+        final int input = 0;

+        final int pattern = 1;

+        final int output = 2;

+        Formatter f;

+        for (int i = 0; i < triple.length; i++) {

+            f = new Formatter(Locale.FRANCE);

+            f.format((String) triple[i][pattern],

+                    triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["

+                    + i + "]:" + triple[i][pattern], triple[i][output], f

+                    .toString());

+            

+            f = new Formatter(Locale.FRANCE);

+            f.format((String) triple[i][pattern],

+                    triple[i][input]);

+            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["

+                    + i + "]:" + triple[i][pattern], triple[i][output], f

+                    .toString());

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Date/Time

+     *        conversion

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_DateTimeConversion() {

+        Formatter f = null;

+        Date now = new Date(1147327147578L);

+

+        Calendar paris = Calendar.getInstance(TimeZone

+                .getTimeZone("Europe/Paris"), Locale.FRANCE);

+        paris.set(2006, 4, 8, 12, 0, 0);

+        paris.set(Calendar.MILLISECOND, 453);

+        Calendar china = Calendar.getInstance(

+                TimeZone.getTimeZone("GMT-08:00"), Locale.CHINA);

+        china.set(2006, 4, 8, 12, 0, 0);

+        china.set(Calendar.MILLISECOND, 609);

+

+        final Object[][] lowerCaseGermanTriple = {

+                {0L,                        'a', "Do."},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'a', "So."},  //$NON-NLS-2$

+                {-1000L,                    'a', "Do."},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'a', "Do."},  //$NON-NLS-2$

+                {paris,                     'a', "Mo."},  //$NON-NLS-2$

+                {china,                     'a', "Mo."},  //$NON-NLS-2$

+                {0L,                        'b', "Jan"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'b', "Aug"},  //$NON-NLS-2$

+                {-1000L,                    'b', "Jan"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'b', "Mai"},  //$NON-NLS-2$

+                {paris,                     'b', "Mai"},  //$NON-NLS-2$

+                {china,                     'b', "Mai"},  //$NON-NLS-2$

+                {0L,                        'c', "Do. Jan 01 08:00:00 GMT+08:00 1970"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'c', "So. Aug 17 15:18:47 GMT+08:00 292278994"},  //$NON-NLS-2$

+                {-1000L,                    'c', "Do. Jan 01 07:59:59 GMT+08:00 1970"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'c', "Do. Mai 11 13:59:07 GMT+08:00 2006"},  //$NON-NLS-2$

+                {paris,                     'c', "Mo. Mai 08 12:00:00 MESZ 2006"},  //$NON-NLS-2$

+                {china,                     'c', "Mo. Mai 08 12:00:00 GMT-08:00 2006"},  //$NON-NLS-2$

+                {0L,                        'd', "01"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'd', "17"},  //$NON-NLS-2$

+                {-1000L,                    'd', "01"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'd', "11"},  //$NON-NLS-2$

+                {paris,                     'd', "08"},  //$NON-NLS-2$

+                {china,                     'd', "08"},  //$NON-NLS-2$

+                {0L,                        'e', "1"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'e', "17"},  //$NON-NLS-2$

+                {-1000L,                    'e', "1"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'e', "11"},  //$NON-NLS-2$

+                {paris,                     'e', "8"},  //$NON-NLS-2$

+                {china,                     'e', "8"},  //$NON-NLS-2$

+                {0L,                        'h', "Jan"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'h', "Aug"},  //$NON-NLS-2$

+                {-1000L,                    'h', "Jan"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'h', "Mai"},  //$NON-NLS-2$

+                {paris,                     'h', "Mai"},  //$NON-NLS-2$

+                {china,                     'h', "Mai"},  //$NON-NLS-2$

+                {0L,                        'j', "001"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'j', "229"},  //$NON-NLS-2$

+                {-1000L,                    'j', "001"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'j', "131"},  //$NON-NLS-2$

+                {paris,                     'j', "128"},  //$NON-NLS-2$

+                {china,                     'j', "128"},  //$NON-NLS-2$

+                {0L,                        'k', "8"},  //$NON-NLS-2$

+                {Long.MAX_VALUE,            'k', "15"},  //$NON-NLS-2$

+                {-1000L,                    'k', "7"},  //$NON-NLS-2$

+                {new Date(1147327147578L),  'k', "13"},  //$NON-NLS-2$

+                {paris,                     'k', "12"},  //$NON-NLS-2$

+                {china,                     'k', "12"},  //$NON-NLS-2$

+                {0L,                        'l', "8"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$

+                {-1000L,                    'l', "7"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$

+                {paris,                     'l', "12"}, //$NON-NLS-2$

+                {china,                     'l', "12"}, //$NON-NLS-2$

+                {0L,                        'm', "01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$

+                {-1000L,                    'm', "01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$

+                {paris,                     'm', "05"}, //$NON-NLS-2$

+                {china,                     'm', "05"}, //$NON-NLS-2$

+                {0L,                        'p', "vorm."}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'p', "nachm."}, //$NON-NLS-2$

+                {-1000L,                    'p', "vorm."}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'p', "nachm."}, //$NON-NLS-2$

+                {paris,                     'p', "nachm."}, //$NON-NLS-2$

+                {china,                     'p', "nachm."}, //$NON-NLS-2$

+                {0L,                        'r', "08:00:00 vorm."}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'r', "03:18:47 nachm."}, //$NON-NLS-2$

+                {-1000L,                    'r', "07:59:59 vorm."}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'r', "01:59:07 nachm."}, //$NON-NLS-2$

+                {paris,                     'r', "12:00:00 nachm."}, //$NON-NLS-2$

+                {china,                     'r', "12:00:00 nachm."}, //$NON-NLS-2$

+                {0L,                        's', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$

+                {-1000L,                    's', "-1"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$

+                {paris,                     's', "1147082400"}, //$NON-NLS-2$

+                {china,                     's', "1147118400"}, //$NON-NLS-2$

+                {0L,                        'y', "70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$

+                {-1000L,                    'y', "70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$

+                {paris,                     'y', "06"}, //$NON-NLS-2$

+                {china,                     'y', "06"}, //$NON-NLS-2$

+                {0L,                        'z', "+0800"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$

+                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$

+                {paris,                     'z', "+0100"}, //$NON-NLS-2$

+                {china,                     'z', "-0800"}, //$NON-NLS-2$

+                

+        };

+        

+        final Object[][] lowerCaseFranceTriple = {

+                {0L,                        'a', "jeu."}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'a', "dim."}, //$NON-NLS-2$

+                {-1000L,                    'a', "jeu."}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'a', "jeu."}, //$NON-NLS-2$

+                {paris,                     'a', "lun."}, //$NON-NLS-2$

+                {china,                     'a', "lun."}, //$NON-NLS-2$

+                {0L,                        'b', "janv."}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'b', "ao\u00fbt"}, //$NON-NLS-2$

+                {-1000L,                    'b', "janv."}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'b', "mai"}, //$NON-NLS-2$

+                {paris,                     'b', "mai"}, //$NON-NLS-2$

+                {china,                     'b', "mai"}, //$NON-NLS-2$

+                {0L,                        'c', "jeu. janv. 01 08:00:00 UTC+08:00 1970"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'c', "dim. ao\u00fbt 17 15:18:47 UTC+08:00 292278994"}, //$NON-NLS-2$

+                {-1000L,                    'c', "jeu. janv. 01 07:59:59 UTC+08:00 1970"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'c', "jeu. mai 11 13:59:07 UTC+08:00 2006"}, //$NON-NLS-2$

+                {paris,                     'c', "lun. mai 08 12:00:00 HAEC 2006"}, //$NON-NLS-2$

+                {china,                     'c', "lun. mai 08 12:00:00 UTC-08:00 2006"}, //$NON-NLS-2$

+                {0L,                        'd', "01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'd', "17"}, //$NON-NLS-2$

+                {-1000L,                    'd', "01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'd', "11"}, //$NON-NLS-2$

+                {paris,                     'd', "08"}, //$NON-NLS-2$

+                {china,                     'd', "08"}, //$NON-NLS-2$

+                {0L,                        'e', "1"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'e', "17"}, //$NON-NLS-2$

+                {-1000L,                    'e', "1"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'e', "11"}, //$NON-NLS-2$

+                {paris,                     'e', "8"}, //$NON-NLS-2$

+                {china,                     'e', "8"}, //$NON-NLS-2$

+                {0L,                        'h', "janv."}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'h', "ao\u00fbt"}, //$NON-NLS-2$

+                {-1000L,                    'h', "janv."}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'h', "mai"}, //$NON-NLS-2$

+                {paris,                     'h', "mai"}, //$NON-NLS-2$

+                {china,                     'h', "mai"}, //$NON-NLS-2$

+                {0L,                        'j', "001"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'j', "229"}, //$NON-NLS-2$

+                {-1000L,                    'j', "001"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'j', "131"}, //$NON-NLS-2$

+                {paris,                     'j', "128"}, //$NON-NLS-2$

+                {china,                     'j', "128"}, //$NON-NLS-2$

+                {0L,                        'k', "8"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'k', "15"}, //$NON-NLS-2$

+                {-1000L,                    'k', "7"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'k', "13"}, //$NON-NLS-2$

+                {paris,                     'k', "12"}, //$NON-NLS-2$

+                {china,                     'k', "12"}, //$NON-NLS-2$

+                {0L,                        'l', "8"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$

+                {-1000L,                    'l', "7"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$

+                {paris,                     'l', "12"}, //$NON-NLS-2$

+                {china,                     'l', "12"}, //$NON-NLS-2$

+                {0L,                        'm', "01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$

+                {-1000L,                    'm', "01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$

+                {paris,                     'm', "05"}, //$NON-NLS-2$

+                {china,                     'm', "05"}, //$NON-NLS-2$

+                {0L,                        'p', "am"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'p', "pm"}, //$NON-NLS-2$

+                {-1000L,                    'p', "am"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'p', "pm"}, //$NON-NLS-2$

+                {paris,                     'p', "pm"}, //$NON-NLS-2$

+                {china,                     'p', "pm"}, //$NON-NLS-2$

+                {0L,                        'r', "08:00:00 AM"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'r', "03:18:47 PM"}, //$NON-NLS-2$

+                {-1000L,                    'r', "07:59:59 AM"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'r', "01:59:07 PM"}, //$NON-NLS-2$

+                {paris,                     'r', "12:00:00 PM"}, //$NON-NLS-2$

+                {china,                     'r', "12:00:00 PM"}, //$NON-NLS-2$

+                {0L,                        's', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$

+                {-1000L,                    's', "-1"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$

+                {paris,                     's', "1147082400"}, //$NON-NLS-2$

+                {china,                     's', "1147118400"}, //$NON-NLS-2$

+                {0L,                        'y', "70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$

+                {-1000L,                    'y', "70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$

+                {paris,                     'y', "06"}, //$NON-NLS-2$

+                {china,                     'y', "06"}, //$NON-NLS-2$

+                {0L,                        'z', "+0800"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$

+                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$

+                {paris,                     'z', "+0100"}, //$NON-NLS-2$

+                {china,                     'z', "-0800"}, //$NON-NLS-2$

+                

+        };

+        

+        final Object[][] lowerCaseJapanTriple = {

+                {0L,                        'a', "\u6728"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'a', "\u65e5"}, //$NON-NLS-2$

+                {-1000L,                    'a', "\u6728"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'a', "\u6728"}, //$NON-NLS-2$

+                {paris,                     'a', "\u6708"}, //$NON-NLS-2$

+                {china,                     'a', "\u6708"}, //$NON-NLS-2$

+                {0L,                        'b', "1\u6708"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'b', "8\u6708"}, //$NON-NLS-2$

+                {-1000L,                    'b', "1\u6708"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'b', "5\u6708"}, //$NON-NLS-2$

+                {paris,                     'b', "5\u6708"}, //$NON-NLS-2$

+                {china,                     'b', "5\u6708"}, //$NON-NLS-2$

+                {0L,                        'c', "\u6728 1\u6708 01 08:00:00 GMT+08:00 1970"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'c', "\u65e5 8\u6708 17 15:18:47 GMT+08:00 292278994"}, //$NON-NLS-2$

+                {-1000L,                    'c', "\u6728 1\u6708 01 07:59:59 GMT+08:00 1970"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'c', "\u6728 5\u6708 11 13:59:07 GMT+08:00 2006"}, //$NON-NLS-2$

+                {paris,                     'c', "\u6708 5\u6708 08 12:00:00 GMT+02:00 2006"}, //$NON-NLS-2$

+                {china,                     'c', "\u6708 5\u6708 08 12:00:00 GMT-08:00 2006"}, //$NON-NLS-2$

+                {0L,                        'd', "01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'd', "17"}, //$NON-NLS-2$

+                {-1000L,                    'd', "01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'd', "11"}, //$NON-NLS-2$

+                {paris,                     'd', "08"}, //$NON-NLS-2$

+                {china,                     'd', "08"}, //$NON-NLS-2$

+                {0L,                        'e', "1"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'e', "17"}, //$NON-NLS-2$

+                {-1000L,                    'e', "1"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'e', "11"}, //$NON-NLS-2$

+                {paris,                     'e', "8"}, //$NON-NLS-2$

+                {china,                     'e', "8"}, //$NON-NLS-2$

+                {0L,                        'h', "1\u6708"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'h', "8\u6708"}, //$NON-NLS-2$

+                {-1000L,                    'h', "1\u6708"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'h', "5\u6708"}, //$NON-NLS-2$

+                {paris,                     'h', "5\u6708"}, //$NON-NLS-2$

+                {china,                     'h', "5\u6708"}, //$NON-NLS-2$

+                {0L,                        'j', "001"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'j', "229"}, //$NON-NLS-2$

+                {-1000L,                    'j', "001"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'j', "131"}, //$NON-NLS-2$

+                {paris,                     'j', "128"}, //$NON-NLS-2$

+                {china,                     'j', "128"}, //$NON-NLS-2$

+                {0L,                        'k', "8"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'k', "15"}, //$NON-NLS-2$

+                {-1000L,                    'k', "7"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'k', "13"}, //$NON-NLS-2$

+                {paris,                     'k', "12"}, //$NON-NLS-2$

+                {china,                     'k', "12"}, //$NON-NLS-2$

+                {0L,                        'l', "8"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'l', "3"}, //$NON-NLS-2$

+                {-1000L,                    'l', "7"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'l', "1"}, //$NON-NLS-2$

+                {paris,                     'l', "12"}, //$NON-NLS-2$

+                {china,                     'l', "12"}, //$NON-NLS-2$

+                {0L,                        'm', "01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'm', "08"}, //$NON-NLS-2$

+                {-1000L,                    'm', "01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'm', "05"}, //$NON-NLS-2$

+                {paris,                     'm', "05"}, //$NON-NLS-2$

+                {china,                     'm', "05"}, //$NON-NLS-2$

+                {0L,                        'p', "\u5348\u524d"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'p', "\u5348\u5f8c"}, //$NON-NLS-2$

+                {-1000L,                    'p', "\u5348\u524d"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'p', "\u5348\u5f8c"}, //$NON-NLS-2$

+                {paris,                     'p', "\u5348\u5f8c"}, //$NON-NLS-2$

+                {china,                     'p', "\u5348\u5f8c"}, //$NON-NLS-2$

+                {0L,                        'r', "08:00:00 \u5348\u524d"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'r', "03:18:47 \u5348\u5f8c"}, //$NON-NLS-2$

+                {-1000L,                    'r', "07:59:59 \u5348\u524d"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'r', "01:59:07 \u5348\u5f8c"}, //$NON-NLS-2$

+                {paris,                     'r', "12:00:00 \u5348\u5f8c"}, //$NON-NLS-2$

+                {china,                     'r', "12:00:00 \u5348\u5f8c"}, //$NON-NLS-2$

+                {0L,                        's', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            's', "9223372036854775"}, //$NON-NLS-2$

+                {-1000L,                    's', "-1"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  's', "1147327147"}, //$NON-NLS-2$

+                {paris,                     's', "1147082400"}, //$NON-NLS-2$

+                {china,                     's', "1147118400"}, //$NON-NLS-2$

+                {0L,                        'y', "70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'y', "94"}, //$NON-NLS-2$

+                {-1000L,                    'y', "70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'y', "06"}, //$NON-NLS-2$

+                {paris,                     'y', "06"}, //$NON-NLS-2$

+                {china,                     'y', "06"}, //$NON-NLS-2$

+                {0L,                        'z', "+0800"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'z', "+0800"}, //$NON-NLS-2$

+                {-1000L,                    'z', "+0800"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'z', "+0800"}, //$NON-NLS-2$

+                {paris,                     'z', "+0100"}, //$NON-NLS-2$

+                {china,                     'z', "-0800"}, //$NON-NLS-2$

+        };

+

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+        for (int i = 0; i < 90; i++) {

+            // go through legal conversion 

+            String formatSpecifier = "%t" + lowerCaseGermanTriple[i][pattern]; //$NON-NLS-2$

+            String formatSpecifierUpper = "%T" + lowerCaseGermanTriple[i][pattern]; //$NON-NLS-2$

+            // test '%t'

+            f = new Formatter(Locale.GERMAN);

+            f.format(formatSpecifier, lowerCaseGermanTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + lowerCaseGermanTriple[i][input], //$NON-NLS-2$

+                            lowerCaseGermanTriple[i][output], f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(Locale.FRANCE, formatSpecifier, lowerCaseFranceTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + lowerCaseFranceTriple[i][input], //$NON-NLS-2$

+                            lowerCaseFranceTriple[i][output], f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(Locale.JAPAN, formatSpecifier, lowerCaseJapanTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + lowerCaseJapanTriple[i][input], //$NON-NLS-2$

+                            lowerCaseJapanTriple[i][output], f.toString());

+

+            // test '%T'

+            f = new Formatter(Locale.GERMAN);

+            f.format(formatSpecifierUpper, lowerCaseGermanTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + lowerCaseGermanTriple[i][input], //$NON-NLS-2$

+                            ((String)lowerCaseGermanTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(Locale.FRANCE, formatSpecifierUpper, lowerCaseFranceTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + lowerCaseFranceTriple[i][input], //$NON-NLS-2$

+                            ((String)lowerCaseFranceTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+

+            f = new Formatter(Locale.GERMAN);

+            f.format(Locale.JAPAN, formatSpecifierUpper, lowerCaseJapanTriple[i][input]);

+            assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + lowerCaseJapanTriple[i][input], //$NON-NLS-2$

+                            ((String)lowerCaseJapanTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+        }

+

+        final Object[][] upperCaseGermanTriple = {

+                {0L,                        'A', "Donnerstag"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'A', "Sonntag"}, //$NON-NLS-2$

+                {-1000L,                    'A', "Donnerstag"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'A', "Donnerstag"}, //$NON-NLS-2$

+                {paris,                     'A', "Montag"}, //$NON-NLS-2$

+                {china,                     'A', "Montag"}, //$NON-NLS-2$

+                {0L,                        'B', "Januar"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'B', "August"}, //$NON-NLS-2$

+                {-1000L,                    'B', "Januar"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'B', "Mai"}, //$NON-NLS-2$

+                {paris,                     'B', "Mai"}, //$NON-NLS-2$ 

+                {china,                     'B', "Mai"}, //$NON-NLS-2$

+                {0L,                        'C', "19"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$

+                {-1000L,                    'C', "19"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$

+                {paris,                     'C', "20"}, //$NON-NLS-2$

+                {china,                     'C', "20"}, //$NON-NLS-2$

+                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$

+                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$

+                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {china,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$

+                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$

+                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {0L,                        'H', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$

+                {-1000L,                    'H', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$

+                {paris,                     'H', "12"}, //$NON-NLS-2$

+                {china,                     'H', "12"}, //$NON-NLS-2$

+                {0L,                        'I', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$

+                {-1000L,                    'I', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$

+                {paris,                     'I', "12"}, //$NON-NLS-2$

+                {china,                     'I', "12"}, //$NON-NLS-2$

+                {0L,                        'L', "000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$

+                {-1000L,                    'L', "000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$

+                {paris,                     'L', "453"}, //$NON-NLS-2$

+                {china,                     'L', "609"}, //$NON-NLS-2$

+                {0L,                        'M', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$

+                {-1000L,                    'M', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$

+                {paris,                     'M', "00"}, //$NON-NLS-2$

+                {china,                     'M', "00"}, //$NON-NLS-2$

+                {0L,                        'N', "000000000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$

+                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$

+                {paris,                     'N', "609000000"}, //$NON-NLS-2$

+                {china,                     'N', "609000000"}, //$NON-NLS-2$

+                {0L,                        'Q', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$

+                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$

+                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$

+                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$

+                {0L,                        'R', "08:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$

+                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$

+                {paris,                     'R', "12:00"}, //$NON-NLS-2$

+                {china,                     'R', "12:00"}, //$NON-NLS-2$

+                {0L,                        'S', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$

+                {-1000L,                    'S', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$

+                {paris,                     'S', "00"}, //$NON-NLS-2$

+                {china,                     'S', "00"}, //$NON-NLS-2$

+                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$

+                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$

+                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {china,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {0L,                        'Y', "1970"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$

+                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$

+                {paris,                     'Y', "2006"}, //$NON-NLS-2$

+                {china,                     'Y', "2006"}, //$NON-NLS-2$

+                {0L,                        'Z', "CST"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$

+                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$

+                {paris,                     'Z', "CEST"}, //$NON-NLS-2$

+                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$

+                

+        };

+        

+        final Object[][] upperCaseFranceTriple = {

+                {0L,                        'A', "jeudi"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'A', "dimanche"}, //$NON-NLS-2$

+                {-1000L,                    'A', "jeudi"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'A', "jeudi"}, //$NON-NLS-2$

+                {paris,                     'A', "lundi"}, //$NON-NLS-2$

+                {china,                     'A', "lundi"}, //$NON-NLS-2$

+                {0L,                        'B', "janvier"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'B', "ao\u00fbt"}, //$NON-NLS-2$

+                {-1000L,                    'B', "janvier"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'B', "mai"}, //$NON-NLS-2$

+                {paris,                     'B', "mai"}, //$NON-NLS-2$

+                {china,                     'B', "mai"}, //$NON-NLS-2$

+                {0L,                        'C', "19"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$

+                {-1000L,                    'C', "19"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$

+                {paris,                     'C', "20"}, //$NON-NLS-2$

+                {china,                     'C', "20"}, //$NON-NLS-2$

+                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$

+                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$

+                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {china,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$

+                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$

+                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {0L,                        'H', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$

+                {-1000L,                    'H', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$

+                {paris,                     'H', "12"}, //$NON-NLS-2$

+                {china,                     'H', "12"}, //$NON-NLS-2$

+                {0L,                        'I', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$

+                {-1000L,                    'I', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$

+                {paris,                     'I', "12"}, //$NON-NLS-2$

+                {china,                     'I', "12"}, //$NON-NLS-2$

+                {0L,                        'L', "000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$

+                {-1000L,                    'L', "000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$

+                {paris,                     'L', "453"}, //$NON-NLS-2$

+                {china,                     'L', "609"}, //$NON-NLS-2$

+                {0L,                        'M', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$

+                {-1000L,                    'M', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$

+                {paris,                     'M', "00"}, //$NON-NLS-2$

+                {china,                     'M', "00"}, //$NON-NLS-2$

+                {0L,                        'N', "000000000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$

+                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$

+                {paris,                     'N', "453000000"}, //$NON-NLS-2$

+                {china,                     'N', "468000000"}, //$NON-NLS-2$

+                {0L,                        'Q', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$

+                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$

+                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$

+                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$

+                {0L,                        'R', "08:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$

+                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$

+                {paris,                     'R', "12:00"}, //$NON-NLS-2$

+                {china,                     'R', "12:00"}, //$NON-NLS-2$

+                {0L,                        'S', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$

+                {-1000L,                    'S', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$

+                {paris,                     'S', "00"}, //$NON-NLS-2$

+                {china,                     'S', "00"}, //$NON-NLS-2$

+                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$

+                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$

+                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {china,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {0L,                        'Y', "1970"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$

+                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$

+                {paris,                     'Y', "2006"}, //$NON-NLS-2$

+                {china,                     'Y', "2006"}, //$NON-NLS-2$

+                {0L,                        'Z', "CST"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$

+                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$

+                {paris,                     'Z', "CEST"}, //$NON-NLS-2$

+                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$

+                

+        };

+

+        final Object[][] upperCaseJapanTriple = {

+                {0L,                        'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'A', "\u65e5\u66dc\u65e5"}, //$NON-NLS-2$

+                {-1000L,                    'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'A', "\u6728\u66dc\u65e5"}, //$NON-NLS-2$

+                {paris,                     'A', "\u6708\u66dc\u65e5"}, //$NON-NLS-2$

+                {china,                     'A', "\u6708\u66dc\u65e5"}, //$NON-NLS-2$

+                {0L,                        'B', "1\u6708"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'B', "8\u6708"}, //$NON-NLS-2$

+                {-1000L,                    'B', "1\u6708"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'B', "5\u6708"}, //$NON-NLS-2$

+                {paris,                     'B', "5\u6708"}, //$NON-NLS-2$

+                {china,                     'B', "5\u6708"}, //$NON-NLS-2$

+                {0L,                        'C', "19"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'C', "2922789"}, //$NON-NLS-2$

+                {-1000L,                    'C', "19"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'C', "20"}, //$NON-NLS-2$ 

+                {paris,                     'C', "20"}, //$NON-NLS-2$

+                {china,                     'C', "20"}, //$NON-NLS-2$

+                {0L,                        'D', "01/01/70"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'D', "08/17/94"}, //$NON-NLS-2$

+                {-1000L,                    'D', "01/01/70"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'D', "05/11/06"}, //$NON-NLS-2$

+                {paris,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {china,                     'D', "05/08/06"}, //$NON-NLS-2$

+                {0L,                        'F', "1970-01-01"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'F', "292278994-08-17"}, //$NON-NLS-2$

+                {-1000L,                    'F', "1970-01-01"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'F', "2006-05-11"}, //$NON-NLS-2$

+                {paris,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {china,                     'F', "2006-05-08"}, //$NON-NLS-2$

+                {0L,                        'H', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'H', "15"}, //$NON-NLS-2$

+                {-1000L,                    'H', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'H', "13"}, //$NON-NLS-2$

+                {paris,                     'H', "12"}, //$NON-NLS-2$

+                {china,                     'H', "12"}, //$NON-NLS-2$

+                {0L,                        'I', "08"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'I', "03"}, //$NON-NLS-2$

+                {-1000L,                    'I', "07"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'I', "01"}, //$NON-NLS-2$

+                {paris,                     'I', "12"}, //$NON-NLS-2$

+                {china,                     'I', "12"}, //$NON-NLS-2$

+                {0L,                        'L', "000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'L', "807"}, //$NON-NLS-2$

+                {-1000L,                    'L', "000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'L', "578"}, //$NON-NLS-2$

+                {paris,                     'L', "453"}, //$NON-NLS-2$

+                {china,                     'L', "609"}, //$NON-NLS-2$

+                {0L,                        'M', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'M', "18"}, //$NON-NLS-2$

+                {-1000L,                    'M', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'M', "59"}, //$NON-NLS-2$

+                {paris,                     'M', "00"}, //$NON-NLS-2$

+                {china,                     'M', "00"}, //$NON-NLS-2$

+                {0L,                        'N', "000000000"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'N', "807000000"}, //$NON-NLS-2$

+                {-1000L,                    'N', "000000000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'N', "578000000"}, //$NON-NLS-2$

+                {paris,                     'N', "453000000"}, //$NON-NLS-2$

+                {china,                     'N', "468000000"}, //$NON-NLS-2$

+                {0L,                        'Q', "0"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Q', "9223372036854775807"}, //$NON-NLS-2$

+                {-1000L,                    'Q', "-1000"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Q', "1147327147578"}, //$NON-NLS-2$

+                {paris,                     'Q', "1147082400453"}, //$NON-NLS-2$

+                {china,                     'Q', "1147118400609"}, //$NON-NLS-2$

+                {0L,                        'R', "08:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'R', "15:18"}, //$NON-NLS-2$

+                {-1000L,                    'R', "07:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'R', "13:59"}, //$NON-NLS-2$

+                {paris,                     'R', "12:00"}, //$NON-NLS-2$

+                {china,                     'R', "12:00"}, //$NON-NLS-2$

+                {0L,                        'S', "00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'S', "47"}, //$NON-NLS-2$

+                {-1000L,                    'S', "59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'S', "07"}, //$NON-NLS-2$

+                {paris,                     'S', "00"}, //$NON-NLS-2$

+                {china,                     'S', "00"}, //$NON-NLS-2$

+                {0L,                        'T', "08:00:00"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'T', "15:18:47"}, //$NON-NLS-2$

+                {-1000L,                    'T', "07:59:59"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'T', "13:59:07"}, //$NON-NLS-2$

+                {paris,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {china,                     'T', "12:00:00"}, //$NON-NLS-2$

+                {0L,                        'Y', "1970"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Y', "292278994"}, //$NON-NLS-2$

+                {-1000L,                    'Y', "1970"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Y', "2006"}, //$NON-NLS-2$

+                {paris,                     'Y', "2006"}, //$NON-NLS-2$

+                {china,                     'Y', "2006"}, //$NON-NLS-2$

+                {0L,                        'Z', "CST"}, //$NON-NLS-2$

+                {Long.MAX_VALUE,            'Z', "CST"}, //$NON-NLS-2$

+                {-1000L,                    'Z', "CST"}, //$NON-NLS-2$

+                {new Date(1147327147578L),  'Z', "CST"}, //$NON-NLS-2$

+                {paris,                     'Z', "CEST"}, //$NON-NLS-2$

+                {china,                     'Z', "GMT-08:00"}, //$NON-NLS-2$

+        };

+

+

+        for (int i = 0; i < 90; i++) {

+            String formatSpecifier = "%t" + upperCaseGermanTriple[i][pattern]; //$NON-NLS-2$

+            String formatSpecifierUpper = "%T" + upperCaseGermanTriple[i][pattern]; //$NON-NLS-2$

+                    if ((Character)upperCaseGermanTriple[i][pattern] == 'N') {

+                        // result can't be predicted on RI, so skip this test

+                        continue;

+                    }

+                    // test '%t'

+                    f = new Formatter(Locale.JAPAN);

+                    f.format(formatSpecifier, upperCaseJapanTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + upperCaseJapanTriple[i][input], //$NON-NLS-2$

+                            upperCaseJapanTriple[i][output], f.toString());

+

+                    f = new Formatter(Locale.JAPAN);

+                    f.format(Locale.GERMAN, formatSpecifier, upperCaseGermanTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + upperCaseGermanTriple[i][input], //$NON-NLS-2$

+                            upperCaseGermanTriple[i][output], f.toString());

+

+                    f = new Formatter(Locale.JAPAN);

+                    f.format(Locale.FRANCE, formatSpecifier, upperCaseFranceTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifier //$NON-NLS-2$

+                            + " Argument: " + upperCaseFranceTriple[i][input], //$NON-NLS-2$

+                            upperCaseFranceTriple[i][output], f.toString());

+

+                    // test '%T'

+                    f = new Formatter(Locale.GERMAN);

+                    f.format(formatSpecifierUpper, upperCaseGermanTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + upperCaseGermanTriple[i][input], //$NON-NLS-2$

+                            ((String)upperCaseGermanTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+

+                    f = new Formatter(Locale.GERMAN);

+                    f.format(Locale.JAPAN, formatSpecifierUpper, upperCaseJapanTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + upperCaseJapanTriple[i][input], //$NON-NLS-2$

+                            ((String)upperCaseJapanTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+

+                    f = new Formatter(Locale.GERMAN);

+                    f.format(Locale.FRANCE, formatSpecifierUpper, upperCaseFranceTriple[i][input]);

+                    assertEquals("Format pattern: " + formatSpecifierUpper //$NON-NLS-2$

+                            + " Argument: " + upperCaseFranceTriple[i][input], //$NON-NLS-2$

+                            ((String)upperCaseFranceTriple[i][output])

+                                    .toUpperCase(Locale.US), f.toString());

+        }

+

+        f = new Formatter(Locale.US);

+        f.format("%-10ta", now); //$NON-NLS-2$

+        assertEquals("Thu       ", f.toString()); //$NON-NLS-2$

+

+        f = new Formatter(Locale.US);

+        f.format("%10000000000000000000000000000000001ta", now); //$NON-NLS-2$

+        assertEquals("Thu", f.toString().trim()); //$NON-NLS-2$

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for null argment for

+     *        Byte/Short/Integer/Long/BigInteger conversion

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongNullConversion() {

+

+        Formatter f = new Formatter(Locale.FRANCE);

+        f.format("%d%<o%<x%<5X", (Integer) null);

+        assertEquals("nullnullnull NULL", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%d%<#03o %<0#4x%<6X", (Long) null);

+        assertEquals("nullnull null  NULL", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%(+,07d%<o %<x%<6X", (Byte) null);

+        assertEquals("   nullnull null  NULL", f.toString());

+

+        f = new Formatter(Locale.ITALY);

+        f.format("%(+,07d%<o %<x%<0#6X", (Short) null);

+        assertEquals("   nullnull null  NULL", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);

+        assertEquals("null   nullnull   NULL", f.toString());

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for legal

+     *        BigInteger conversion type 'd'

+     */

+    public void test_formatLjava_lang_String$LBigInteger() {

+        final Object[][] tripleD = {

+                {new BigInteger("123456789012345678901234567890"),          "%d",       "123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%10d",     "123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-1d",     "123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%+d",      "+123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "% d",      " 123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%,d",      "123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%(d",      "123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%08d",     "123456789012345678901234567890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-+,(11d", "+123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%0 ,(11d", " 123.456.789.012.345.678.901.234.567.890"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%d",       "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%10d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-1d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%+d",      "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "% d",      "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%,d",      "-9.876.543.210.987.654.321.098.765.432.100.000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%(d",      "(9876543210987654321098765432100000)"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%08d",     "-9876543210987654321098765432100000"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-+,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%0 ,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"}, //$NON-NLS-2$

+        };

+        

+        final int input = 0;

+        final int pattern = 1;

+        final int output = 2;

+        Formatter f;

+        for (int i = 0; i < tripleD.length; i++) {

+            f = new Formatter(Locale.GERMAN);

+            f.format((String) tripleD[i][pattern],

+                    tripleD[i][input]);

+            assertEquals("triple[" + i + "]:" + tripleD[i][input] + ",pattern["

+                    + i + "]:" + tripleD[i][pattern], tripleD[i][output], f

+                    .toString());

+            

+        }

+        

+        final Object[][] tripleO = {

+                {new BigInteger("123456789012345678901234567890"),          "%o",       "143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-6o",     "143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%08o",     "143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%#o",      "0143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%0#11o",   "0143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-#9o",    "0143564417755415637016711617605322"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%o",       "-36336340043453651353467270113157312240"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-6o",     "-36336340043453651353467270113157312240"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%08o",     "-36336340043453651353467270113157312240"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%#o",      "-036336340043453651353467270113157312240"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%0#11o",   "-036336340043453651353467270113157312240"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9o",    "-036336340043453651353467270113157312240"}, //$NON-NLS-2$

+        };

+        for (int i = 0; i < tripleO.length; i++) {

+            f = new Formatter(Locale.ITALY);

+            f.format((String) tripleO[i][pattern],

+                    tripleO[i][input]);

+            assertEquals("triple[" + i + "]:" + tripleO[i][input] + ",pattern["

+                    + i + "]:" + tripleO[i][pattern], tripleO[i][output], f

+                    .toString());

+            

+        }

+        

+        final Object[][] tripleX = {

+                {new BigInteger("123456789012345678901234567890"),          "%x",       "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-8x",     "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%06x",     "18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%#x",      "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%0#12x",   "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("123456789012345678901234567890"),          "%-#9x",    "0x18ee90ff6c373e0ee4e3f0ad2"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%x",       "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-8x",     "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%06x",     "-1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%#x",      "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%0#12x",   "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9x",    "-0x1e6f380472bd4bae6eb8259bd94a0"}, //$NON-NLS-2$

+        };

+        

+        for (int i = 0; i < tripleX.length; i++) {

+            f = new Formatter(Locale.FRANCE);

+            f.format((String) tripleX[i][pattern],

+                    tripleX[i][input]);

+            assertEquals("triple[" + i + "]:" + tripleX[i][input] + ",pattern["

+                    + i + "]:" + tripleX[i][pattern], tripleX[i][output], f

+                    .toString());

+            

+        }

+        

+        f = new Formatter(Locale.GERMAN);

+        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);

+        assertEquals("null   nullnull   NULL", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for padding of

+     *        BigInteger conversion

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerPaddingConversion() {

+        Formatter f = null;

+

+        BigInteger bigInt = new BigInteger("123456789012345678901234567890");

+        f = new Formatter(Locale.GERMAN);

+        f.format("%32d", bigInt);

+        assertEquals("  123456789012345678901234567890", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%+32x", bigInt);

+        assertEquals("      +18ee90ff6c373e0ee4e3f0ad2", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("% 32o", bigInt);

+        assertEquals(" 143564417755415637016711617605322", f.toString());

+

+        BigInteger negBigInt = new BigInteger(

+                "-1234567890123456789012345678901234567890");

+        f = new Formatter(Locale.GERMAN);

+        f.format("%( 040X", negBigInt);

+        assertEquals("(000003A0C92075C0DBF3B8ACBC5F96CE3F0AD2)", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%+(045d", negBigInt);

+        assertEquals("(0001234567890123456789012345678901234567890)", f

+                .toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%+,-(60d", negBigInt);

+        assertEquals(

+                "(1.234.567.890.123.456.789.012.345.678.901.234.567.890)     ",

+                f.toString());

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigInteger

+     *        conversion exception

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerConversionException() {

+        Formatter f = null;

+

+        final String[] flagsConversionMismatches = { "%#d", "%,o", "%,x", "%,X" };

+        for (int i = 0; i < flagsConversionMismatches.length; i++) {

+            try {

+                f = new Formatter(Locale.CHINA);

+                f.format(flagsConversionMismatches[i], new BigInteger("1"));

+                fail("should throw FormatFlagsConversionMismatchException");

+            } catch (FormatFlagsConversionMismatchException e) {

+                // expected

+            }

+        }

+

+        final String[] missingFormatWidths = { "%-0d", "%0d", "%-d", "%-0o",

+                "%0o", "%-o", "%-0x", "%0x", "%-x", "%-0X", "%0X", "%-X" };

+        for (int i = 0; i < missingFormatWidths.length; i++) {

+            try {

+                f = new Formatter(Locale.KOREA);

+                f.format(missingFormatWidths[i], new BigInteger("1"));

+                fail("should throw MissingFormatWidthException");

+            } catch (MissingFormatWidthException e) {

+                // expected

+            }

+        }

+

+        final String[] illFlags = { "%+ d", "%-08d", "%+ o", "%-08o", "%+ x",

+                "%-08x", "%+ X", "%-08X" };

+        for (int i = 0; i < illFlags.length; i++) {

+            try {

+                f = new Formatter(Locale.CANADA);

+                f.format(illFlags[i], new BigInteger("1"));

+                fail("should throw IllegalFormatFlagsException");

+            } catch (IllegalFormatFlagsException e) {

+                // expected

+            }

+        }

+

+        final String[] precisionExceptions = { "%.4d", "%2.5o", "%8.6x",

+                "%11.17X" };

+        for (int i = 0; i < precisionExceptions.length; i++) {

+            try {

+                f = new Formatter(Locale.US);

+                f.format(precisionExceptions[i], new BigInteger("1"));

+                fail("should throw IllegalFormatPrecisionException");

+            } catch (IllegalFormatPrecisionException e) {

+                // expected

+            }

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%D", new BigInteger("1"));

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%O", new BigInteger("1"));

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            f = new Formatter();

+            f.format("%010000000000000000000000000000000001d", new BigInteger(

+                    "1"));

+            fail("should throw MissingFormatWidthException");

+        } catch (MissingFormatWidthException e) {

+            // expected

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigInteger

+     *        exception throwing order

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerExceptionOrder() {

+        Formatter f = null;

+        BigInteger big = new BigInteger("100");

+

+        /*

+         * Order summary: UnknownFormatConversionException >

+         * MissingFormatWidthException > IllegalFormatFlagsException >

+         * IllegalFormatPrecisionException > IllegalFormatConversionException >

+         * FormatFlagsConversionMismatchException

+         * 

+         */

+        f = new Formatter(Locale.US);

+        try {

+            // compare IllegalFormatConversionException and

+            // FormatFlagsConversionMismatchException

+            f.format("%(o", false);

+            fail("should throw IllegalFormatConversionException");

+        } catch (IllegalFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            // compare IllegalFormatPrecisionException and

+            // IllegalFormatConversionException

+            f.format("%.4o", false);

+            fail("should throw IllegalFormatPrecisionException");

+        } catch (IllegalFormatPrecisionException e) {

+            // expected

+        }

+

+        try {

+            // compare IllegalFormatFlagsException and

+            // IllegalFormatPrecisionException

+            f.format("%+ .4o", big);

+            fail("should throw IllegalFormatFlagsException");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+

+        try {

+            // compare MissingFormatWidthException and

+            // IllegalFormatFlagsException

+            f.format("%+ -o", big);

+            fail("should throw MissingFormatWidthException");

+        } catch (MissingFormatWidthException e) {

+            // expected

+        }

+

+        try {

+            // compare UnknownFormatConversionException and

+            // MissingFormatWidthException

+            f.format("%-O", big);

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+    }

+    

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Float/Double

+     *        conversion type 'e' and 'E'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionE() {

+        Formatter f = null;

+        final Object[][] tripleE = {

+                {0f, "%e",          "0.000000e+00"},

+                {0f, "%#.0e",       "0.e+00"},

+                {0f, "%#- (9.8e",   " 0.00000000e+00"},

+                {0f, "%#+0(8.4e",   "+0.0000e+00"},

+                {0f, "%-+(1.6e",    "+0.000000e+00"},

+                {0f, "% 0(12e",     " 0.000000e+00"},

+                

+                {101f, "%e",          "1.010000e+02"},

+                {101f, "%#.0e",       "1.e+02"},

+                {101f, "%#- (9.8e",   " 1.01000000e+02"},

+                {101f, "%#+0(8.4e",   "+1.0100e+02"},

+                {101f, "%-+(1.6e",    "+1.010000e+02"},

+                {101f, "% 0(12e",     " 1.010000e+02"},

+                

+                {1.f, "%e",          "1.000000e+00"},

+                {1.f, "%#.0e",       "1.e+00"},

+                {1.f, "%#- (9.8e",   " 1.00000000e+00"},

+                {1.f, "%#+0(8.4e",   "+1.0000e+00"},

+                {1.f, "%-+(1.6e",    "+1.000000e+00"},

+                {1.f, "% 0(12e",     " 1.000000e+00"},

+                

+                {-98f, "%e",          "-9.800000e+01"},

+                {-98f, "%#.0e",       "-1.e+02"},

+                {-98f, "%#- (9.8e",   "(9.80000000e+01)"},

+                {-98f, "%#+0(8.4e",   "(9.8000e+01)"},

+                {-98f, "%-+(1.6e",    "(9.800000e+01)"},

+                {-98f, "% 0(12e",     "(9.800000e+01)"},

+                

+                {1.23f, "%e",          "1.230000e+00"},

+                {1.23f, "%#.0e",       "1.e+00"},

+                {1.23f, "%#- (9.8e",   " 1.23000002e+00"},

+                {1.23f, "%#+0(8.4e",   "+1.2300e+00"},

+                {1.23f, "%-+(1.6e",    "+1.230000e+00"},

+                {1.23f, "% 0(12e",     " 1.230000e+00"},

+                

+                {34.1234567f, "%e",          "3.412346e+01"},

+                {34.1234567f, "%#.0e",       "3.e+01"},

+                {34.1234567f, "%#- (9.8e",   " 3.41234550e+01"},

+                {34.1234567f, "%#+0(8.4e",   "+3.4123e+01"},

+                {34.1234567f, "%-+(1.6e",    "+3.412346e+01"},

+                {34.1234567f, "% 0(12e",     " 3.412346e+01"},

+                

+                {-.12345f, "%e",          "-1.234500e-01"},

+                {-.12345f, "%#.0e",       "-1.e-01"},

+                {-.12345f, "%#- (9.8e",   "(1.23450004e-01)"},

+                {-.12345f, "%#+0(8.4e",   "(1.2345e-01)"},

+                {-.12345f, "%-+(1.6e",    "(1.234500e-01)"},

+                {-.12345f, "% 0(12e",     "(1.234500e-01)"},

+                

+                {-9876.1234567f, "%e",          "-9.876123e+03"},

+                {-9876.1234567f, "%#.0e",       "-1.e+04"},

+                {-9876.1234567f, "%#- (9.8e",   "(9.87612305e+03)"},

+                {-9876.1234567f, "%#+0(8.4e",   "(9.8761e+03)"},

+                {-9876.1234567f, "%-+(1.6e",    "(9.876123e+03)"},

+                {-9876.1234567f, "% 0(12e",     "(9.876123e+03)"},

+                

+                {Float.MAX_VALUE, "%e",          "3.402823e+38"},

+                {Float.MAX_VALUE, "%#.0e",       "3.e+38"},

+                {Float.MAX_VALUE, "%#- (9.8e",   " 3.40282347e+38"},

+                {Float.MAX_VALUE, "%#+0(8.4e",   "+3.4028e+38"},

+                {Float.MAX_VALUE, "%-+(1.6e",    "+3.402823e+38"},

+                {Float.MAX_VALUE, "% 0(12e",     " 3.402823e+38"},

+                

+                {Float.MIN_VALUE, "%e",          "1.401298e-45"},

+                {Float.MIN_VALUE, "%#.0e",       "1.e-45"},

+                {Float.MIN_VALUE, "%#- (9.8e",   " 1.40129846e-45"},

+                {Float.MIN_VALUE, "%#+0(8.4e",   "+1.4013e-45"},

+                {Float.MIN_VALUE, "%-+(1.6e",    "+1.401298e-45"},

+                {Float.MIN_VALUE, "% 0(12e",     " 1.401298e-45"},

+                

+                {Float.NaN, "%e",          "NaN"},

+                {Float.NaN, "%#.0e",       "NaN"},

+                {Float.NaN, "%#- (9.8e",   "NaN      "},

+                {Float.NaN, "%#+0(8.4e",   "     NaN"},

+                {Float.NaN, "%-+(1.6e",    "NaN"},

+                {Float.NaN, "% 0(12e",     "         NaN"},

+                

+                

+                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},

+                

+                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},

+                

+                {0d, "%e",          "0.000000e+00"},

+                {0d, "%#.0e",       "0.e+00"},

+                {0d, "%#- (9.8e",   " 0.00000000e+00"},

+                {0d, "%#+0(8.4e",   "+0.0000e+00"},

+                {0d, "%-+(1.6e",    "+0.000000e+00"},

+                {0d, "% 0(12e",     " 0.000000e+00"},

+                

+                {1d, "%e",          "1.000000e+00"},

+                {1d, "%#.0e",       "1.e+00"},

+                {1d, "%#- (9.8e",   " 1.00000000e+00"},

+                {1d, "%#+0(8.4e",   "+1.0000e+00"},

+                {1d, "%-+(1.6e",    "+1.000000e+00"},

+                {1d, "% 0(12e",     " 1.000000e+00"},

+                

+                {-1d, "%e",          "-1.000000e+00"},

+                {-1d, "%#.0e",       "-1.e+00"},

+                {-1d, "%#- (9.8e",   "(1.00000000e+00)"},

+                {-1d, "%#+0(8.4e",   "(1.0000e+00)"},

+                {-1d, "%-+(1.6e",    "(1.000000e+00)"},

+                {-1d, "% 0(12e",     "(1.000000e+00)"},

+                

+                

+                {.00000001d, "%e",          "1.000000e-08"},

+                {.00000001d, "%#.0e",       "1.e-08"},

+                {.00000001d, "%#- (9.8e",   " 1.00000000e-08"},

+                {.00000001d, "%#+0(8.4e",   "+1.0000e-08"},

+                {.00000001d, "%-+(1.6e",    "+1.000000e-08"},

+                {.00000001d, "% 0(12e",     " 1.000000e-08"},

+                

+                {9122.10d, "%e",          "9.122100e+03"},

+                {9122.10d, "%#.0e",       "9.e+03"},

+                {9122.10d, "%#- (9.8e",   " 9.12210000e+03"},

+                {9122.10d, "%#+0(8.4e",   "+9.1221e+03"},

+                {9122.10d, "%-+(1.6e",    "+9.122100e+03"},

+                {9122.10d, "% 0(12e",     " 9.122100e+03"},

+                

+                {0.1d, "%e",          "1.000000e-01"},

+                {0.1d, "%#.0e",       "1.e-01"},

+                {0.1d, "%#- (9.8e",   " 1.00000000e-01"},

+                {0.1d, "%#+0(8.4e",   "+1.0000e-01"},

+                {0.1d, "%-+(1.6e",    "+1.000000e-01"},

+                {0.1d, "% 0(12e",     " 1.000000e-01"},

+                

+                {-2.d, "%e",          "-2.000000e+00"},

+                {-2.d, "%#.0e",       "-2.e+00"},

+                {-2.d, "%#- (9.8e",   "(2.00000000e+00)"},

+                {-2.d, "%#+0(8.4e",   "(2.0000e+00)"},

+                {-2.d, "%-+(1.6e",    "(2.000000e+00)"},

+                {-2.d, "% 0(12e",     "(2.000000e+00)"},

+                

+                {-.39d, "%e",          "-3.900000e-01"},

+                {-.39d, "%#.0e",       "-4.e-01"},

+                {-.39d, "%#- (9.8e",   "(3.90000000e-01)"},

+                {-.39d, "%#+0(8.4e",   "(3.9000e-01)"},

+                {-.39d, "%-+(1.6e",    "(3.900000e-01)"},

+                {-.39d, "% 0(12e",     "(3.900000e-01)"},

+                

+                {-1234567890.012345678d, "%e",          "-1.234568e+09"},

+                {-1234567890.012345678d, "%#.0e",       "-1.e+09"},

+                {-1234567890.012345678d, "%#- (9.8e",   "(1.23456789e+09)"},

+                {-1234567890.012345678d, "%#+0(8.4e",   "(1.2346e+09)"},

+                {-1234567890.012345678d, "%-+(1.6e",    "(1.234568e+09)"},

+                {-1234567890.012345678d, "% 0(12e",     "(1.234568e+09)"},

+                

+                {Double.MAX_VALUE, "%e",          "1.797693e+308"},

+                {Double.MAX_VALUE, "%#.0e",       "2.e+308"},

+                {Double.MAX_VALUE, "%#- (9.8e",   " 1.79769313e+308"},

+                {Double.MAX_VALUE, "%#+0(8.4e",   "+1.7977e+308"},

+                {Double.MAX_VALUE, "%-+(1.6e",    "+1.797693e+308"},

+                {Double.MAX_VALUE, "% 0(12e",     " 1.797693e+308"},

+                

+                {Double.MIN_VALUE, "%e",          "4.900000e-324"},

+                {Double.MIN_VALUE, "%#.0e",       "5.e-324"},

+                {Double.MIN_VALUE, "%#- (9.8e",   " 4.90000000e-324"},

+                {Double.MIN_VALUE, "%#+0(8.4e",   "+4.9000e-324"},

+                {Double.MIN_VALUE, "%-+(1.6e",    "+4.900000e-324"},

+                {Double.MIN_VALUE, "% 0(12e",     " 4.900000e-324"},

+                

+                {Double.NaN, "%e",          "NaN"},

+                {Double.NaN, "%#.0e",       "NaN"},

+                {Double.NaN, "%#- (9.8e",   "NaN      "},

+                {Double.NaN, "%#+0(8.4e",   "     NaN"},

+                {Double.NaN, "%-+(1.6e",    "NaN"},

+                {Double.NaN, "% 0(12e",     "         NaN"},

+                

+                {Double.NEGATIVE_INFINITY, "%e",          "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},

+                

+                {Double.POSITIVE_INFINITY, "%e",          "Infinity"},

+                {Double.POSITIVE_INFINITY, "%#.0e",       "Infinity"},

+                {Double.POSITIVE_INFINITY, "%#- (9.8e",   " Infinity"},

+                {Double.POSITIVE_INFINITY, "%#+0(8.4e",   "+Infinity"},

+                {Double.POSITIVE_INFINITY, "%-+(1.6e",    "+Infinity"},

+                {Double.POSITIVE_INFINITY, "% 0(12e",     "    Infinity"},

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleE.length; i++) {

+                f = new Formatter(Locale.US);

+                f.format((String)tripleE[i][pattern], tripleE[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["

+                        + i + "]:" + tripleE[i][pattern],

+                        tripleE[i][output], f.toString());

+

+                // test for conversion type 'E'

+                f = new Formatter(Locale.US);

+                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["

+                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])

+                        .toUpperCase(Locale.UK), f.toString());

+            }

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%e", 1001f);

+        /*

+         * fail on RI, spec says 'e' requires the output to be formatted in

+         * general scientific notation and the localization algorithm is

+         * applied. But RI format this case to 1.001000e+03, which does not

+         * conform to the German Locale

+         */

+        assertEquals("1,001000e+03", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Float/Double

+     *        conversion type 'g' and 'G'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG() {

+        Formatter f = null;

+        final Object[][] tripleG = {

+                {1001f, "%g",           "1001.00"},

+                {1001f, "%- (,9.8g",    " 1,001.0000"},

+                {1001f, "%+0(,8.4g",    "+001,001"},

+                {1001f, "%-+(,1.6g",    "+1,001.00"},

+                {1001f, "% 0(,12.0g",   " 0000001e+03"},

+                

+                {1.f, "%g",           "1.00000"},

+                {1.f, "%- (,9.8g",    " 1.0000000"},

+                {1.f, "%+0(,8.4g",    "+001.000"},

+                {1.f, "%-+(,1.6g",    "+1.00000"},

+                {1.f, "% 0(,12.0g",   " 00000000001"},

+                

+                {-98f, "%g",           "-98.0000"},

+                {-98f, "%- (,9.8g",    "(98.000000)"},

+                {-98f, "%+0(,8.4g",    "(098.00)"},

+                {-98f, "%-+(,1.6g",    "(98.0000)"},

+                {-98f, "% 0(,12.0g",   "(000001e+02)"},

+                

+                {0.000001f, "%g",           "1.00000e-06"},

+                {0.000001f, "%- (,9.8g",    " 1.0000000e-06"},

+                {0.000001f, "%+0(,8.4g",    "+1.000e-06"},

+                {0.000001f, "%-+(,1.6g",    "+1.00000e-06"},

+                {0.000001f, "% 0(,12.0g",   " 0000001e-06"},

+                

+                {345.1234567f, "%g",           "345.123"},

+                {345.1234567f, "%- (,9.8g",    " 345.12344"},

+                {345.1234567f, "%+0(,8.4g",    "+00345.1"},

+                {345.1234567f, "%-+(,1.6g",    "+345.123"},

+                {345.1234567f, "% 0(,12.0g",   " 0000003e+02"},

+

+                {-.00000012345f, "%g",           "-1.23450e-07"},

+                {-.00000012345f, "%- (,9.8g",    "(1.2344999e-07)"},

+                {-.00000012345f, "%+0(,8.4g",    "(1.234e-07)"},

+                {-.00000012345f, "%-+(,1.6g",    "(1.23450e-07)"},

+                {-.00000012345f, "% 0(,12.0g",   "(000001e-07)"},

+                

+                {-987.1234567f, "%g",           "-987.123"},

+                {-987.1234567f, "%- (,9.8g",    "(987.12347)"},

+                {-987.1234567f, "%+0(,8.4g",    "(0987.1)"},

+                {-987.1234567f, "%-+(,1.6g",    "(987.123)"},

+                {-987.1234567f, "% 0(,12.0g",   "(000001e+03)"},

+                

+                {Float.MAX_VALUE, "%g",           "3.40282e+38"},

+                {Float.MAX_VALUE, "%- (,9.8g",    " 3.4028235e+38"},

+                {Float.MAX_VALUE, "%+0(,8.4g",    "+3.403e+38"},

+                {Float.MAX_VALUE, "%-+(,1.6g",    "+3.40282e+38"},

+                {Float.MAX_VALUE, "% 0(,12.0g",   " 0000003e+38"},

+                

+                {Float.MIN_VALUE, "%g",           "1.40130e-45"},

+                {Float.MIN_VALUE, "%- (,9.8g",    " 1.4012985e-45"},

+                {Float.MIN_VALUE, "%+0(,8.4g",    "+1.401e-45"},

+                {Float.MIN_VALUE, "%-+(,1.6g",    "+1.40130e-45"},

+                {Float.MIN_VALUE, "% 0(,12.0g",   " 0000001e-45"},

+                

+                {Float.NaN, "%g",           "NaN"},

+                {Float.NaN, "%- (,9.8g",    "NaN      "},

+                {Float.NaN, "%+0(,8.4g",    "     NaN"},

+                {Float.NaN, "%-+(,1.6g",    "NaN"},

+                {Float.NaN, "% 0(,12.0g",   "         NaN"},

+                

+                {Float.NEGATIVE_INFINITY, "%g",           "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},

+                

+                {Float.POSITIVE_INFINITY, "%g",           "Infinity"},

+                {Float.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},

+                {Float.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},

+                {Float.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},

+                {Float.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},

+                

+                {1d, "%g",           "1.00000"},

+                {1d, "%- (,9.8g",    " 1.0000000"},

+                {1d, "%+0(,8.4g",    "+001.000"},

+                {1d, "%-+(,1.6g",    "+1.00000"},

+                {1d, "% 0(,12.0g",   " 00000000001"},

+                

+                {-1d, "%g",           "-1.00000"},

+                {-1d, "%- (,9.8g",    "(1.0000000)"},

+                {-1d, "%+0(,8.4g",    "(01.000)"},

+                {-1d, "%-+(,1.6g",    "(1.00000)"},

+                {-1d, "% 0(,12.0g",   "(0000000001)"},

+                

+                {.00000001d, "%g",           "1.00000e-08"},

+                {.00000001d, "%- (,9.8g",    " 1.0000000e-08"},

+                {.00000001d, "%+0(,8.4g",    "+1.000e-08"},

+                {.00000001d, "%-+(,1.6g",    "+1.00000e-08"},

+                {.00000001d, "% 0(,12.0g",   " 0000001e-08"},

+                

+                {1912.10d, "%g",           "1912.10"},

+                {1912.10d, "%- (,9.8g",    " 1,912.1000"},

+                {1912.10d, "%+0(,8.4g",    "+001,912"},

+                {1912.10d, "%-+(,1.6g",    "+1,912.10"},

+                {1912.10d, "% 0(,12.0g",   " 0000002e+03"},

+                

+                {0.1d, "%g",           "0.100000"},

+                {0.1d, "%- (,9.8g",    " 0.10000000"},

+                {0.1d, "%+0(,8.4g",    "+00.1000"},

+                {0.1d, "%-+(,1.6g",    "+0.100000"},

+                {0.1d, "% 0(,12.0g",   " 000000000.1"},

+                

+                {-2.d, "%g",           "-2.00000"},

+                {-2.d, "%- (,9.8g",    "(2.0000000)"},

+                {-2.d, "%+0(,8.4g",    "(02.000)"},

+                {-2.d, "%-+(,1.6g",    "(2.00000)"},

+                {-2.d, "% 0(,12.0g",   "(0000000002)"},

+                

+                {-.00039d, "%g",           "-0.000390000"},

+                {-.00039d, "%- (,9.8g",    "(0.00039000000)"},

+                {-.00039d, "%+0(,8.4g",    "(0.0003900)"},

+                {-.00039d, "%-+(,1.6g",    "(0.000390000)"},

+                {-.00039d, "% 0(,12.0g",   "(00000.0004)"},

+                

+                {-1234567890.012345678d, "%g",           "-1.23457e+09"},

+                {-1234567890.012345678d, "%- (,9.8g",    "(1.2345679e+09)"},

+                {-1234567890.012345678d, "%+0(,8.4g",    "(1.235e+09)"},

+                {-1234567890.012345678d, "%-+(,1.6g",    "(1.23457e+09)"},

+                {-1234567890.012345678d, "% 0(,12.0g",   "(000001e+09)"},

+                

+                {Double.MAX_VALUE, "%g",           "1.79769e+308"},

+                {Double.MAX_VALUE, "%- (,9.8g",    " 1.7976931e+308"},

+                {Double.MAX_VALUE, "%+0(,8.4g",    "+1.798e+308"},

+                {Double.MAX_VALUE, "%-+(,1.6g",    "+1.79769e+308"},

+                {Double.MAX_VALUE, "% 0(,12.0g",   " 000002e+308"},

+                

+                {Double.MIN_VALUE, "%g",           "4.90000e-324"},

+                {Double.MIN_VALUE, "%- (,9.8g",    " 4.9000000e-324"},

+                {Double.MIN_VALUE, "%+0(,8.4g",    "+4.900e-324"},

+                {Double.MIN_VALUE, "%-+(,1.6g",    "+4.90000e-324"},

+                {Double.MIN_VALUE, "% 0(,12.0g",   " 000005e-324"},

+                

+                {Double.NaN, "%g",           "NaN"},

+                {Double.NaN, "%- (,9.8g",    "NaN      "},

+                {Double.NaN, "%+0(,8.4g",    "     NaN"},

+                {Double.NaN, "%-+(,1.6g",    "NaN"},

+                {Double.NaN, "% 0(,12.0g",   "         NaN"},

+                

+                {Double.NEGATIVE_INFINITY, "%g",           "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},

+                

+                {Double.POSITIVE_INFINITY, "%g",           "Infinity"},

+                {Double.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},

+                {Double.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},

+                {Double.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},

+                {Double.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},

+                

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleG.length; i++) {

+                

+                f = new Formatter(Locale.US);

+                f.format((String)tripleG[i][pattern], tripleG[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["

+                        + i + "]:" + tripleG[i][pattern],

+                        tripleG[i][output], f.toString());

+

+                // test for conversion type 'G'

+                f = new Formatter(Locale.US);

+                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["

+                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])

+                        .toUpperCase(Locale.UK), f.toString());

+            }

+

+        f = new Formatter(Locale.US);

+        f.format("%.5g", 0f);

+        assertEquals("0.0000", f.toString());

+

+        f = new Formatter(Locale.US);

+        f.format("%.0g", 0f);

+        /*

+         * fail on RI, spec says if the precision is 0, then it is taken to be

+         * 1. but RI throws ArrayIndexOutOfBoundsException.

+         */

+        assertEquals("0", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%g", 1001f);

+        /*

+         * fail on RI, spec says 'g' requires the output to be formatted in

+         * general scientific notation and the localization algorithm is

+         * applied. But RI format this case to 1001.00, which does not conform

+         * to the German Locale

+         */

+        assertEquals("1001,00", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Float/Double

+     *        conversion type 'g' and 'G' overflow

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG_Overflow() {

+        Formatter f = new Formatter();

+        f.format("%g", 999999.5);

+        assertEquals("1.00000e+06", f.toString());

+

+        f = new Formatter();

+        f.format("%g", 99999.5);

+        assertEquals("99999.5", f.toString());

+

+        f = new Formatter();

+        f.format("%.4g", 99.95);

+        assertEquals("99.95", f.toString());

+

+        f = new Formatter();

+        f.format("%g", 99.95);

+        assertEquals("99.9500", f.toString());

+

+        f = new Formatter();

+        f.format("%g", 0.9);

+        assertEquals("0.900000", f.toString());

+

+        f = new Formatter();

+        f.format("%.0g", 0.000095);

+        assertEquals("0.0001", f.toString());

+

+        f = new Formatter();

+        f.format("%g", 0.0999999);

+        assertEquals("0.0999999", f.toString());

+

+        f = new Formatter();

+        f.format("%g", 0.00009);

+        assertEquals("9.00000e-05", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Float/Double

+     *        conversion type 'f'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionF() {

+        Formatter f = null;

+

+        final Object[][] tripleF = {

+                {0f, "%f",          "0,000000"},

+                {0f, "%#.3f",       "0,000"},

+                {0f, "%,5f",        "0,000000"},

+                {0f, "%- (12.0f",   " 0          "},

+                {0f, "%#+0(1.6f",   "+0,000000"},

+                {0f, "%-+(8.4f",    "+0,0000 "},

+                {0f, "% 0#(9.8f",   " 0,00000000"},

+                

+                {1234f, "%f",          "1234,000000"},

+                {1234f, "%#.3f",       "1234,000"},

+                {1234f, "%,5f",        "1.234,000000"},

+                {1234f, "%- (12.0f",   " 1234       "},

+                {1234f, "%#+0(1.6f",   "+1234,000000"},

+                {1234f, "%-+(8.4f",    "+1234,0000"},

+                {1234f, "% 0#(9.8f",   " 1234,00000000"},

+                

+                {1.f, "%f",          "1,000000"},

+                {1.f, "%#.3f",       "1,000"},

+                {1.f, "%,5f",        "1,000000"},

+                {1.f, "%- (12.0f",   " 1          "},

+                {1.f, "%#+0(1.6f",   "+1,000000"},

+                {1.f, "%-+(8.4f",    "+1,0000 "},

+                {1.f, "% 0#(9.8f",   " 1,00000000"},

+                

+                {-98f, "%f",          "-98,000000"},

+                {-98f, "%#.3f",       "-98,000"},

+                {-98f, "%,5f",        "-98,000000"},

+                {-98f, "%- (12.0f",   "(98)        "},

+                {-98f, "%#+0(1.6f",   "(98,000000)"},

+                {-98f, "%-+(8.4f",    "(98,0000)"},

+                {-98f, "% 0#(9.8f",   "(98,00000000)"},

+                

+                {0.000001f, "%f",          "0,000001"},

+                {0.000001f, "%#.3f",       "0,000"},

+                {0.000001f, "%,5f",        "0,000001"},

+                {0.000001f, "%- (12.0f",   " 0          "},

+                {0.000001f, "%#+0(1.6f",   "+0,000001"},

+                {0.000001f, "%-+(8.4f",    "+0,0000 "},

+                {0.000001f, "% 0#(9.8f",   " 0,00000100"},

+                

+                {345.1234567f, "%f",          "345,123444"},

+                {345.1234567f, "%#.3f",       "345,123"},

+                {345.1234567f, "%,5f",        "345,123444"},

+                {345.1234567f, "%- (12.0f",   " 345        "},

+                {345.1234567f, "%#+0(1.6f",   "+345,123444"},

+                {345.1234567f, "%-+(8.4f",    "+345,1234"},

+                {345.1234567f, "% 0#(9.8f",   " 345,12344360"},

+                

+                {-.00000012345f, "%f",          "-0,000000"},

+                {-.00000012345f, "%#.3f",       "-0,000"},

+                {-.00000012345f, "%,5f",        "-0,000000"},

+                {-.00000012345f, "%- (12.0f",   "(0)         "},

+                {-.00000012345f, "%#+0(1.6f",   "(0,000000)"},

+                {-.00000012345f, "%-+(8.4f",    "(0,0000)"},

+                {-.00000012345f, "% 0#(9.8f",   "(0,00000012)"},

+                

+                {-987654321.1234567f, "%f",          "-987654336,000000"},

+                {-987654321.1234567f, "%#.3f",       "-987654336,000"},

+                {-987654321.1234567f, "%,5f",        "-987.654.336,000000"},

+                {-987654321.1234567f, "%- (12.0f",   "(987654336) "},

+                {-987654321.1234567f, "%#+0(1.6f",   "(987654336,000000)"},

+                {-987654321.1234567f, "%-+(8.4f",    "(987654336,0000)"},

+                {-987654321.1234567f, "% 0#(9.8f",   "(987654336,00000000)"},

+                

+                {Float.MAX_VALUE, "%f",          "340282346638528860000000000000000000000,000000"},

+                {Float.MAX_VALUE, "%#.3f",       "340282346638528860000000000000000000000,000"},

+                {Float.MAX_VALUE, "%,5f",        "340.282.346.638.528.860.000.000.000.000.000.000.000,000000"},

+                {Float.MAX_VALUE, "%- (12.0f",   " 340282346638528860000000000000000000000"},

+                {Float.MAX_VALUE, "%#+0(1.6f",   "+340282346638528860000000000000000000000,000000"},

+                {Float.MAX_VALUE, "%-+(8.4f",    "+340282346638528860000000000000000000000,0000"},

+                {Float.MAX_VALUE, "% 0#(9.8f",   " 340282346638528860000000000000000000000,00000000"},

+                

+                {Float.MIN_VALUE, "%f",          "0,000000"},

+                {Float.MIN_VALUE, "%#.3f",       "0,000"},

+                {Float.MIN_VALUE, "%,5f",        "0,000000"},

+                {Float.MIN_VALUE, "%- (12.0f",   " 0          "},

+                {Float.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},

+                {Float.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},

+                {Float.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},

+                

+                {Float.NaN, "%f",          "NaN"},

+                {Float.NaN, "%#.3f",       "NaN"},

+                {Float.NaN, "%,5f",        "  NaN"},

+                {Float.NaN, "%- (12.0f",   "NaN         "},

+                {Float.NaN, "%#+0(1.6f",   "NaN"},

+                {Float.NaN, "%-+(8.4f",    "NaN     "},

+                {Float.NaN, "% 0#(9.8f",   "      NaN"},

+                

+                {Float.NEGATIVE_INFINITY, "%f",          "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},

+                {Float.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},

+                {Float.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},

+                

+                {Float.POSITIVE_INFINITY, "%f",          "Infinity"},

+                {Float.POSITIVE_INFINITY, "%#.3f",       "Infinity"},

+                {Float.POSITIVE_INFINITY, "%,5f",        "Infinity"},

+                {Float.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},

+                {Float.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},

+                {Float.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},

+                {Float.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},

+                

+                

+                {0d, "%f",          "0,000000"},

+                {0d, "%#.3f",       "0,000"},

+                {0d, "%,5f",        "0,000000"},

+                {0d, "%- (12.0f",   " 0          "},

+                {0d, "%#+0(1.6f",   "+0,000000"},

+                {0d, "%-+(8.4f",    "+0,0000 "},

+                {0d, "% 0#(9.8f",   " 0,00000000"},

+                

+                {1d, "%f",          "1,000000"},

+                {1d, "%#.3f",       "1,000"},

+                {1d, "%,5f",        "1,000000"},

+                {1d, "%- (12.0f",   " 1          "},

+                {1d, "%#+0(1.6f",   "+1,000000"},

+                {1d, "%-+(8.4f",    "+1,0000 "},

+                {1d, "% 0#(9.8f",   " 1,00000000"},

+                

+                {-1d, "%f",          "-1,000000"},

+                {-1d, "%#.3f",       "-1,000"},

+                {-1d, "%,5f",        "-1,000000"},

+                {-1d, "%- (12.0f",   "(1)         "},

+                {-1d, "%#+0(1.6f",   "(1,000000)"},

+                {-1d, "%-+(8.4f",    "(1,0000)"},

+                {-1d, "% 0#(9.8f",   "(1,00000000)"},

+                

+                {.00000001d, "%f",          "0,000000"},

+                {.00000001d, "%#.3f",       "0,000"},

+                {.00000001d, "%,5f",        "0,000000"},

+                {.00000001d, "%- (12.0f",   " 0          "},

+                {.00000001d, "%#+0(1.6f",   "+0,000000"},

+                {.00000001d, "%-+(8.4f",    "+0,0000 "},

+                {.00000001d, "% 0#(9.8f",   " 0,00000001"},

+                

+                {1000.10d, "%f",          "1000,100000"},

+                {1000.10d, "%#.3f",       "1000,100"},

+                {1000.10d, "%,5f",        "1.000,100000"},

+                {1000.10d, "%- (12.0f",   " 1000       "},

+                {1000.10d, "%#+0(1.6f",   "+1000,100000"},

+                {1000.10d, "%-+(8.4f",    "+1000,1000"},

+                {1000.10d, "% 0#(9.8f",   " 1000,10000000"},

+                

+                {0.1d, "%f",          "0,100000"},

+                {0.1d, "%#.3f",       "0,100"},

+                {0.1d, "%,5f",        "0,100000"},

+                {0.1d, "%- (12.0f",   " 0          "},

+                {0.1d, "%#+0(1.6f",   "+0,100000"},

+                {0.1d, "%-+(8.4f",    "+0,1000 "},

+                {0.1d, "% 0#(9.8f",   " 0,10000000"},

+                

+                {-2.d, "%f",          "-2,000000"},

+                {-2.d, "%#.3f",       "-2,000"},

+                {-2.d, "%,5f",        "-2,000000"},

+                {-2.d, "%- (12.0f",   "(2)         "},

+                {-2.d, "%#+0(1.6f",   "(2,000000)"},

+                {-2.d, "%-+(8.4f",    "(2,0000)"},

+                {-2.d, "% 0#(9.8f",   "(2,00000000)"},

+                

+                {-.00009d, "%f",          "-0,000090"},

+                {-.00009d, "%#.3f",       "-0,000"},

+                {-.00009d, "%,5f",        "-0,000090"},

+                {-.00009d, "%- (12.0f",   "(0)         "},

+                {-.00009d, "%#+0(1.6f",   "(0,000090)"},

+                {-.00009d, "%-+(8.4f",    "(0,0001)"},

+                {-.00009d, "% 0#(9.8f",   "(0,00009000)"},

+                

+                {-1234567890.012345678d, "%f",          "-1234567890,012346"},

+                {-1234567890.012345678d, "%#.3f",       "-1234567890,012"},

+                {-1234567890.012345678d, "%,5f",        "-1.234.567.890,012346"},

+                {-1234567890.012345678d, "%- (12.0f",   "(1234567890)"},

+                {-1234567890.012345678d, "%#+0(1.6f",   "(1234567890,012346)"},

+                {-1234567890.012345678d, "%-+(8.4f",    "(1234567890,0123)"},

+                {-1234567890.012345678d, "% 0#(9.8f",   "(1234567890,01234580)"},

+                

+                {Double.MAX_VALUE, "%f",          "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},

+                {Double.MAX_VALUE, "%#.3f",       "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000"},

+                {Double.MAX_VALUE, "%,5f",        "179.769.313.486.231.570.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,000000"},

+                {Double.MAX_VALUE, "%- (12.0f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},

+                {Double.MAX_VALUE, "%#+0(1.6f",   "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},

+                {Double.MAX_VALUE, "%-+(8.4f",    "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,0000"},

+                {Double.MAX_VALUE, "% 0#(9.8f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,00000000"},

+                

+                {Double.MIN_VALUE, "%f",          "0,000000"},

+                {Double.MIN_VALUE, "%#.3f",       "0,000"},

+                {Double.MIN_VALUE, "%,5f",        "0,000000"},

+                {Double.MIN_VALUE, "%- (12.0f",   " 0          "},

+                {Double.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},

+                {Double.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},

+                {Double.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},

+                

+                {Double.NaN, "%f",          "NaN"},

+                {Double.NaN, "%#.3f",       "NaN"},

+                {Double.NaN, "%,5f",        "  NaN"},

+                {Double.NaN, "%- (12.0f",   "NaN         "},

+                {Double.NaN, "%#+0(1.6f",   "NaN"},

+                {Double.NaN, "%-+(8.4f",    "NaN     "},

+                {Double.NaN, "% 0#(9.8f",   "      NaN"},

+                

+                {Double.POSITIVE_INFINITY, "%f",          "Infinity"},

+                {Double.POSITIVE_INFINITY, "%#.3f",       "Infinity"},

+                {Double.POSITIVE_INFINITY, "%,5f",        "Infinity"},

+                {Double.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},

+                {Double.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},

+                {Double.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},

+                {Double.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},

+                

+                {Double.NEGATIVE_INFINITY, "%f",          "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},

+                {Double.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},

+                {Double.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleF.length; i++) {

+                f = new Formatter(Locale.GERMAN);

+                f.format((String)tripleF[i][pattern], tripleF[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["

+                        + i + "]:" + tripleF[i][pattern],

+                        tripleF[i][output], f.toString());

+            }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for Float/Double

+     *        conversion type 'a' and 'A'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionA() {

+        Formatter f = null;

+        final Object[][] tripleA = {

+                {-0f, "%a",         "-0x0.0p0"},

+                {-0f, "%#.3a",      "-0x0.000p0"},

+                {-0f, "%5a",        "-0x0.0p0"},

+                {-0f, "%- 12.0a",   "-0x0.0p0    "},

+                {-0f, "%#+01.6a",   "-0x0.000000p0"},

+                {-0f, "%-+8.4a",    "-0x0.0000p0"},

+                

+                {0f, "%a",         "0x0.0p0"},

+                {0f, "%#.3a",      "0x0.000p0"},

+                {0f, "%5a",        "0x0.0p0"},

+                {0f, "%- 12.0a",   " 0x0.0p0    "},

+                {0f, "%#+01.6a",   "+0x0.000000p0"},

+                {0f, "%-+8.4a",    "+0x0.0000p0"},

+                

+                {1234f, "%a",         "0x1.348p10"},

+                {1234f, "%#.3a",      "0x1.348p10"},

+                {1234f, "%5a",        "0x1.348p10"},

+                {1234f, "%- 12.0a",   " 0x1.3p10   "},

+                {1234f, "%#+01.6a",   "+0x1.348000p10"},

+                {1234f, "%-+8.4a",    "+0x1.3480p10"},

+                

+                {1.f, "%a",         "0x1.0p0"},

+                {1.f, "%#.3a",      "0x1.000p0"},

+                {1.f, "%5a",        "0x1.0p0"},

+                {1.f, "%- 12.0a",   " 0x1.0p0    "},

+                {1.f, "%#+01.6a",   "+0x1.000000p0"},

+                {1.f, "%-+8.4a",    "+0x1.0000p0"},

+                

+                {-98f, "%a",         "-0x1.88p6"},

+                {-98f, "%#.3a",      "-0x1.880p6"},

+                {-98f, "%5a",        "-0x1.88p6"},

+                {-98f, "%- 12.0a",   "-0x1.8p6    "},

+                {-98f, "%#+01.6a",   "-0x1.880000p6"},

+                {-98f, "%-+8.4a",    "-0x1.8800p6"},

+                

+                {345.1234567f, "%a",         "0x1.591f9ap8"},

+                {345.1234567f, "%5a",        "0x1.591f9ap8"},

+                {345.1234567f, "%#+01.6a",   "+0x1.591f9ap8"},

+                

+                {-987654321.1234567f, "%a",         "-0x1.d6f346p29"},

+                {-987654321.1234567f, "%#.3a",      "-0x1.d6fp29"},

+                {-987654321.1234567f, "%5a",        "-0x1.d6f346p29"},

+                {-987654321.1234567f, "%- 12.0a",   "-0x1.dp29   "},

+                {-987654321.1234567f, "%#+01.6a",   "-0x1.d6f346p29"},

+                {-987654321.1234567f, "%-+8.4a",    "-0x1.d6f3p29"},

+                

+                {Float.MAX_VALUE, "%a",         "0x1.fffffep127"},

+                {Float.MAX_VALUE, "%5a",        "0x1.fffffep127"},

+                {Float.MAX_VALUE, "%#+01.6a",   "+0x1.fffffep127"},

+                

+                {Float.NaN, "%a",         "NaN"},

+                {Float.NaN, "%#.3a",      "NaN"},

+                {Float.NaN, "%5a",        "  NaN"},

+                {Float.NaN, "%- 12.0a",   "NaN         "},

+                {Float.NaN, "%#+01.6a",   "NaN"},

+                {Float.NaN, "%-+8.4a",    "NaN     "},

+                

+                {Float.NEGATIVE_INFINITY, "%a",         "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%5a",        "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},

+                {Float.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},

+                {Float.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},

+                

+                {Float.POSITIVE_INFINITY, "%a",         "Infinity"},

+                {Float.POSITIVE_INFINITY, "%#.3a",      "Infinity"},

+                {Float.POSITIVE_INFINITY, "%5a",        "Infinity"},

+                {Float.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},

+                {Float.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},

+                {Float.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},

+                

+                {-0d, "%a",         "-0x0.0p0"},

+                {-0d, "%#.3a",      "-0x0.000p0"},

+                {-0d, "%5a",        "-0x0.0p0"},

+                {-0d, "%- 12.0a",   "-0x0.0p0    "},

+                {-0d, "%#+01.6a",   "-0x0.000000p0"},

+                {-0d, "%-+8.4a",    "-0x0.0000p0"},

+

+                {0d, "%a",         "0x0.0p0"},

+                {0d, "%#.3a",      "0x0.000p0"},

+                {0d, "%5a",        "0x0.0p0"},

+                {0d, "%- 12.0a",   " 0x0.0p0    "},

+                {0d, "%#+01.6a",   "+0x0.000000p0"},

+                {0d, "%-+8.4a",    "+0x0.0000p0"},

+                

+                {1d, "%a",         "0x1.0p0"},

+                {1d, "%#.3a",      "0x1.000p0"},

+                {1d, "%5a",        "0x1.0p0"},

+                {1d, "%- 12.0a",   " 0x1.0p0    "},

+                {1d, "%#+01.6a",   "+0x1.000000p0"},

+                {1d, "%-+8.4a",    "+0x1.0000p0"},

+                

+                {-1d, "%a",         "-0x1.0p0"},

+                {-1d, "%#.3a",      "-0x1.000p0"},

+                {-1d, "%5a",        "-0x1.0p0"},

+                {-1d, "%- 12.0a",   "-0x1.0p0    "},

+                {-1d, "%#+01.6a",   "-0x1.000000p0"},

+                {-1d, "%-+8.4a",    "-0x1.0000p0"},

+                

+                {.00000001d, "%a",         "0x1.5798ee2308c3ap-27"},

+                {.00000001d, "%5a",        "0x1.5798ee2308c3ap-27"},

+                {.00000001d, "%- 12.0a",   " 0x1.5p-27  "},

+                {.00000001d, "%#+01.6a",   "+0x1.5798eep-27"},

+                

+                {1000.10d, "%a",         "0x1.f40cccccccccdp9"},

+                {1000.10d, "%5a",        "0x1.f40cccccccccdp9"},

+                {1000.10d, "%- 12.0a",   " 0x1.fp9    "},

+                

+                {0.1d, "%a",         "0x1.999999999999ap-4"},

+                {0.1d, "%5a",        "0x1.999999999999ap-4"},

+                

+                {-2.d, "%a",         "-0x1.0p1"},

+                {-2.d, "%#.3a",      "-0x1.000p1"},

+                {-2.d, "%5a",        "-0x1.0p1"},

+                {-2.d, "%- 12.0a",   "-0x1.0p1    "},

+                {-2.d, "%#+01.6a",   "-0x1.000000p1"},

+                {-2.d, "%-+8.4a",    "-0x1.0000p1"},

+                

+                {-.00009d, "%a",         "-0x1.797cc39ffd60fp-14"},

+                {-.00009d, "%5a",        "-0x1.797cc39ffd60fp-14"},

+                

+                {-1234567890.012345678d, "%a",         "-0x1.26580b480ca46p30"},

+                {-1234567890.012345678d, "%5a",        "-0x1.26580b480ca46p30"},

+                {-1234567890.012345678d, "%- 12.0a",   "-0x1.2p30   "},

+                {-1234567890.012345678d, "%#+01.6a",   "-0x1.26580bp30"},

+                {-1234567890.012345678d, "%-+8.4a",    "-0x1.2658p30"},

+                

+                {Double.MAX_VALUE, "%a",         "0x1.fffffffffffffp1023"},

+                {Double.MAX_VALUE, "%5a",        "0x1.fffffffffffffp1023"},

+                

+                {Double.MIN_VALUE, "%a",         "0x0.0000000000001p-1022"},

+                {Double.MIN_VALUE, "%5a",        "0x0.0000000000001p-1022"},

+                

+                {Double.NaN, "%a",         "NaN"},

+                {Double.NaN, "%#.3a",      "NaN"},

+                {Double.NaN, "%5a",        "  NaN"},

+                {Double.NaN, "%- 12.0a",   "NaN         "},

+                {Double.NaN, "%#+01.6a",   "NaN"},

+                {Double.NaN, "%-+8.4a",    "NaN     "},

+                

+                {Double.NEGATIVE_INFINITY, "%a",         "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%5a",        "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},

+                {Double.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},

+                {Double.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},

+                

+                {Double.POSITIVE_INFINITY, "%a",         "Infinity"},

+                {Double.POSITIVE_INFINITY, "%#.3a",      "Infinity"},

+                {Double.POSITIVE_INFINITY, "%5a",        "Infinity"},

+                {Double.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},

+                {Double.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},

+                {Double.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},

+                

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleA.length; i++) {

+                f = new Formatter(Locale.UK);

+                f.format((String)tripleA[i][pattern], tripleA[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["

+                        + i + "]:" + tripleA[i][pattern],

+                        tripleA[i][output], f.toString());

+

+                // test for conversion type 'A'

+                f = new Formatter(Locale.UK);

+                f.format(((String)tripleA[i][pattern]).toUpperCase(), tripleA[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["

+                        + i + "]:" + tripleA[i][pattern], ((String)tripleA[i][output])

+                        .toUpperCase(Locale.UK), f.toString());

+            }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigDecimal

+     *        conversion type 'e' and 'E'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionE() {

+        Formatter f = null;

+        final Object[][] tripleE = {

+                {BigDecimal.ZERO, "%e",         "0.000000e+00"},

+                {BigDecimal.ZERO, "%#.0e",      "0.e+00"},

+                {BigDecimal.ZERO, "%# 9.8e",    " 0.00000000e+00"},

+                {BigDecimal.ZERO, "%#+0(8.4e",  "+0.0000e+00"},

+                {BigDecimal.ZERO, "%-+17.6e",   "+0.000000e+00    "},

+                {BigDecimal.ZERO, "% 0(20e",    " 00000000.000000e+00"},

+                

+                {BigDecimal.ONE, "%e",         "1.000000e+00"},

+                {BigDecimal.ONE, "%#.0e",      "1.e+00"},

+                {BigDecimal.ONE, "%# 9.8e",    " 1.00000000e+00"},

+                {BigDecimal.ONE, "%#+0(8.4e",  "+1.0000e+00"},

+                {BigDecimal.ONE, "%-+17.6e",   "+1.000000e+00    "},

+                {BigDecimal.ONE, "% 0(20e",    " 00000001.000000e+00"},

+                

+                {BigDecimal.TEN, "%e",         "1.000000e+01"},

+                {BigDecimal.TEN, "%#.0e",      "1.e+01"},

+                {BigDecimal.TEN, "%# 9.8e",    " 1.00000000e+01"},

+                {BigDecimal.TEN, "%#+0(8.4e",  "+1.0000e+01"},

+                {BigDecimal.TEN, "%-+17.6e",   "+1.000000e+01    "},

+                {BigDecimal.TEN, "% 0(20e",    " 00000001.000000e+01"},

+                

+                {new BigDecimal(-1), "%e",         "-1.000000e+00"},

+                {new BigDecimal(-1), "%#.0e",      "-1.e+00"},

+                {new BigDecimal(-1), "%# 9.8e",    "-1.00000000e+00"},

+                {new BigDecimal(-1), "%#+0(8.4e",  "(1.0000e+00)"},

+                {new BigDecimal(-1), "%-+17.6e",   "-1.000000e+00    "},

+                {new BigDecimal(-1), "% 0(20e",    "(0000001.000000e+00)"},

+                

+                {new BigDecimal("5.000E999"), "%e",         "5.000000e+999"},

+                {new BigDecimal("5.000E999"), "%#.0e",      "5.e+999"},

+                {new BigDecimal("5.000E999"), "%# 9.8e",    " 5.00000000e+999"},

+                {new BigDecimal("5.000E999"), "%#+0(8.4e",  "+5.0000e+999"},

+                {new BigDecimal("5.000E999"), "%-+17.6e",   "+5.000000e+999   "},

+                {new BigDecimal("5.000E999"), "% 0(20e",    " 0000005.000000e+999"},

+                

+                {new BigDecimal("-5.000E999"), "%e",         "-5.000000e+999"},

+                {new BigDecimal("-5.000E999"), "%#.0e",      "-5.e+999"},

+                {new BigDecimal("-5.000E999"), "%# 9.8e",    "-5.00000000e+999"},

+                {new BigDecimal("-5.000E999"), "%#+0(8.4e",  "(5.0000e+999)"},

+                {new BigDecimal("-5.000E999"), "%-+17.6e",   "-5.000000e+999   "},

+                {new BigDecimal("-5.000E999"), "% 0(20e",    "(000005.000000e+999)"},

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleE.length; i++) {

+                f = new Formatter(Locale.US);

+                f.format((String)tripleE[i][pattern], tripleE[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["

+                        + i + "]:" + tripleE[i][pattern],

+                        tripleE[i][output], f.toString());

+

+                // test for conversion type 'E'

+                f = new Formatter(Locale.US);

+                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["

+                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])

+                        .toUpperCase(Locale.US), f.toString());

+            }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigDecimal

+     *        conversion type 'g' and 'G'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionG() {

+        Formatter f = null;

+        final Object[][] tripleG = {

+                {BigDecimal.ZERO, "%g",         "0.00000"},

+                {BigDecimal.ZERO, "%.5g",       "0.0000"},

+                {BigDecimal.ZERO, "%- (,9.8g",  " 0.0000000"},

+                {BigDecimal.ZERO, "%+0(,8.4g",  "+000.000"},

+                {BigDecimal.ZERO, "%-+10.6g",   "+0.00000  "},

+                {BigDecimal.ZERO, "% 0(,12.0g", " 00000000000"},

+                {BigDecimal.ONE, "%g",          "1.00000"},

+                {BigDecimal.ONE, "%.5g",        "1.0000"},

+                {BigDecimal.ONE, "%- (,9.8g",   " 1.0000000"},

+                {BigDecimal.ONE, "%+0(,8.4g",   "+001.000"},

+                {BigDecimal.ONE, "%-+10.6g",    "+1.00000  "},

+                {BigDecimal.ONE, "% 0(,12.0g",  " 00000000001"},

+                

+                {new BigDecimal(-1), "%g",          "-1.00000"},

+                {new BigDecimal(-1), "%.5g",        "-1.0000"},

+                {new BigDecimal(-1), "%- (,9.8g",   "(1.0000000)"},

+                {new BigDecimal(-1), "%+0(,8.4g",   "(01.000)"},

+                {new BigDecimal(-1), "%-+10.6g",    "-1.00000  "},

+                {new BigDecimal(-1), "% 0(,12.0g",  "(0000000001)"},

+                

+                {new BigDecimal(-0.000001), "%g",           "-1.00000e-06"},

+                {new BigDecimal(-0.000001), "%.5g",         "-1.0000e-06"},

+                {new BigDecimal(-0.000001), "%- (,9.8g",    "(1.0000000e-06)"},

+                {new BigDecimal(-0.000001), "%+0(,8.4g",    "(1.000e-06)"},

+                {new BigDecimal(-0.000001), "%-+10.6g",     "-1.00000e-06"},

+                {new BigDecimal(-0.000001), "% 0(,12.0g",   "(000001e-06)"},

+                

+                {new BigDecimal(0.0002), "%g",          "0.000200000"},

+                {new BigDecimal(0.0002), "%.5g",        "0.00020000"},

+                {new BigDecimal(0.0002), "%- (,9.8g",   " 0.00020000000"},

+                {new BigDecimal(0.0002), "%+0(,8.4g",   "+0.0002000"},

+                {new BigDecimal(0.0002), "%-+10.6g",    "+0.000200000"},

+                {new BigDecimal(0.0002), "% 0(,12.0g",  " 000000.0002"},

+                

+                {new BigDecimal(-0.003), "%g",          "-0.00300000"},

+                {new BigDecimal(-0.003), "%.5g",        "-0.0030000"},

+                {new BigDecimal(-0.003), "%- (,9.8g",   "(0.0030000000)"},

+                {new BigDecimal(-0.003), "%+0(,8.4g",   "(0.003000)"},

+                {new BigDecimal(-0.003), "%-+10.6g",    "-0.00300000"},

+                {new BigDecimal(-0.003), "% 0(,12.0g",  "(000000.003)"},

+                

+                {new BigDecimal("5.000E999"), "%g",             "5.00000e+999"},

+                {new BigDecimal("5.000E999"), "%.5g",           "5.0000e+999"},

+                {new BigDecimal("5.000E999"), "%- (,9.8g",      " 5.0000000e+999"},

+                {new BigDecimal("5.000E999"), "%+0(,8.4g",      "+5.000e+999"},

+                {new BigDecimal("5.000E999"), "%-+10.6g",       "+5.00000e+999"},

+                {new BigDecimal("5.000E999"), "% 0(,12.0g",     " 000005e+999"},

+                

+                {new BigDecimal("-5.000E999"), "%g",            "-5.00000e+999"},

+                {new BigDecimal("-5.000E999"), "%.5g",          "-5.0000e+999"},

+                {new BigDecimal("-5.000E999"), "%- (,9.8g",     "(5.0000000e+999)"},

+                {new BigDecimal("-5.000E999"), "%+0(,8.4g",     "(5.000e+999)"},

+                {new BigDecimal("-5.000E999"), "%-+10.6g",      "-5.00000e+999"},

+                {new BigDecimal("-5.000E999"), "% 0(,12.0g",    "(00005e+999)"},

+        };

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+            for (int i = 0; i < tripleG.length; i++) {

+                f = new Formatter(Locale.US);

+                f.format((String)tripleG[i][pattern], tripleG[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["

+                        + i + "]:" + tripleG[i][pattern],

+                        tripleG[i][output], f.toString());

+

+                // test for conversion type 'G'

+                f = new Formatter(Locale.US);

+                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);

+                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["

+                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])

+                        .toUpperCase(Locale.US), f.toString());

+            }

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%- (,9.6g", new BigDecimal("4E6"));

+        /*

+         * fail on RI, spec says 'g' requires the output to be formatted in

+         * general scientific notation and the localization algorithm is

+         * applied. But RI format this case to 4.00000e+06, which does not

+         * conform to the German Locale

+         */

+        assertEquals(" 4,00000e+06", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigDecimal

+     *        conversion type 'f'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionF() {

+

+        Formatter f = null;

+        final int input   = 0;

+        final int pattern = 1;

+        final int output  = 2;

+        final Object[][] tripleF = {

+                {BigDecimal.ZERO,                                               "%f",           "0.000000"},

+                {BigDecimal.ZERO,                                               "%#.3f",        "0.000"},

+                {BigDecimal.ZERO,                                               "%#,5f",        "0.000000"},

+                {BigDecimal.ZERO,                                               "%- #(12.0f",   " 0.         "},

+                {BigDecimal.ZERO,                                               "%#+0(1.6f",    "+0.000000"},

+                {BigDecimal.ZERO,                                               "%-+(8.4f",     "+0.0000 "},

+                {BigDecimal.ZERO,                                               "% 0#(9.8f",    " 0.00000000"},

+                {BigDecimal.ONE,                                                "%f",           "1.000000"},

+                {BigDecimal.ONE,                                                "%#.3f",        "1.000"},

+                {BigDecimal.ONE,                                                "%#,5f",        "1.000000"},

+                {BigDecimal.ONE,                                                "%- #(12.0f",   " 1.         "},

+                {BigDecimal.ONE,                                                "%#+0(1.6f",    "+1.000000"},

+                {BigDecimal.ONE,                                                "%-+(8.4f",     "+1.0000 "},

+                {BigDecimal.ONE,                                                "% 0#(9.8f",    " 1.00000000"},

+                {BigDecimal.TEN,                                                "%f",           "10.000000"},

+                {BigDecimal.TEN,                                                "%#.3f",        "10.000"},

+                {BigDecimal.TEN,                                                "%#,5f",        "10.000000"},

+                {BigDecimal.TEN,                                                "%- #(12.0f",   " 10.        "},

+                {BigDecimal.TEN,                                                "%#+0(1.6f",    "+10.000000"},

+                {BigDecimal.TEN,                                                "%-+(8.4f",     "+10.0000"},

+                {BigDecimal.TEN,                                                "% 0#(9.8f",    " 10.00000000"},

+                {new BigDecimal(-1),                                            "%f",           "-1.000000"},

+                {new BigDecimal(-1),                                            "%#.3f",        "-1.000"},

+                {new BigDecimal(-1),                                            "%#,5f",        "-1.000000"},

+                {new BigDecimal(-1),                                            "%- #(12.0f",   "(1.)        "},

+                {new BigDecimal(-1),                                            "%#+0(1.6f",    "(1.000000)"},

+                {new BigDecimal(-1),                                            "%-+(8.4f",     "(1.0000)"},

+                {new BigDecimal(-1),                                            "% 0#(9.8f",    "(1.00000000)"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%f",           "9999999999999999999999999999999999999999999.000000"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#.3f",        "9999999999999999999999999999999999999999999.000"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#,5f",        "9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%- #(12.0f",   " 9999999999999999999999999999999999999999999."},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#+0(1.6f",    "+9999999999999999999999999999999999999999999.000000"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "%-+(8.4f",     "+9999999999999999999999999999999999999999999.0000"},

+                {new BigDecimal("9999999999999999999999999999999999999999999"), "% 0#(9.8f",    " 9999999999999999999999999999999999999999999.00000000"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%f",          "-9999999999999999999999999999999999999999999.000000"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#.3f",       "-9999999999999999999999999999999999999999999.000"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#,5f",       "-9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%- #(12.0f",  "(9999999999999999999999999999999999999999999.)"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#+0(1.6f",   "(9999999999999999999999999999999999999999999.000000)"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%-+(8.4f",    "(9999999999999999999999999999999999999999999.0000)"},

+                {new BigDecimal("-9999999999999999999999999999999999999999999"), "% 0#(9.8f",   "(9999999999999999999999999999999999999999999.00000000)"},

+        }; 

+        for (int i = 0; i < tripleF.length; i++) {

+            f = new Formatter(Locale.US);

+            f.format((String)tripleF[i][pattern], tripleF[i][input]);

+            assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["

+                    + i + "]:" + tripleF[i][pattern], tripleF[i][output], f.toString());

+        }

+

+        f = new Formatter(Locale.US);

+        f.format("%f", new BigDecimal("5.0E9"));

+        // error on RI

+        // RI throw ArrayIndexOutOfBoundsException

+        assertEquals("5000000000.000000", f.toString());

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for exceptions in

+     *        Float/Double/BigDecimal conversion type 'e', 'E', 'g', 'G', 'f', 'a', 'A'

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalConversionException() {

+        Formatter f = null;

+

+        final char[] conversions = { 'e', 'E', 'g', 'G', 'f', 'a', 'A' };

+        final Object[] illArgs = { false, (byte) 1, (short) 2, 3, (long) 4,

+                new BigInteger("5"), new Character('c'), new Object(),

+                new Date() };

+        for (int i = 0; i < illArgs.length; i++) {

+            for (int j = 0; j < conversions.length; j++) {

+                try {

+                    f = new Formatter(Locale.UK);

+                    f.format("%" + conversions[j], illArgs[i]);

+                    fail("should throw IllegalFormatConversionException");

+                } catch (IllegalFormatConversionException e) {

+                    // expected

+                }

+            }

+        }

+

+        try {

+            f = new Formatter(Locale.UK);

+            f.format("%a", new BigDecimal(1));

+            fail("should throw IllegalFormatConversionException");

+        } catch (IllegalFormatConversionException e) {

+            // expected

+        }

+

+        try {

+            f = new Formatter(Locale.UK);

+            f.format("%A", new BigDecimal(1));

+            fail("should throw IllegalFormatConversionException");

+        } catch (IllegalFormatConversionException e) {

+            // expected

+        }

+

+        final String[] flagsConversionMismatches = { "%,e", "%,E", "%#g",

+                "%#G", "%,a", "%,A", "%(a", "%(A" };

+        for (int i = 0; i < flagsConversionMismatches.length; i++) {

+            try {

+                f = new Formatter(Locale.CHINA);

+                f.format(flagsConversionMismatches[i], new BigDecimal(1));

+                fail("should throw FormatFlagsConversionMismatchException");

+            } catch (FormatFlagsConversionMismatchException e) {

+                // expected

+            }

+            try {

+                f = new Formatter(Locale.JAPAN);

+                f.format(flagsConversionMismatches[i], (BigDecimal) null);

+                fail("should throw FormatFlagsConversionMismatchException");

+            } catch (FormatFlagsConversionMismatchException e) {

+                // expected

+            }

+        }

+

+        final String[] missingFormatWidths = { "%-0e", "%0e", "%-e", "%-0E",

+                "%0E", "%-E", "%-0g", "%0g", "%-g", "%-0G", "%0G", "%-G",

+                "%-0f", "%0f", "%-f", "%-0a", "%0a", "%-a", "%-0A", "%0A",

+                "%-A" };

+        for (int i = 0; i < missingFormatWidths.length; i++) {

+            try {

+                f = new Formatter(Locale.KOREA);

+                f.format(missingFormatWidths[i], 1f);

+                fail("should throw MissingFormatWidthException");

+            } catch (MissingFormatWidthException e) {

+                // expected

+            }

+

+            try {

+                f = new Formatter(Locale.KOREA);

+                f.format(missingFormatWidths[i], (Float) null);

+                fail("should throw MissingFormatWidthException");

+            } catch (MissingFormatWidthException e) {

+                // expected

+            }

+        }

+

+        final String[] illFlags = { "%+ e", "%+ E", "%+ g", "%+ G", "%+ f",

+                "%+ a", "%+ A", "%-03e", "%-03E", "%-03g", "%-03G", "%-03f",

+                "%-03a", "%-03A" };

+        for (int i = 0; i < illFlags.length; i++) {

+            try {

+                f = new Formatter(Locale.CANADA);

+                f.format(illFlags[i], 1.23d);

+                fail("should throw IllegalFormatFlagsException");

+            } catch (IllegalFormatFlagsException e) {

+                // expected

+            }

+

+            try {

+                f = new Formatter(Locale.CANADA);

+                f.format(illFlags[i], (Double) null);

+                fail("should throw IllegalFormatFlagsException");

+            } catch (IllegalFormatFlagsException e) {

+                // expected

+            }

+        }

+

+        f = new Formatter(Locale.US);

+        try {

+            f.format("%F", 1);

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for

+     *        Float/Double/BigDecimal exception throwing order

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalExceptionOrder() {

+        Formatter f = null;

+

+        /*

+         * Summary: UnknownFormatConversionException >

+         * MissingFormatWidthException > IllegalFormatFlagsException >

+         * FormatFlagsConversionMismatchException >

+         * IllegalFormatConversionException

+         * 

+         */

+        try {

+            // compare FormatFlagsConversionMismatchException and

+            // IllegalFormatConversionException

+            f = new Formatter(Locale.US);

+            f.format("%,e", (byte) 1);

+            fail("should throw FormatFlagsConversionMismatchException");

+        } catch (FormatFlagsConversionMismatchException e) {

+            // expected

+        }

+

+        try {

+            // compare IllegalFormatFlagsException and

+            // FormatFlagsConversionMismatchException

+            f = new Formatter(Locale.US);

+            f.format("%+ ,e", 1f);

+            fail("should throw IllegalFormatFlagsException");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+

+        try {

+            // compare MissingFormatWidthException and

+            // IllegalFormatFlagsException

+            f = new Formatter(Locale.US);

+            f.format("%+ -e", 1f);

+            fail("should throw MissingFormatWidthException");

+        } catch (MissingFormatWidthException e) {

+            // expected

+        }

+

+        try {

+            // compare UnknownFormatConversionException and

+            // MissingFormatWidthException

+            f = new Formatter(Locale.US);

+            f.format("%-F", 1f);

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for BigDecimal

+     *        exception throwing order

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalExceptionOrder() {

+        Formatter f = null;

+        BigDecimal bd = new BigDecimal("1.0");

+

+        /*

+         * Summary: UnknownFormatConversionException >

+         * MissingFormatWidthException > IllegalFormatFlagsException >

+         * FormatFlagsConversionMismatchException >

+         * IllegalFormatConversionException

+         * 

+         */

+        try {

+            // compare FormatFlagsConversionMismatchException and

+            // IllegalFormatConversionException

+            f = new Formatter(Locale.US);

+            f.format("%,e", (byte) 1);

+            fail("should throw FormatFlagsConversionMismatchException");

+        } catch (FormatFlagsConversionMismatchException e) {

+            // expected

+        }

+

+        try {

+            // compare IllegalFormatFlagsException and

+            // FormatFlagsConversionMismatchException

+            f = new Formatter(Locale.US);

+            f.format("%+ ,e", bd);

+            fail("should throw IllegalFormatFlagsException");

+        } catch (IllegalFormatFlagsException e) {

+            // expected

+        }

+

+        try {

+            // compare MissingFormatWidthException and

+            // IllegalFormatFlagsException

+            f = new Formatter(Locale.US);

+            f.format("%+ -e", bd);

+            fail("should throw MissingFormatWidthException");

+        } catch (MissingFormatWidthException e) {

+            // expected

+        }

+

+        // compare UnknownFormatConversionException and

+        // MissingFormatWidthException

+        try {

+            f = new Formatter(Locale.US);

+            f.format("%-F", bd);

+            fail("should throw UnknownFormatConversionException");

+        } catch (UnknownFormatConversionException e) {

+            // expected

+        }

+    }

+

+    /**

+     * @tests java.util.Formatter#format(String, Object...) for null argment for

+     *        Float/Double/BigDecimal conversion

+     */

+    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalNullConversion() {

+        Formatter f = null;

+

+        // test (Float)null

+        f = new Formatter(Locale.FRANCE);

+        f.format("%#- (9.0e", (Float) null);

+        assertEquals("         ", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%-+(1.6E", (Float) null);

+        assertEquals("NULL", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%+0(,8.4g", (Float) null);

+        assertEquals("    null", f.toString());

+

+        f = new Formatter(Locale.FRANCE);

+        f.format("%- (9.8G", (Float) null);

+        assertEquals("NULL     ", f.toString());

+

+        f = new Formatter(Locale.FRANCE);

+        f.format("%- (12.1f", (Float) null);

+        assertEquals("n           ", f.toString());

+

+        f = new Formatter(Locale.FRANCE);

+        f.format("% .4a", (Float) null);

+        assertEquals("null", f.toString());

+

+        f = new Formatter(Locale.FRANCE);

+        f.format("%06A", (Float) null);

+        assertEquals("  NULL", f.toString());

+

+        // test (Double)null

+        f = new Formatter(Locale.GERMAN);

+        f.format("%- (9e", (Double) null);

+        assertEquals("null     ", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%#-+(1.6E", (Double) null);

+        assertEquals("NULL", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%+0(6.4g", (Double) null);

+        assertEquals("  null", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%- (,5.8G", (Double) null);

+        assertEquals("NULL ", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("% (.4f", (Double) null);

+        assertEquals("null", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("%#.6a", (Double) null);

+        assertEquals("null", f.toString());

+

+        f = new Formatter(Locale.GERMAN);

+        f.format("% 2.5A", (Double) null);

+        assertEquals("NULL", f.toString());

+

+        // test (BigDecimal)null

+        f = new Formatter(Locale.UK);

+        f.format("%#- (6.2e", (BigDecimal) null);

+        assertEquals("nu    ", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%-+(1.6E", (BigDecimal) null);

+        assertEquals("NULL", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%+-(,5.3g", (BigDecimal) null);

+        assertEquals("nul  ", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%0 3G", (BigDecimal) null);

+        assertEquals("NULL", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%0 (9.0G", (BigDecimal) null);

+        assertEquals("         ", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("% (.5f", (BigDecimal) null);

+        assertEquals("null", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("%06a", (BigDecimal) null);

+        assertEquals("  null", f.toString());

+

+        f = new Formatter(Locale.UK);

+        f.format("% .5A", (BigDecimal) null);

+        assertEquals("NULL", f.toString());

+    }

+    

+    /**

+     * @tests java.util.Formatter.BigDecimalLayoutForm#values()

+     */

+    public void test_values() {

+        BigDecimalLayoutForm[] vals = BigDecimalLayoutForm.values();

+        assertEquals("Invalid length of enum values", 2, vals.length);

+        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, vals[0]);

+        assertEquals("Wrong dec float value in enum", BigDecimalLayoutForm.DECIMAL_FLOAT, vals[1]);

+    }

+    

+    /**

+     * @tests java.util.Formatter.BigDecimalLayoutForm#valueOf(String)

+     */

+    public void test_valueOfLjava_lang_String() {

+        BigDecimalLayoutForm sci = BigDecimalLayoutForm.valueOf("SCIENTIFIC");

+        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, sci);

+

+        BigDecimalLayoutForm decFloat = BigDecimalLayoutForm.valueOf("DECIMAL_FLOAT");

+        assertEquals("Wrong dec float value from valueOf ", BigDecimalLayoutForm.DECIMAL_FLOAT, decFloat);

+    }

+    

+    /*

+     * Regression test for Harmony-5845

+     * test the short name for timezone whether uses DaylightTime or not

+     */

+    public void test_DaylightTime() {

+        Calendar c1 = new GregorianCalendar(2007, 0, 1);

+        Calendar c2 = new GregorianCalendar(2007, 7, 1);

+

+        for (String tz : TimeZone.getAvailableIDs()) {

+            if (tz.equals("America/Los_Angeles")) {

+                c1.setTimeZone(TimeZone.getTimeZone(tz));

+                c2.setTimeZone(TimeZone.getTimeZone(tz));

+                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("PSTPDT"));

+            }

+            if (tz.equals("America/Panama")) {

+                c1.setTimeZone(TimeZone.getTimeZone(tz));

+                c2.setTimeZone(TimeZone.getTimeZone(tz));

+                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("ESTEST"));

+            }

+        }

+    }

+    

+    /*

+     * Regression test for Harmony-5845

+     * test scientific notation to follow RI's behavior

+     */

+    public void test_ScientificNotation() {

+        Formatter f = new Formatter();

+        MathContext mc = new MathContext(30);

+        BigDecimal value = new BigDecimal(0.1, mc);

+        f.format("%.30G", value);

+

+        String result = f.toString();

+        String expected = "0.100000000000000005551115123126";

+        assertEquals(expected, result);

+    }

+

+    

+    /**

+     * Setup resource files for testing

+     */

+    protected void setUp() throws IOException {

+        root = System.getProperty("user.name").equalsIgnoreCase("root");

+        notExist = File.createTempFile("notexist", null);

+        notExist.delete();

+

+        fileWithContent = File.createTempFile("filewithcontent", null);

+        BufferedOutputStream bw = new BufferedOutputStream(

+                new FileOutputStream(fileWithContent));

+        bw.write(1);// write something into the file

+        bw.close();

+

+        readOnly = File.createTempFile("readonly", null);

+        readOnly.setReadOnly();

+

+        secret = File.createTempFile("secret", null);

+        

+        defaultTimeZone = TimeZone.getDefault();

+        TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai");

+        TimeZone.setDefault(cst);

+    }

+

+    /**

+     * Delete the resource files if they exist

+     */

+    protected void tearDown() {

+        if (notExist.exists()) {

+            notExist.delete();

+        }

+

+        if (fileWithContent.exists()) {

+            fileWithContent.delete();

+        }

+        if (readOnly.exists()) {

+            readOnly.delete();

+        }

+        if (secret.exists()) {

+            secret.delete();

+        }

+        

+        TimeZone.setDefault(defaultTimeZone);

+    }

+}

diff --git a/classlib/modules/math/build.xml b/classlib/modules/math/build.xml
index 484303d..1523296 100644
--- a/classlib/modules/math/build.xml
+++ b/classlib/modules/math/build.xml
@@ -19,10 +19,10 @@
 <project name="MATH Build" default="build" basedir=".">
     <description>Build for MATH component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="math" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/math/make/run-test.xml b/classlib/modules/math/make/run-test.xml
index e7ae974..dfc4444 100644
--- a/classlib/modules/math/make/run-test.xml
+++ b/classlib/modules/math/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="math" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/misc/build.xml b/classlib/modules/misc/build.xml
index 1b39990..5f28fd8 100644
--- a/classlib/modules/misc/build.xml
+++ b/classlib/modules/misc/build.xml
@@ -19,10 +19,10 @@
 <project name="MISC Build" default="build" basedir=".">
     <description>Build for MISC component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="misc" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -61,7 +61,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -103,7 +103,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/misc/make/run-test.xml b/classlib/modules/misc/make/run-test.xml
index d700dab..91c5922 100644
--- a/classlib/modules/misc/make/run-test.xml
+++ b/classlib/modules/misc/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="misc" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/misc/src/main/native/accessors/unix/makefile b/classlib/modules/misc/src/main/native/accessors/unix/makefile
index 2764060..9974cd4 100644
--- a/classlib/modules/misc/src/main/native/accessors/unix/makefile
+++ b/classlib/modules/misc/src/main/native/accessors/unix/makefile
@@ -13,18 +13,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/misc/native/accessors/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -I$(SHARED)common
 
 BUILDFILES = \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_ArrayAccessorImpl.o \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_Malloc.o \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.o \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_ObjectAccessorImpl.o \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_StringAccessorImpl.o
+  org_apache_harmony_misc_accessors_ArrayAccessorImpl.o \
+  org_apache_harmony_misc_accessors_Malloc.o \
+  org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.o \
+  org_apache_harmony_misc_accessors_ObjectAccessorImpl.o \
+  org_apache_harmony_misc_accessors_StringAccessorImpl.o
 
 DLLNAME=$(DLLPATH)libaccessors$(HY_SHLIB_SUFFIX)
 EXPNAME=HYMISC_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/misc/src/main/native/accessors/windows/makefile b/classlib/modules/misc/src/main/native/accessors/windows/makefile
index 10009dd..85b0aca 100644
--- a/classlib/modules/misc/src/main/native/accessors/windows/makefile
+++ b/classlib/modules/misc/src/main/native/accessors/windows/makefile
@@ -13,7 +13,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\misc\native\accessors\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=accessors
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -21,11 +22,11 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_ArrayAccessorImpl.obj \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_Malloc.obj \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.obj \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_ObjectAccessorImpl.obj \
-  $(SHAREDSUB)org_apache_harmony_misc_accessors_StringAccessorImpl.obj
+  $(HY_BIN)org_apache_harmony_misc_accessors_ArrayAccessorImpl.obj \
+  $(HY_BIN)org_apache_harmony_misc_accessors_Malloc.obj \
+  $(HY_BIN)org_apache_harmony_misc_accessors_MemoryAccessorNativeImpl.obj \
+  $(HY_BIN)org_apache_harmony_misc_accessors_ObjectAccessorImpl.obj \
+  $(HY_BIN)org_apache_harmony_misc_accessors_StringAccessorImpl.obj
 VIRTFILES = accessors.res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
 
diff --git a/classlib/modules/nio/build.xml b/classlib/modules/nio/build.xml
index 380eef0..6e1b31f 100644
--- a/classlib/modules/nio/build.xml
+++ b/classlib/modules/nio/build.xml
@@ -19,10 +19,10 @@
 <project name="NIO Build" default="build" basedir=".">
     <description>Build for NIO component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="nio" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -108,7 +108,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/nio/make/run-test.xml b/classlib/modules/nio/make/run-test.xml
index 765b9f7..c583bc8 100644
--- a/classlib/modules/nio/make/run-test.xml
+++ b/classlib/modules/nio/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="nio" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/nio/src/main/native/nio/unix/makefile b/classlib/modules/nio/src/main/native/nio/unix/makefile
index 4ab9767..b7e1f5a 100644
--- a/classlib/modules/nio/src/main/native/nio/unix/makefile
+++ b/classlib/modules/nio/src/main/native/nio/unix/makefile
@@ -17,10 +17,10 @@
 # Makefile for module 'nio'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/nio/native/nio/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = \
-	../shared/DirectBufferUtil.o ../shared/AddressUtil.o
+BUILDFILES = DirectBufferUtil.o AddressUtil.o
 ifeq ($(HY_OS),linux)
 BUILDFILES += EpollSelectorImpl.o
 endif
@@ -30,4 +30,4 @@
 DLLNAME = $(DLLPATH)libhynio$(HY_SHLIB_SUFFIX)
 EXPNAME = HYNIO_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/nio/src/main/native/nio/windows/makefile b/classlib/modules/nio/src/main/native/nio/windows/makefile
index 1df2836..90da957 100644
--- a/classlib/modules/nio/src/main/native/nio/windows/makefile
+++ b/classlib/modules/nio/src/main/native/nio/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'nio'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\nio\native\nio\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hynio
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -25,8 +26,7 @@
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(SHARED)common /I$(SHARED)fdlibm
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
-BUILDFILES = \
-  $(SHAREDSUB)DirectBufferUtil.obj $(SHAREDSUB)AddressUtil.obj
+BUILDFILES = $(HY_BIN)DirectBufferUtil.obj $(HY_BIN)AddressUtil.obj
 VIRTFILES = hynio.res
 
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/nio_char/build.xml b/classlib/modules/nio_char/build.xml
index 0623934..9cd17c0 100644
--- a/classlib/modules/nio_char/build.xml
+++ b/classlib/modules/nio_char/build.xml
@@ -19,10 +19,10 @@
 <project name="NIO_CHAR Build" default="build" basedir=".">
     <description>Build for NIO_CHAR component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="nio_char" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -67,7 +67,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -113,7 +113,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/nio_char/make/run-test.xml b/classlib/modules/nio_char/make/run-test.xml
index 9a28feb..fedda11 100644
--- a/classlib/modules/nio_char/make/run-test.xml
+++ b/classlib/modules/nio_char/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="nio_char" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/nio_char/src/main/native/niochar/unix/makefile b/classlib/modules/nio_char/src/main/native/niochar/unix/makefile
index da28d4f..19a051b 100644
--- a/classlib/modules/nio_char/src/main/native/niochar/unix/makefile
+++ b/classlib/modules/nio_char/src/main/native/niochar/unix/makefile
@@ -17,104 +17,32 @@
 # Makefile for module 'nio_char'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/nio_char/native/nio_char/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 # TODO: Fix the warnings see HARMONY-4959 and
 # http://www.mail-archive.com/dev@harmony.apache.org/msg10469.html 
 WARNFLAGS :=
 
-BUILDFILES = \
-  ../shared/CP_1250.o \
-  ../shared/CP_1251.o \
-  ../shared/CP_1252.o \
-  ../shared/CP_1253.o \
-  ../shared/CP_1254.o \
-  ../shared/CP_1257.o \
-  ../shared/ISO_8859_1.o \
-  ../shared/ISO_8859_2.o \
-  ../shared/ISO_8859_4.o \
-  ../shared/ISO_8859_5.o \
-  ../shared/ISO_8859_7.o \
-  ../shared/ISO_8859_9.o \
-  ../shared/ISO_8859_13.o \
-  ../shared/ISO_8859_15.o \
-  ../shared/KOI8_R.o \
-  ../shared/US_ASCII.o \
-  ../shared/IBM866.o \
-  ../shared/additional/IBM00858.o \
-  ../shared/additional/IBM01140.o \
-  ../shared/additional/IBM01141.o \
-  ../shared/additional/IBM01142.o \
-  ../shared/additional/IBM01143.o \
-  ../shared/additional/IBM01144.o \
-  ../shared/additional/IBM01145.o \
-  ../shared/additional/IBM01146.o \
-  ../shared/additional/IBM01147.o \
-  ../shared/additional/IBM01148.o \
-  ../shared/additional/IBM01149.o \
-  ../shared/additional/IBM037.o \
-  ../shared/additional/IBM1026.o \
-  ../shared/additional/IBM1047.o \
-  ../shared/additional/IBM273.o \
-  ../shared/additional/IBM277.o \
-  ../shared/additional/IBM278.o \
-  ../shared/additional/IBM280.o \
-  ../shared/additional/IBM284.o \
-  ../shared/additional/IBM285.o \
-  ../shared/additional/IBM297.o \
-  ../shared/additional/IBM420.o \
-  ../shared/additional/IBM424.o \
-  ../shared/additional/IBM437.o \
-  ../shared/additional/IBM500.o \
-  ../shared/additional/IBM775.o \
-  ../shared/additional/IBM850.o \
-  ../shared/additional/IBM852.o \
-  ../shared/additional/IBM855.o \
-  ../shared/additional/IBM857.o \
-  ../shared/additional/IBM860.o \
-  ../shared/additional/IBM861.o \
-  ../shared/additional/IBM862.o \
-  ../shared/additional/IBM863.o \
-  ../shared/additional/IBM864.o \
-  ../shared/additional/IBM865.o \
-  ../shared/additional/IBM868.o \
-  ../shared/additional/IBM869.o \
-  ../shared/additional/IBM870.o \
-  ../shared/additional/IBM871.o \
-  ../shared/additional/IBM918.o \
-  ../shared/additional/IBM_Thai.o \
-  ../shared/additional/ISO_8859_3.o \
-  ../shared/additional/ISO_8859_6.o \
-  ../shared/additional/ISO_8859_8.o \
-  ../shared/additional/windows_1255.o \
-  ../shared/additional/windows_1256.o \
-  ../shared/additional/x_IBM1006.o \
-  ../shared/additional/x_IBM1025.o \
-  ../shared/additional/x_IBM1097.o \
-  ../shared/additional/x_IBM1098.o \
-  ../shared/additional/x_IBM1112.o \
-  ../shared/additional/x_IBM1122.o \
-  ../shared/additional/x_IBM1123.o \
-  ../shared/additional/x_IBM1124.o \
-  ../shared/additional/x_IBM737.o \
-  ../shared/additional/x_IBM856.o \
-  ../shared/additional/x_IBM874.o \
-  ../shared/additional/x_IBM875.o \
-  ../shared/additional/x_IBM922.o \
-  ../shared/additional/x_MacCyrillic.o \
-  ../shared/additional/x_MacGreek.o \
-  ../shared/additional/x_MacTurkish.o \
-  ../shared/additional/Big5.o \
-  ../shared/additional/Big5_HKSCS.o \
-  ../shared/additional/EUC_KR.o \
-  ../shared/additional/GB2312.o \
-  ../shared/additional/GBK.o \
-  ../shared/additional/GB18030.o \
-  ../shared/additional/windows_31j.o \
-  ../shared/additional/x_MS950_HKSCS.o \
-  ../shared/additional/x_windows_949.o 
+BUILDFILES = CP_1250.o CP_1251.o CP_1252.o CP_1253.o CP_1254.o CP_1257.o \
+  ISO_8859_1.o ISO_8859_2.o ISO_8859_4.o ISO_8859_5.o ISO_8859_7.o \
+  ISO_8859_9.o ISO_8859_13.o ISO_8859_15.o KOI8_R.o US_ASCII.o IBM866.o
+
+#additional
+BUILDFILES += IBM00858.o IBM01140.o IBM01141.o IBM01142.o IBM01143.o \
+  IBM01144.o IBM01145.o IBM01146.o IBM01147.o IBM01148.o IBM01149.o \
+  IBM037.o IBM1026.o IBM1047.o IBM273.o IBM277.o IBM278.o IBM280.o \
+  IBM284.o IBM285.o IBM297.o IBM420.o IBM424.o IBM437.o IBM500.o IBM775.o \
+  IBM850.o IBM852.o IBM855.o IBM857.o IBM860.o IBM861.o IBM862.o IBM863.o \
+  IBM864.o IBM865.o IBM868.o IBM869.o IBM870.o IBM871.o IBM918.o IBM_Thai.o \
+  ISO_8859_3.o ISO_8859_6.o ISO_8859_8.o windows_1255.o windows_1256.o \
+  x_IBM1006.o x_IBM1025.o x_IBM1097.o x_IBM1098.o x_IBM1112.o x_IBM1122.o \
+  x_IBM1123.o x_IBM1124.o x_IBM737.o x_IBM856.o x_IBM874.o x_IBM875.o \
+  x_IBM922.o x_MacCyrillic.o x_MacGreek.o x_MacTurkish.o Big5.o Big5_HKSCS.o \
+  EUC_KR.o GB2312.o GBK.o GB18030.o windows_31j.o x_MS950_HKSCS.o \
+  x_windows_949.o
 
 DLLNAME = $(DLLPATH)libhyniochar$(HY_SHLIB_SUFFIX)
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/nio_char/src/main/native/niochar/windows/makefile b/classlib/modules/nio_char/src/main/native/niochar/windows/makefile
index 2ddddbd..d67656b 100644
--- a/classlib/modules/nio_char/src/main/native/niochar/windows/makefile
+++ b/classlib/modules/nio_char/src/main/native/niochar/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'nio_char'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\nio_char\native\niochar\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyniochar
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -27,100 +28,100 @@
 ADDITIONAL = $(SHAREDSUB)\additional\#
 
 BUILDFILES = \
-  $(SHAREDSUB)CP_1250.obj \
-  $(SHAREDSUB)CP_1251.obj \
-  $(SHAREDSUB)CP_1252.obj \
-  $(SHAREDSUB)CP_1253.obj \
-  $(SHAREDSUB)CP_1254.obj \
-  $(SHAREDSUB)CP_1257.obj \
-  $(SHAREDSUB)ISO_8859_1.obj \
-  $(SHAREDSUB)ISO_8859_2.obj \
-  $(SHAREDSUB)ISO_8859_4.obj \
-  $(SHAREDSUB)ISO_8859_5.obj \
-  $(SHAREDSUB)ISO_8859_7.obj \
-  $(SHAREDSUB)ISO_8859_9.obj \
-  $(SHAREDSUB)ISO_8859_13.obj \
-  $(SHAREDSUB)ISO_8859_15.obj \
-  $(SHAREDSUB)KOI8_R.obj \
-  $(SHAREDSUB)US_ASCII.obj \
-  $(SHAREDSUB)IBM866.obj \
-  $(ADDITIONAL)IBM00858.obj \
-  $(ADDITIONAL)IBM01140.obj \
-  $(ADDITIONAL)IBM01141.obj \
-  $(ADDITIONAL)IBM01142.obj \
-  $(ADDITIONAL)IBM01143.obj \
-  $(ADDITIONAL)IBM01144.obj \
-  $(ADDITIONAL)IBM01145.obj \
-  $(ADDITIONAL)IBM01146.obj \
-  $(ADDITIONAL)IBM01147.obj \
-  $(ADDITIONAL)IBM01148.obj \
-  $(ADDITIONAL)IBM01149.obj \
-  $(ADDITIONAL)IBM037.obj \
-  $(ADDITIONAL)IBM1026.obj \
-  $(ADDITIONAL)IBM1047.obj \
-  $(ADDITIONAL)IBM273.obj \
-  $(ADDITIONAL)IBM277.obj \
-  $(ADDITIONAL)IBM278.obj \
-  $(ADDITIONAL)IBM280.obj \
-  $(ADDITIONAL)IBM284.obj \
-  $(ADDITIONAL)IBM285.obj \
-  $(ADDITIONAL)IBM297.obj \
-  $(ADDITIONAL)IBM420.obj \
-  $(ADDITIONAL)IBM424.obj \
-  $(ADDITIONAL)IBM437.obj \
-  $(ADDITIONAL)IBM500.obj \
-  $(ADDITIONAL)IBM775.obj \
-  $(ADDITIONAL)IBM850.obj \
-  $(ADDITIONAL)IBM852.obj \
-  $(ADDITIONAL)IBM855.obj \
-  $(ADDITIONAL)IBM857.obj \
-  $(ADDITIONAL)IBM860.obj \
-  $(ADDITIONAL)IBM861.obj \
-  $(ADDITIONAL)IBM862.obj \
-  $(ADDITIONAL)IBM863.obj \
-  $(ADDITIONAL)IBM864.obj \
-  $(ADDITIONAL)IBM865.obj \
-  $(ADDITIONAL)IBM868.obj \
-  $(ADDITIONAL)IBM869.obj \
-  $(ADDITIONAL)IBM870.obj \
-  $(ADDITIONAL)IBM871.obj \
-  $(ADDITIONAL)IBM918.obj \
-  $(ADDITIONAL)IBM_Thai.obj \
-  $(ADDITIONAL)ISO_8859_3.obj \
-  $(ADDITIONAL)ISO_8859_6.obj \
-  $(ADDITIONAL)ISO_8859_8.obj \
-  $(ADDITIONAL)windows_1255.obj \
-  $(ADDITIONAL)windows_1256.obj \
-  $(ADDITIONAL)x_IBM1006.obj \
-  $(ADDITIONAL)x_IBM1025.obj \
-  $(ADDITIONAL)x_IBM1097.obj \
-  $(ADDITIONAL)x_IBM1098.obj \
-  $(ADDITIONAL)x_IBM1112.obj \
-  $(ADDITIONAL)x_IBM1122.obj \
-  $(ADDITIONAL)x_IBM1123.obj \
-  $(ADDITIONAL)x_IBM1124.obj \
-  $(ADDITIONAL)x_IBM737.obj \
-  $(ADDITIONAL)x_IBM856.obj \
-  $(ADDITIONAL)x_IBM874.obj \
-  $(ADDITIONAL)x_IBM875.obj \
-  $(ADDITIONAL)x_IBM922.obj \
-  $(ADDITIONAL)x_MacCyrillic.obj \
-  $(ADDITIONAL)x_MacGreek.obj \
-  $(ADDITIONAL)x_MacTurkish.obj \
-  $(ADDITIONAL)Big5.obj \
-  $(ADDITIONAL)Big5_HKSCS.obj \
-  $(ADDITIONAL)EUC_KR.obj \
-  $(ADDITIONAL)GB2312.obj \
-  $(ADDITIONAL)GBK.obj \
-  $(ADDITIONAL)GB18030.obj \
-  $(ADDITIONAL)windows_31j.obj \
-  $(ADDITIONAL)x_MS950_HKSCS.obj \
-  $(ADDITIONAL)x_windows_949.obj 
+  $(HY_BIN)CP_1250.obj \
+  $(HY_BIN)CP_1251.obj \
+  $(HY_BIN)CP_1252.obj \
+  $(HY_BIN)CP_1253.obj \
+  $(HY_BIN)CP_1254.obj \
+  $(HY_BIN)CP_1257.obj \
+  $(HY_BIN)ISO_8859_1.obj \
+  $(HY_BIN)ISO_8859_2.obj \
+  $(HY_BIN)ISO_8859_4.obj \
+  $(HY_BIN)ISO_8859_5.obj \
+  $(HY_BIN)ISO_8859_7.obj \
+  $(HY_BIN)ISO_8859_9.obj \
+  $(HY_BIN)ISO_8859_13.obj \
+  $(HY_BIN)ISO_8859_15.obj \
+  $(HY_BIN)KOI8_R.obj \
+  $(HY_BIN)US_ASCII.obj \
+  $(HY_BIN)IBM866.obj \
+  $(HY_BIN)IBM00858.obj \
+  $(HY_BIN)IBM01140.obj \
+  $(HY_BIN)IBM01141.obj \
+  $(HY_BIN)IBM01142.obj \
+  $(HY_BIN)IBM01143.obj \
+  $(HY_BIN)IBM01144.obj \
+  $(HY_BIN)IBM01145.obj \
+  $(HY_BIN)IBM01146.obj \
+  $(HY_BIN)IBM01147.obj \
+  $(HY_BIN)IBM01148.obj \
+  $(HY_BIN)IBM01149.obj \
+  $(HY_BIN)IBM037.obj \
+  $(HY_BIN)IBM1026.obj \
+  $(HY_BIN)IBM1047.obj \
+  $(HY_BIN)IBM273.obj \
+  $(HY_BIN)IBM277.obj \
+  $(HY_BIN)IBM278.obj \
+  $(HY_BIN)IBM280.obj \
+  $(HY_BIN)IBM284.obj \
+  $(HY_BIN)IBM285.obj \
+  $(HY_BIN)IBM297.obj \
+  $(HY_BIN)IBM420.obj \
+  $(HY_BIN)IBM424.obj \
+  $(HY_BIN)IBM437.obj \
+  $(HY_BIN)IBM500.obj \
+  $(HY_BIN)IBM775.obj \
+  $(HY_BIN)IBM850.obj \
+  $(HY_BIN)IBM852.obj \
+  $(HY_BIN)IBM855.obj \
+  $(HY_BIN)IBM857.obj \
+  $(HY_BIN)IBM860.obj \
+  $(HY_BIN)IBM861.obj \
+  $(HY_BIN)IBM862.obj \
+  $(HY_BIN)IBM863.obj \
+  $(HY_BIN)IBM864.obj \
+  $(HY_BIN)IBM865.obj \
+  $(HY_BIN)IBM868.obj \
+  $(HY_BIN)IBM869.obj \
+  $(HY_BIN)IBM870.obj \
+  $(HY_BIN)IBM871.obj \
+  $(HY_BIN)IBM918.obj \
+  $(HY_BIN)IBM_Thai.obj \
+  $(HY_BIN)ISO_8859_3.obj \
+  $(HY_BIN)ISO_8859_6.obj \
+  $(HY_BIN)ISO_8859_8.obj \
+  $(HY_BIN)windows_1255.obj \
+  $(HY_BIN)windows_1256.obj \
+  $(HY_BIN)x_IBM1006.obj \
+  $(HY_BIN)x_IBM1025.obj \
+  $(HY_BIN)x_IBM1097.obj \
+  $(HY_BIN)x_IBM1098.obj \
+  $(HY_BIN)x_IBM1112.obj \
+  $(HY_BIN)x_IBM1122.obj \
+  $(HY_BIN)x_IBM1123.obj \
+  $(HY_BIN)x_IBM1124.obj \
+  $(HY_BIN)x_IBM737.obj \
+  $(HY_BIN)x_IBM856.obj \
+  $(HY_BIN)x_IBM874.obj \
+  $(HY_BIN)x_IBM875.obj \
+  $(HY_BIN)x_IBM922.obj \
+  $(HY_BIN)x_MacCyrillic.obj \
+  $(HY_BIN)x_MacGreek.obj \
+  $(HY_BIN)x_MacTurkish.obj \
+  $(HY_BIN)Big5.obj \
+  $(HY_BIN)Big5_HKSCS.obj \
+  $(HY_BIN)EUC_KR.obj \
+  $(HY_BIN)GB2312.obj \
+  $(HY_BIN)GBK.obj \
+  $(HY_BIN)GB18030.obj \
+  $(HY_BIN)windows_31j.obj \
+  $(HY_BIN)x_MS950_HKSCS.obj \
+  $(HY_BIN)x_windows_949.obj 
 
 VIRTFILES = hynio_char.res
 
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)vmi$(HY_LINKLIB_SUFFIX)
-  
+
 DLLBASE=0x13200000
 
 !include <$(HY_HDK)\build\make\rules.mak>
diff --git a/classlib/modules/orb/build.xml b/classlib/modules/orb/build.xml
index 73cacc4..ed21fad 100644
--- a/classlib/modules/orb/build.xml
+++ b/classlib/modules/orb/build.xml
@@ -21,10 +21,10 @@
 <project name="ORB Build" default="build" basedir=".">
     <description>Build for ORB component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="orb" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <target name="build" depends="check-depends,-build-no-check"/>
diff --git a/classlib/modules/pack200/build.xml b/classlib/modules/pack200/build.xml
index be7fb27..4e3abf0 100644
--- a/classlib/modules/pack200/build.xml
+++ b/classlib/modules/pack200/build.xml
@@ -19,10 +19,10 @@
 <project name="PACK200 Build" default="build" basedir=".">
     <description>Build for PACK200 component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="pack200" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
@@ -75,18 +75,18 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
         <echo message="Compiling ${hy.module} classes" />
 
-        <mkdir dir="../../build/classes" />
+        <mkdir dir="${hy.build.top}/java" />
 
     	<!-- Ordinary classes -->
         <hy.javac sourcepath=""
                   srcdir="src/main/java"
-                  destdir="../../build/classes"
+                  destdir="${hy.build.top}/java"
                   source="1.4"
                   target="1.4">
 
@@ -140,7 +140,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -159,7 +159,7 @@
     </target>
 
     <target name="-compile-tests" unless="skip.test.build">
-        <mkdir dir="bin/test" />
+        <mkdir dir="${hy.build.mod}/test/api" />
 
         <mkdir dir="${hy.hdk}/build/test" />
         <copy file="${junit.jar}"
@@ -169,7 +169,7 @@
 
         <echo message="Compiling ${hy.module} tests" />
         <hy.javac srcdir="src/test/java"
-                  destdir="bin/test"
+                  destdir="${hy.build.mod}/test/api"
                   sourcepath=""
                   source="1.4" 
                   target="1.4">
diff --git a/classlib/modules/pack200/make/run-test.xml b/classlib/modules/pack200/make/run-test.xml
index 8268be3..676bc46 100644
--- a/classlib/modules/pack200/make/run-test.xml
+++ b/classlib/modules/pack200/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="pack200" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/portlib/build.xml b/classlib/modules/portlib/build.xml
index ed46d6d..d2c95c8 100644
--- a/classlib/modules/portlib/build.xml
+++ b/classlib/modules/portlib/build.xml
@@ -19,10 +19,10 @@
 <project name="PORTLIB Build" default="build" basedir=".">
     <description>Build for PORTLIB component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="portlib" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -161,7 +161,7 @@
     <target name="-build-copy-thread" if="hy.thr.deploy"
             unless="skip.native.build">
         <copy todir="${hy.jdk}/jre/bin" preservelastmodified="true">
-            <fileset dir="src/main/native/thread">
+            <fileset dir="${hy.build.mod}/native/thread">
                 <include name="*${shlib.suffix}*" />
                 <include name="*${progdb.suffix}*" if="is.windows" />
                 <exclude name="*${manifest.suffix}"/>
diff --git a/classlib/modules/portlib/src/main/native/a2e/unix/makefile b/classlib/modules/portlib/src/main/native/a2e/unix/makefile
index 78737cd..a3b42c4 100644
--- a/classlib/modules/portlib/src/main/native/a2e/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/a2e/unix/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'a2e'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/a2e/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -DHYPORT_LIBRARY_DEFINE
 
@@ -28,4 +29,4 @@
 DLLNAME = $(DLLPATH)libhya2e$(HY_SHLIB_SUFFIX)
 LIBNAME = $(LIBPATH)libhya2e.a
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/portlib/src/main/native/common/unix/makefile b/classlib/modules/portlib/src/main/native/common/unix/makefile
index a1a68ca..680edb2 100644
--- a/classlib/modules/portlib/src/main/native/common/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/common/unix/makefile
@@ -17,11 +17,12 @@
 # Makefile for module 'common'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/common/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)libglob.o $(SHAREDSUB)iohelp.o \
-	$(SHAREDSUB)exceptions.o $(SHAREDSUB)strhelp.o \
-	$(SHAREDSUB)utf8encode.o $(SHAREDSUB)utf8decode.o
+BUILDFILES = \
+  libglob.o iohelp.o exceptions.o strhelp.o utf8encode.o utf8decode.o
 LIBNAME = $(LIBPATH)libhycommon.a
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
+
diff --git a/classlib/modules/portlib/src/main/native/common/windows/makefile b/classlib/modules/portlib/src/main/native/common/windows/makefile
index 00b4798..48a1c0f 100644
--- a/classlib/modules/portlib/src/main/native/common/windows/makefile
+++ b/classlib/modules/portlib/src/main/native/common/windows/makefile
@@ -17,16 +17,16 @@
 # Makefile for module 'common'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\portlib\native\common\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBNAME=$(LIBPATH)hycommon.lib
 
 BUILDFILES = \
-	$(SHAREDSUB)libglob.obj $(SHAREDSUB)iohelp.obj \
-	$(SHAREDSUB)exceptions.obj $(SHAREDSUB)strhelp.obj \
-	$(SHAREDSUB)utf8decode.obj $(SHAREDSUB)utf8encode.obj
+ $(HY_BIN)libglob.obj $(HY_BIN)iohelp.obj $(HY_BIN)exceptions.obj \
+ $(HY_BIN)strhelp.obj $(HY_BIN)utf8decode.obj $(HY_BIN)utf8encode.obj
 MDLLIBFILES =
 
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
 
-!include <$(HY_HDK)\build\make\rules.mak>
+!include <$(HY_TARGET)\hdk\build\make\rules.mak>
diff --git a/classlib/modules/portlib/src/main/native/pool/unix/makefile b/classlib/modules/portlib/src/main/native/pool/unix/makefile
index 2eb45e1..8149458 100644
--- a/classlib/modules/portlib/src/main/native/pool/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/pool/unix/makefile
@@ -17,9 +17,10 @@
 # Makefile for module 'pool'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/pool/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)pool.o $(SHAREDSUB)pool_cap.o
+BUILDFILES = pool.o pool_cap.o
 LIBNAME = $(LIBPATH)libhypool.a
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/portlib/src/main/native/pool/windows/makefile b/classlib/modules/portlib/src/main/native/pool/windows/makefile
index 9680031..2bcba47 100644
--- a/classlib/modules/portlib/src/main/native/pool/windows/makefile
+++ b/classlib/modules/portlib/src/main/native/pool/windows/makefile
@@ -17,10 +17,11 @@
 # Makefile for module 'pool'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\portlib\native\pool\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBNAME=$(LIBPATH)hypool.lib
-BUILDFILES = $(SHAREDSUB)pool.obj $(SHAREDSUB)pool_cap.obj
+BUILDFILES = $(HY_BIN)pool.obj $(HY_BIN)pool_cap.obj
 MDLLIBFILES =
 
 !include <$(HY_HDK)\build\make\rules.mak>
diff --git a/classlib/modules/portlib/src/main/native/port/unix/makefile b/classlib/modules/portlib/src/main/native/port/unix/makefile
index 1f5c916..9d54d14 100644
--- a/classlib/modules/portlib/src/main/native/port/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/port/unix/makefile
@@ -17,26 +17,18 @@
 # Makefile for module 'port'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/port/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 INCLUDES += -DHYPORT_LIBRARY_DEFINE -I$(HY_PLATFORM)
 
 BUILDFILES = \
-	$(SHAREDSUB)port_copyright.o $(SHAREDSUB)hyerror.o \
-	hyerrorhelpers.o $(SHAREDSUB)hyexit.o hyfile.o hyfiletext.o \
-	$(SHAREDSUB)hygp.o hymem.o \
-	$(HY_OS)/hymmap.o $(SHAREDSUB)hynls.o hynlshelpers.o hyosdump.o \
-	$(SHAREDSUB)hyport.o $(SHAREDSUB)hyportcontrol.o hyportptb.o \
-	hysharedhelper.o $(HY_OS)/hysl.o hysock.o \
-	$(SHAREDSUB)hystr.o $(SHAREDSUB)hystrftime.o $(SHAREDSUB)hystsl.o \
-	hysysinfo.o hytime.o $(SHAREDSUB)hytlshelpers.o hytty.o
+  port_copyright.o hyerror.o hyerrorhelpers.o hyexit.o hyfile.o hyfiletext.o \
+  hygp.o hymem.o /hymmap.o hynls.o hynlshelpers.o hyosdump.o hyport.o \
+  hyportcontrol.o hyportptb.o hysharedhelper.o hysl.o hysock.o hystr.o \
+  hystrftime.o hystsl.o hysysinfo.o hytime.o hytlshelpers.o hytty.o hycpu.o \
+  hyipcmutex.o hyshmem.o hyshsem.o hyvmem.o
 
-ifeq ($(HY_PORTLIB_STUBS),true)
-BUILDFILES += stubs/hycpu.o stubs/hyipcmutex.o stubs/hyshmem.o \
-              stubs/hyshsem.o stubs/hyvmem.o
-else
-BUILDFILES += hycpu.o hyipcmutex.o hyshmem.o hyshsem.o $(HY_OS)/hyvmem.o
-endif
 
 ifeq ($(HY_NO_THR),true)
 MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
@@ -44,4 +36,9 @@
 DLLNAME = $(DLLPATH)libhyprt$(HY_SHLIB_SUFFIX)
 EXPNAME = HYPRT_0.1
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
+
+ifeq ($(HY_PORTLIB_STUBS),true)
+$(HY_BIN)%.o: $(SHAREDSUB)%.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+endif
diff --git a/classlib/modules/portlib/src/main/native/port/windows/makefile b/classlib/modules/portlib/src/main/native/port/windows/makefile
index 4697451..a97117d 100644
--- a/classlib/modules/portlib/src/main/native/port/windows/makefile
+++ b/classlib/modules/portlib/src/main/native/port/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'port'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\portlib\native\port\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyprt
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -27,14 +28,16 @@
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
 BUILDFILES = \
-  $(SHAREDSUB)port_copyright.obj hycpu.obj $(SHAREDSUB)hyerror.obj \
-  hyerrorhelpers.obj $(SHAREDSUB)hyexit.obj hyfile.obj hyfiletext.obj \
-  $(SHAREDSUB)hygp.obj hyipcmutex.obj hymem.obj hymmap.obj \
-  $(SHAREDSUB)hynls.obj hynlshelpers.obj hyosdump.obj $(SHAREDSUB)hyport.obj \
-  $(SHAREDSUB)hyportcontrol.obj hyportptb.obj hyshmem.obj hyshsem.obj \
-  hysl.obj hysock.obj $(SHAREDSUB)hystr.obj \
-  $(SHAREDSUB)hystrftime.obj $(SHAREDSUB)hystsl.obj hysysinfo.obj hytime.obj \
-  $(SHAREDSUB)hytlshelpers.obj hytty.obj hyvmem.obj
+  $(HY_BIN)port_copyright.obj $(HY_BIN)hycpu.obj $(HY_BIN)hyerror.obj \
+  $(HY_BIN)hyerrorhelpers.obj $(HY_BIN)hyexit.obj $(HY_BIN)hyfile.obj \
+  $(HY_BIN)hyfiletext.obj $(HY_BIN)hygp.obj $(HY_BIN)hyipcmutex.obj \
+  $(HY_BIN)hymem.obj $(HY_BIN)hymmap.obj $(HY_BIN)hynls.obj \
+  $(HY_BIN)hynlshelpers.obj $(HY_BIN)hyosdump.obj $(HY_BIN)hyport.obj \
+  $(HY_BIN)hyportcontrol.obj $(HY_BIN)hyportptb.obj $(HY_BIN)hyshmem.obj \
+  $(HY_BIN)hyshsem.obj $(HY_BIN)hysl.obj $(HY_BIN)hysock.obj \
+  $(HY_BIN)hystr.obj $(HY_BIN)hystrftime.obj $(HY_BIN)hystsl.obj \
+  $(HY_BIN)hysysinfo.obj $(HY_BIN)hytime.obj $(HY_BIN)hytlshelpers.obj \
+  $(HY_BIN)hytty.obj $(HY_BIN)hyvmem.obj
 
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
 VIRTFILES = hyprt.res
diff --git a/classlib/modules/portlib/src/main/native/thread/unix/makefile b/classlib/modules/portlib/src/main/native/thread/unix/makefile
index 2c4fab1..d4694a6 100644
--- a/classlib/modules/portlib/src/main/native/thread/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/thread/unix/makefile
@@ -17,17 +17,17 @@
 # Makefile for module 'thread'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/thread/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = \
-	$(SHAREDSUB)thread_copyright.o $(HY_ARCH)/thrhelp.o $(HY_ARCH)/thrspinlock.o \
-	$(SHAREDSUB)hythread.o $(SHAREDSUB)hythreadinspect.o linuxonexit.o priority.o \
-	rasthrsup.o $(SHAREDSUB)rwmutex.o thrcreate.o thrdsup.o $(SHAREDSUB)thrprof.o
+BUILDFILES = thread_copyright.o thrhelp.o thrspinlock.o hythread.o \
+  hythreadinspect.o linuxonexit.o priority.o rasthrsup.o rwmutex.o \
+  thrcreate.o thrdsup.o thrprof.o
 
 OSLIBS += -lpthread
 MDLLIBFILES = $(LIBPATH)libhypool.a $(LIBPATH)libhycommon.a
-DLLNAME = ../libhythr$(HY_SHLIB_SUFFIX)
+DLLNAME = $(HY_BIN)libhythr$(HY_SHLIB_SUFFIX)
 EXPNAME = HYTHR_0.1
 HY_CAN_LINK_DEBUG=no
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/portlib/src/main/native/thread/windows/makefile b/classlib/modules/portlib/src/main/native/thread/windows/makefile
index bb7db11..33184b1 100644
--- a/classlib/modules/portlib/src/main/native/thread/windows/makefile
+++ b/classlib/modules/portlib/src/main/native/thread/windows/makefile
@@ -17,6 +17,7 @@
 # Makefile for module 'thread'
 #
 
+HY_BIN=$(HY_TARGET)\build\classlib\portlib\native\thread\# trailing slash
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hythr
@@ -24,9 +25,10 @@
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 
 BUILDFILES = \
-  $(SHAREDSUB)thread_copyright.obj $(HY_PLATFORM)\thrhelp.obj $(HY_PLATFORM)\thrspinlock.obj \
-  $(SHAREDSUB)hythread.obj $(SHAREDSUB)hythreadinspect.obj $(SHAREDSUB)rwmutex.obj thrdsup.obj \
-  $(SHAREDSUB)thrprof.obj $(HY_PLATFORM)\locklbl.obj lock386.obj
+  $(HY_BIN)thread_copyright.obj $(HY_BIN)thrhelp.obj $(HY_BIN)thrspinlock.obj \
+  $(HY_BIN)hythread.obj $(HY_BIN)hythreadinspect.obj $(HY_BIN)rwmutex.obj \
+  $(HY_BIN)thrdsup.obj $(HY_BIN)thrprof.obj \
+  $(HY_BIN)locklbl.obj $(HY_BIN)lock386.obj
 
 # TOFIX $(LIBBASE).def should be a dependency on all libs
 VIRTFILES = $(LIBBASE).res
diff --git a/classlib/modules/portlib/src/main/native/thrstub/unix/makefile b/classlib/modules/portlib/src/main/native/thrstub/unix/makefile
index c67881b..6465a1e 100644
--- a/classlib/modules/portlib/src/main/native/thrstub/unix/makefile
+++ b/classlib/modules/portlib/src/main/native/thrstub/unix/makefile
@@ -14,15 +14,16 @@
 #  limitations under the License.
 
 #
-# Makefile for module 'thread'
+# Makefile for module 'thrstub'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/portlib/native/thrstub/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = $(SHAREDSUB)hythread.o
+BUILDFILES = hythread.o
 
 DLLNAME = $(LIBPATH)libhythr$(HY_SHLIB_SUFFIX)
 DBGPATH = $(LIBPATH)
 EXPNAME = HYTHR_0.2
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/prefs/build.xml b/classlib/modules/prefs/build.xml
index caf9134..f6bd898 100644
--- a/classlib/modules/prefs/build.xml
+++ b/classlib/modules/prefs/build.xml
@@ -21,10 +21,10 @@
 <project name="PREFS Build" default="build" basedir=".">
     <description>Build for PREFS component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="prefs" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -72,7 +72,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -110,7 +110,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/prefs/make/run-test.xml b/classlib/modules/prefs/make/run-test.xml
index c8870c0..dd34abd 100644
--- a/classlib/modules/prefs/make/run-test.xml
+++ b/classlib/modules/prefs/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="prefs" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/prefs/src/main/native/prefs/windows/makefile b/classlib/modules/prefs/src/main/native/prefs/windows/makefile
index 48c1d37..ac16051 100644
--- a/classlib/modules/prefs/src/main/native/prefs/windows/makefile
+++ b/classlib/modules/prefs/src/main/native/prefs/windows/makefile
@@ -17,7 +17,8 @@
 # Makefile for module 'prefs'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\prefs\native\prefs\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hyprefs
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -25,7 +26,7 @@
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
-BUILDFILES = prefs_copyright.obj PreferencesImpl.obj
+BUILDFILES = $(HY_BIN)prefs_copyright.obj $(HY_BIN)PreferencesImpl.obj
 
 VIRTFILES = $(LIBBASE).res
 
diff --git a/classlib/modules/print/build.xml b/classlib/modules/print/build.xml
index 40ac2a9..0457600 100644
--- a/classlib/modules/print/build.xml
+++ b/classlib/modules/print/build.xml
@@ -19,10 +19,10 @@
 <project name="Print Build" default="build" basedir=".">
     <description>Build for Print component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="print" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -62,7 +62,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -122,7 +122,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/print/make/run-test.xml b/classlib/modules/print/make/run-test.xml
index 5144211..39c09ce 100644
--- a/classlib/modules/print/make/run-test.xml
+++ b/classlib/modules/print/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="print" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/print/src/main/native/print/windows/makefile b/classlib/modules/print/src/main/native/print/windows/makefile
index 8cd9d6f..c19e2c5 100644
--- a/classlib/modules/print/src/main/native/print/windows/makefile
+++ b/classlib/modules/print/src/main/native/print/windows/makefile
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\print\native\print\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=print
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
@@ -29,10 +30,8 @@
   $(VMDEBUG) /I$(HY_HDK)\include /I$(HY_HDK)\jdk\include /I. \
   -I$(SHAREDSUB)\include
 
-BUILDFILES = print.obj \
-ui.obj \
-win_printer_factory.obj \
-devmode_struct_wrapper.obj
+BUILDFILES = $(HY_BIN)print.obj $(HY_BIN)ui.obj \
+  $(HY_BIN)win_printer_factory.obj $(HY_BIN)devmode_struct_wrapper.obj
 
 VIRTFILES = $(LIBBASE).res
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
diff --git a/classlib/modules/regex/build.xml b/classlib/modules/regex/build.xml
index 4ca53ef..1efd8ba 100644
--- a/classlib/modules/regex/build.xml
+++ b/classlib/modules/regex/build.xml
@@ -19,10 +19,10 @@
 <project name="REGEX Build" default="build" basedir=".">
     <description>Build for REGEX component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="regex" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/regex/make/run-test.xml b/classlib/modules/regex/make/run-test.xml
index 0d767ac..f94989d 100644
--- a/classlib/modules/regex/make/run-test.xml
+++ b/classlib/modules/regex/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="regex" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/rmi/build.xml b/classlib/modules/rmi/build.xml
index 33e0fd2..f747c99 100644
--- a/classlib/modules/rmi/build.xml
+++ b/classlib/modules/rmi/build.xml
@@ -19,10 +19,10 @@
 <project name="RMI Build" default="build" basedir=".">
     <description>Build for RMI component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="rmi" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test/api" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -116,7 +116,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} api tests"
-                       destdir="bin/test/api">
+                       destdir="${hy.build.mod}/test/api">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/java"/>
diff --git a/classlib/modules/rmi/make/run-test.xml b/classlib/modules/rmi/make/run-test.xml
index 697d0f1..e9fb722 100644
--- a/classlib/modules/rmi/make/run-test.xml
+++ b/classlib/modules/rmi/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="rmi" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/security-kernel/build.xml b/classlib/modules/security-kernel/build.xml
index 1bb17ff..b3818ff 100644
--- a/classlib/modules/security-kernel/build.xml
+++ b/classlib/modules/security-kernel/build.xml
@@ -21,9 +21,10 @@
 
     <description>Build for security kernel stub jar</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="security-kernel" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property name="stub.jar"
               location="${hy.jdk}/jre/lib/boot/${hy.module}-stubs.jar" />
diff --git a/classlib/modules/security/build.xml b/classlib/modules/security/build.xml
index 12f7038..58f5120 100644
--- a/classlib/modules/security/build.xml
+++ b/classlib/modules/security/build.xml
@@ -19,10 +19,10 @@
 <project name="SECURITY Build" default="build" basedir=".">
     <description>Build for SECURITY component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="security" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -66,7 +66,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -108,19 +108,19 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_api.jar">
-            <fileset dir="bin/test/api" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_api_in.jar">
-            <fileset dir="bin/test/api.injected" />
+            <fileset dir="${hy.build.mod}/test/api.injected" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_impl.jar">
-            <fileset dir="bin/test/impl" />
+            <fileset dir="${hy.build.mod}/test/impl" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_impl_in.jar">
-            <fileset dir="bin/test/impl.injected" />
+            <fileset dir="${hy.build.mod}/test/impl.injected" />
         </hy.jar.bin>
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests_support.jar">
-            <fileset dir="bin/test/support" />
+            <fileset dir="${hy.build.mod}/test/support" />
         </hy.jar.bin>
 
         <copy todir="${tests.resources.hdk.dir}">
@@ -141,7 +141,7 @@
     <target name="-compile-tests" unless="skip.test.build">
 
         <compile-tests description="${hy.module} test support files"
-                       destdir="bin/test/support">
+                       destdir="${hy.build.mod}/test/support">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/support/common/java"/>
@@ -150,47 +150,47 @@
             </javac-elements>
         </compile-tests>
 
-        <compile-tests description="${hy.module} api tests" destdir="bin/test/api">
+        <compile-tests description="${hy.module} api tests" destdir="${hy.build.mod}/test/api">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/java"/>
                 </src>
 
                 <include name="**/*Test.java" />
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
 
         <compile-tests description="${hy.module} api injected tests"
-                       destdir="bin/test/api.injected">
+                       destdir="${hy.build.mod}/test/api.injected">
             <javac-elements>
                 <src path="src/test/api/java.injected"/>
                 <include name="**/*Test.java" />
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
 
         <compile-tests description="${hy.module} impl injected tests"
-                       destdir="bin/test/impl.injected">
+                       destdir="${hy.build.mod}/test/impl.injected">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/impl/java.injected"/>
                 </src>
 
                 <include name="**/*Test.java" />
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
 
         <compile-tests description="${hy.module} impl tests"
-                       destdir="bin/test/impl">
+                       destdir="${hy.build.mod}/test/impl">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/impl/java"/>
                 </src>
 
                 <include name="**/*Test.java" />
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
             </javac-elements>
         </compile-tests>
     </target>
diff --git a/classlib/modules/security/make/run-test.xml b/classlib/modules/security/make/run-test.xml
index a514124..369420f 100644
--- a/classlib/modules/security/make/run-test.xml
+++ b/classlib/modules/security/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="security" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/security/src/main/native/security/unix/makefile b/classlib/modules/security/src/main/native/security/unix/makefile
index 5d7823b..b177e39 100644
--- a/classlib/modules/security/src/main/native/security/unix/makefile
+++ b/classlib/modules/security/src/main/native/security/unix/makefile
@@ -17,14 +17,14 @@
 # Makefile for module 'security'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/classlib/security/native/security/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = \
-	$(SHAREDSUB)security_copyright.o getUnixSystemRandom.o
+BUILDFILES = security_copyright.o getUnixSystemRandom.o
 
 DLLNAME = $(DLLPATH)libhysecurity$(HY_SHLIB_SUFFIX)
 EXPNAME = HYSECURITY_0.1
 
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
-include $(HY_HDK)/build/make/rules.mk
+include $(HY_TARGET)/hdk/build/make/rules.mk
diff --git a/classlib/modules/security/src/main/native/security/windows/makefile b/classlib/modules/security/src/main/native/security/windows/makefile
index 54d5f12..159c792 100644
--- a/classlib/modules/security/src/main/native/security/windows/makefile
+++ b/classlib/modules/security/src/main/native/security/windows/makefile
@@ -17,12 +17,13 @@
 # Makefile for module 'security'
 #
 
-!include <$(HY_HDK)\build\make\defines.mak>
+HY_BIN=$(HY_TARGET)\build\classlib\security\native\security\# trailing slash
+!include <$(HY_TARGET)\hdk\build\make\defines.mak>
 
 LIBBASE=hysecurity
 DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
-BUILDFILES = $(SHAREDSUB)security_copyright.obj getWindowsRandom.obj
+BUILDFILES = $(HY_BIN)security_copyright.obj $(HY_BIN)getWindowsRandom.obj
 VIRTFILES = $(LIBBASE).res
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 
diff --git a/classlib/modules/sound/build.xml b/classlib/modules/sound/build.xml
index 8a15d34..8ae0867 100644
--- a/classlib/modules/sound/build.xml
+++ b/classlib/modules/sound/build.xml
@@ -19,10 +19,10 @@
 <project name="SOUND Build" default="build" basedir=".">
     <description>Build for SOUND component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="sound" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/sound/make/run-test.xml b/classlib/modules/sound/make/run-test.xml
index f3ae9e2..bc91814 100644
--- a/classlib/modules/sound/make/run-test.xml
+++ b/classlib/modules/sound/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="sound" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/sql/build.xml b/classlib/modules/sql/build.xml
index 8018034..a55a8bd 100644
--- a/classlib/modules/sql/build.xml
+++ b/classlib/modules/sql/build.xml
@@ -19,11 +19,10 @@
 <project name="SQL Build" default="build" basedir=".">
     <description>Build for SQL component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="sql" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <property file="../../make/depends.properties" />
@@ -108,7 +107,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/sql/make/run-test.xml b/classlib/modules/sql/make/run-test.xml
index 8439e36..6bb247d 100644
--- a/classlib/modules/sql/make/run-test.xml
+++ b/classlib/modules/sql/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="sql" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/suncompat/build.xml b/classlib/modules/suncompat/build.xml
index 3827af3..8795c5d 100644
--- a/classlib/modules/suncompat/build.xml
+++ b/classlib/modules/suncompat/build.xml
@@ -19,10 +19,10 @@
 <project name="Sun Compat Build" default="build" basedir=".">
     <description>Build for Sun Compat component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="suncompat" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/suncompat/make/run-test.xml b/classlib/modules/suncompat/make/run-test.xml
index 137a6ea..04ae191 100644
--- a/classlib/modules/suncompat/make/run-test.xml
+++ b/classlib/modules/suncompat/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="suncompat" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/swing/build.xml b/classlib/modules/swing/build.xml
index 3e24723..b3f7b9e 100644
--- a/classlib/modules/swing/build.xml
+++ b/classlib/modules/swing/build.xml
@@ -19,13 +19,13 @@
 <project name="SWING Build" default="build" basedir=".">
     <description>Build for SWING component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="swing" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <!-- List of private classes that cannot be mapped by above mappers -->
-    <fileset id="hidden.classes" dir="../../build/classes">
+    <fileset id="hidden.classes" dir="${hy.build.top}/java">
         <include name="javax/swing/text/html/parser/ModelElement.class"/>
         <include name="javax/swing/text/html/parser/Asn1ModelElement.class"/>
         <include name="javax/swing/text/html/parser/Asn1ModelElement$1.class"/>
@@ -66,7 +66,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -108,7 +108,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test/injected" />
+            <fileset dir="${hy.build.mod}/test/injected" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
@@ -128,7 +128,7 @@
 
     <target name="-compile-tests" unless="skip.test.build">
         <compile-tests description="${hy.module} tests"
-                       destdir="bin/test/injected">
+                       destdir="${hy.build.mod}/test/injected">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/api/java.injected" />
diff --git a/classlib/modules/swing/make/run-test.xml b/classlib/modules/swing/make/run-test.xml
index 32f56c9..61bbf7e 100644
--- a/classlib/modules/swing/make/run-test.xml
+++ b/classlib/modules/swing/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="swing" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/text/build.xml b/classlib/modules/text/build.xml
index db9598e..beba92e 100644
--- a/classlib/modules/text/build.xml
+++ b/classlib/modules/text/build.xml
@@ -19,10 +19,10 @@
 <project name="TEXT Build" default="build" basedir=".">
     <description>Build for TEXT component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="text" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,7 +95,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
         
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/classlib/modules/text/make/run-test.xml b/classlib/modules/text/make/run-test.xml
index 5c16782..a92c67b 100644
--- a/classlib/modules/text/make/run-test.xml
+++ b/classlib/modules/text/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="text" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/x-net/build.xml b/classlib/modules/x-net/build.xml
index 6b8586f..591b766 100644
--- a/classlib/modules/x-net/build.xml
+++ b/classlib/modules/x-net/build.xml
@@ -19,10 +19,10 @@
 <project name="X-NET Build" default="build" basedir=".">
     <description>Build for X-NET component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="x-net" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <property file="../../make/depends.properties" />
 
@@ -57,7 +57,7 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
@@ -95,19 +95,19 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_test_support.jar">
-            <fileset dir="bin/test/support" />
+            <fileset dir="${hy.build.mod}/test/support" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_api_tests.jar">
-            <fileset dir="bin/test/api" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_boot_tests.jar">
-            <fileset dir="bin/test/impl.injected" />
+            <fileset dir="${hy.build.mod}/test/impl.injected" />
         </hy.jar.bin>
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_impl_tests.jar">
-            <fileset dir="bin/test/impl" />
+            <fileset dir="${hy.build.mod}/test/impl" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}" />
@@ -128,7 +128,7 @@
     <target name="-compile-tests" unless="skip.test.build">
 
         <compile-tests description="${hy.module} test support files"
-                       destdir="bin/test/support">
+                       destdir="${hy.build.mod}/test/support">
             <javac-elements>
                 <src>
                     <pathelement location="src/test/support/common/java" />
@@ -139,9 +139,9 @@
         </compile-tests>
         
         <compile-tests description="${hy.module} api tests"
-                       destdir="bin/test/api">
+                       destdir="${hy.build.mod}/test/api">
             <javac-elements>
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
                 <src path="src/test/api/java"/>
                 <src path="src/test/java"/>
                 <include name="**/*Test.java" />
@@ -149,16 +149,16 @@
         </compile-tests>
 
         <compile-tests description="${hy.module} impl injected tests"
-                       destdir="bin/test/impl.injected">
+                       destdir="${hy.build.mod}/test/impl.injected">
             <javac-elements>
-                <classpath location="bin/test/support" />
+                <classpath location="${hy.build.mod}/test/support" />
                 <src path="src/test/impl/java.injected"/>
                 <include name="**/*Test.java" />
             </javac-elements>
         </compile-tests>
         
         <compile-tests description="${hy.module} impl tests"
-                       destdir="bin/test/impl">
+                       destdir="${hy.build.mod}/test/impl">
             <javac-elements>
                 <src path="src/test/impl/java"/>
                 <include name="**/*Test.java" />
diff --git a/classlib/modules/x-net/make/run-test.xml b/classlib/modules/x-net/make/run-test.xml
index d143c09..ee845db 100644
--- a/classlib/modules/x-net/make/run-test.xml
+++ b/classlib/modules/x-net/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="classlib" />
+    <property name="hy.module" value="x-net" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/classlib/modules/xml/build.xml b/classlib/modules/xml/build.xml
index 42a49ed..f2b2377 100644
--- a/classlib/modules/xml/build.xml
+++ b/classlib/modules/xml/build.xml
@@ -21,10 +21,10 @@
 <project name="XML Build" default="build" basedir=".">
     <description>Build for XML component</description>
 
+    <property name="hy.component" value="classlib" />
     <property name="hy.module" value="xml" />
-    <property name="hy.hdk" location="${basedir}/../../deploy" />
-    <property name="depends.dir" location="${basedir}/../../depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
 
     <target name="build" depends="check-depends"/>
diff --git a/classlib/support/src/test/java/tests/support/Support_Excludes.java b/classlib/support/src/test/java/tests/support/Support_Excludes.java
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/classlib/support/src/test/java/tests/support/Support_Excludes.java
diff --git a/classlib/depends/build/defines.mak b/common_resources/depends/build/defines.mak
similarity index 98%
rename from classlib/depends/build/defines.mak
rename to common_resources/depends/build/defines.mak
index 123b258..dd468e8 100644
--- a/classlib/depends/build/defines.mak
+++ b/common_resources/depends/build/defines.mak
@@ -13,6 +13,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+HY_HDK=$(HY_TARGET)/hdk
 !include <$(HY_HDK)/build/make/properties.mak>
 
 !ifndef APPVER
diff --git a/classlib/depends/build/defines.mk b/common_resources/depends/build/defines.mk
similarity index 98%
rename from classlib/depends/build/defines.mk
rename to common_resources/depends/build/defines.mk
index 302a655..84a3358 100644
--- a/classlib/depends/build/defines.mk
+++ b/common_resources/depends/build/defines.mk
@@ -17,6 +17,7 @@
 # Configuration Makefile
 #
 
+HY_HDK=$(HY_TARGET)/hdk
 include $(HY_HDK)/build/make/properties.mk
 
 CXX = $(CC)
diff --git a/classlib/depends/build/platform/aix.ppc32.mk b/common_resources/depends/build/platform/aix.ppc32.mk
similarity index 100%
rename from classlib/depends/build/platform/aix.ppc32.mk
rename to common_resources/depends/build/platform/aix.ppc32.mk
diff --git a/classlib/depends/build/platform/aix.ppc64.mk b/common_resources/depends/build/platform/aix.ppc64.mk
similarity index 100%
rename from classlib/depends/build/platform/aix.ppc64.mk
rename to common_resources/depends/build/platform/aix.ppc64.mk
diff --git a/classlib/depends/build/platform/freebsd.x86.mk b/common_resources/depends/build/platform/freebsd.x86.mk
similarity index 100%
rename from classlib/depends/build/platform/freebsd.x86.mk
rename to common_resources/depends/build/platform/freebsd.x86.mk
diff --git a/classlib/depends/build/platform/freebsd.x86_64.mk b/common_resources/depends/build/platform/freebsd.x86_64.mk
similarity index 100%
rename from classlib/depends/build/platform/freebsd.x86_64.mk
rename to common_resources/depends/build/platform/freebsd.x86_64.mk
diff --git a/classlib/depends/build/platform/linux.ia64.mk b/common_resources/depends/build/platform/linux.ia64.mk
similarity index 100%
rename from classlib/depends/build/platform/linux.ia64.mk
rename to common_resources/depends/build/platform/linux.ia64.mk
diff --git a/classlib/depends/build/platform/linux.ppc32.mk b/common_resources/depends/build/platform/linux.ppc32.mk
similarity index 100%
rename from classlib/depends/build/platform/linux.ppc32.mk
rename to common_resources/depends/build/platform/linux.ppc32.mk
diff --git a/classlib/depends/build/platform/linux.ppc64.mk b/common_resources/depends/build/platform/linux.ppc64.mk
similarity index 100%
rename from classlib/depends/build/platform/linux.ppc64.mk
rename to common_resources/depends/build/platform/linux.ppc64.mk
diff --git a/classlib/depends/build/platform/linux.s390.mk b/common_resources/depends/build/platform/linux.s390.mk
similarity index 100%
rename from classlib/depends/build/platform/linux.s390.mk
rename to common_resources/depends/build/platform/linux.s390.mk
diff --git a/classlib/depends/build/platform/linux.s390x.mk b/common_resources/depends/build/platform/linux.s390x.mk
similarity index 100%
rename from classlib/depends/build/platform/linux.s390x.mk
rename to common_resources/depends/build/platform/linux.s390x.mk
diff --git a/classlib/depends/build/platform/linux.x86.mk b/common_resources/depends/build/platform/linux.x86.mk
similarity index 98%
rename from classlib/depends/build/platform/linux.x86.mk
rename to common_resources/depends/build/platform/linux.x86.mk
index b703332..7c9bf70 100644
--- a/classlib/depends/build/platform/linux.x86.mk
+++ b/common_resources/depends/build/platform/linux.x86.mk
@@ -17,3 +17,4 @@
 PLATFORM += -march=pentium3
 OSLIBS += -ldl
 HY_CAN_LINK_DEBUG = yes
+DEPFLAGS = -MD
diff --git a/classlib/depends/build/platform/linux.x86_64.mk b/common_resources/depends/build/platform/linux.x86_64.mk
similarity index 93%
rename from classlib/depends/build/platform/linux.x86_64.mk
rename to common_resources/depends/build/platform/linux.x86_64.mk
index c0650bf..4781592 100644
--- a/classlib/depends/build/platform/linux.x86_64.mk
+++ b/common_resources/depends/build/platform/linux.x86_64.mk
@@ -14,6 +14,8 @@
 #  limitations under the License.
 
 DEFINES += -DLINUX -DLINUX_X86_64 -DHYX86_64 -DIPv6_FUNCTION_SUPPORT
+PLATFORM := -DPOINTER64 -fPIC # TOFIX drlvm hack
 XLIBS = -L/usr/X11R6/lib64 -lX11 -lXft -lXext -lXtst
 OSLIBS += -ldl
 HY_CAN_LINK_DEBUG = yes
+DEPFLAGS = -MD
diff --git a/classlib/depends/build/platform/macosx.ppc32.mk b/common_resources/depends/build/platform/macosx.ppc32.mk
similarity index 100%
rename from classlib/depends/build/platform/macosx.ppc32.mk
rename to common_resources/depends/build/platform/macosx.ppc32.mk
diff --git a/classlib/depends/build/platform/macosx.x86.mk b/common_resources/depends/build/platform/macosx.x86.mk
similarity index 100%
rename from classlib/depends/build/platform/macosx.x86.mk
rename to common_resources/depends/build/platform/macosx.x86.mk
diff --git a/classlib/depends/build/platform/macosx.x86_64.mk b/common_resources/depends/build/platform/macosx.x86_64.mk
similarity index 100%
rename from classlib/depends/build/platform/macosx.x86_64.mk
rename to common_resources/depends/build/platform/macosx.x86_64.mk
diff --git a/classlib/depends/build/platform/zos.s390.mk b/common_resources/depends/build/platform/zos.s390.mk
similarity index 89%
rename from classlib/depends/build/platform/zos.s390.mk
rename to common_resources/depends/build/platform/zos.s390.mk
index 6309170..90c5eae 100644
--- a/classlib/depends/build/platform/zos.s390.mk
+++ b/common_resources/depends/build/platform/zos.s390.mk
@@ -19,7 +19,8 @@
 # Use cxx/c++ for c++ compiles on z/OS
 CXX = cxx
 
-DEFINES += -DZOS -DZOS_S390 -DHYS390 -DHY_ATOE -D_OPEN_SYS_IF_EXT=1 -DIPv6_FUNCTION_SUPPORT
+DEFINES += -DZOS -DZOS_S390 -DHYS390 -DHY_ATOE -D_OPEN_SYS_IF_EXT=1 \
+           -DIPv6_FUNCTION_SUPPORT
 PLATFORM = -Wc,xplink,convlit\(ISO8859-1\),FLOAT\(IEEE,FOLD,AFP\) -Wa,goff \
            -Wc,NOANSIALIAS -Wc,DLL,EXPORTALL
 
@@ -49,5 +50,9 @@
 # z/OS has different debug flags
 HYDEBUGCFLAGS = -g -O0
 
+# On z/OS set DLLPATH to LIBPATH so we link against .x export files in
+# $(HY_HDK)/lib instead of directly against the .so libraries.
+DLLPATH=$(LIBPATH)
+
 # AR doesn't support the 'o' option on z/OS so mtime will be updated
 AREXTRACT= x
diff --git a/classlib/depends/build/platform/zos.s390x.mk b/common_resources/depends/build/platform/zos.s390x.mk
similarity index 89%
rename from classlib/depends/build/platform/zos.s390x.mk
rename to common_resources/depends/build/platform/zos.s390x.mk
index 94d8822..133969f 100644
--- a/classlib/depends/build/platform/zos.s390x.mk
+++ b/common_resources/depends/build/platform/zos.s390x.mk
@@ -19,7 +19,8 @@
 # Use cxx/c++ for c++ compiles on z/OS
 CXX = cxx
 
-DEFINES += -DZOS -DZOS_S390X -DHYS390X -DHY_ATOE -D_OPEN_SYS_IF_EXT=1 -DIPv6_FUNCTION_SUPPORT
+DEFINES += -DZOS -DZOS_S390X -DHYS390X -DHY_ATOE -D_OPEN_SYS_IF_EXT=1 \
+           -DIPv6_FUNCTION_SUPPORT
 PLATFORM = -Wc,lp64,xplink,convlit\(ISO8859-1\),FLOAT\(IEEE,FOLD,AFP\) \
            -Wa,goff -Wc,NOANSIALIAS -Wc,DLL,EXPORTALL
 
@@ -49,5 +50,9 @@
 # z/OS has different debug flags
 HYDEBUGCFLAGS = -g -O0
 
+# On z/OS set DLLPATH to LIBPATH so we link against .x export files in
+# $(HY_HDK)/lib instead of directly against the .so libraries.
+DLLPATH=$(LIBPATH)
+
 # AR doesn't support the 'o' option on z/OS so mtime will be updated
 AREXTRACT= x
diff --git a/classlib/depends/build/rules.mak b/common_resources/depends/build/rules.mak
similarity index 66%
rename from classlib/depends/build/rules.mak
rename to common_resources/depends/build/rules.mak
index 96ce1d7..fe710e3 100644
--- a/classlib/depends/build/rules.mak
+++ b/common_resources/depends/build/rules.mak
@@ -21,19 +21,10 @@
 DLLENTRY=@12
 !ENDIF
 
-.c.obj:
-	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $*.c
-
-.cpp.obj:
-	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $*.cpp
-
-.asm.obj:
-	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
-
 .rc.res:
 	rc -I..\include $<
 
-all: $(DLLNAME) $(EXENAME) $(LIBNAME)
+all: $(HY_BIN) $(DLLNAME) $(EXENAME) $(LIBNAME)
 
 !ifdef LIBNAME
 $(LIBNAME): $(BUILDFILES) $(VIRTFILES) $(MDLLIBFILES)
@@ -87,3 +78,57 @@
     -del $(DBGPATH)$(EXEBASE).pdb >nul 2>&1
     -del $(LIBPATH)$(EXEBASE).manifest >nul 2>&1
     -del $(CLEANFILES) >nul 2>&1
+
+$(HY_BIN):
+        -mkdir $(HY_BIN)
+
+# C rules
+{$(HY_PLATFORM)/}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(HY_ARCH)/}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(HY_OS)/}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(SHAREDSUB)}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(SHAREDSUB)additional/}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{.}.c{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(OSS_DIST)}.c{$(HY_BIN)}.obj: # for zlib_dist / fdlibm_dist
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+# C++ rules
+{$(HY_ARCH)/}.cpp{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(HY_OS)/}.cpp{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{$(SHAREDSUB)}.cpp{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+{.}.cpp{$(HY_BIN)}.obj:
+	$(cc) $(cflags) $(HYCFLAGS) -Fo$*.obj $<
+
+# assembler rules
+{$(HY_PLATFORM)/}.asm{$(HY_BIN)}.obj:
+	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
+
+{$(HY_ARCH)/}.asm{$(HY_BIN)}.obj:
+	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
+
+{$(HY_OS)/}.asm{$(HY_BIN)}.obj:
+	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
+
+{$(SHAREDSUB)}.asm{$(HY_BIN)}.obj:
+	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
+
+{.}.asm{$(HY_BIN)}.obj:
+	$(ml) /Fo$*.obj /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32 $<
diff --git a/common_resources/depends/build/rules.mk b/common_resources/depends/build/rules.mk
new file mode 100644
index 0000000..c7bc32b
--- /dev/null
+++ b/common_resources/depends/build/rules.mk
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#  
+#      http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Configuration Makefile
+#
+
+CFLAGS := $(DEFINES) $(INCLUDES) $(OPT) $(PLATFORM) $(CFLAGS) $(WARNFLAGS)
+CXXFLAGS := $(DEFINES) $(INCLUDES) $(OPT) $(PLATFORM) $(CXXFLAGS) $(WARNFLAGS)
+EXPFILE = $(HY_BIN)$(notdir $(basename $(DLLNAME))).exp
+
+BUILDFILES := $(addprefix $(HY_BIN),$(BUILDFILES))
+
+ifneq ($(HY_OS),zos)
+# Convert $(LIBPATH)libblah.so to -L$(LIBPATH) ... -lblah, also for $(DLLPATH)
+MDLLIBARGS := \
+  $(MDLLIBPREFIX) -L$(LIBPATH) -L$(DLLPATH) \
+  $(patsubst $(LIBPATH)lib%$(HY_LINKLIB_SUFFIX),-l%, \
+    $(patsubst $(DLLPATH)lib%$(HY_LINKLIB_SUFFIX),-l%, $(MDLLIBFILES))) \
+  $(MDLLIBSUFFIX)
+else
+# Do not change on zOS
+MDLLIBARGS := \
+  $(MDLLIBPREFIX) $(MDLLIBFILES) $(MDLLIBSUFFIX)
+endif
+
+all: $(DLLNAME) $(EXENAME) $(LIBNAME) $(HDKINCLUDES)
+
+CFLAGS += $(DEPFLAGS)
+CXXFLAGS += $(DEPFLAGS)
+-include $(BUILDFILES:.o=.d)
+
+$(LIBNAME): $(BUILDFILES)
+	@mkdir -p $(@D)
+	$(AR) $(ARFLAGS) $(ARCREATE) $@ $(BUILDFILES)
+	$(RANLIB) $@
+
+$(EXPFILE): exports.txt
+ifeq ($(HY_OS),aix)
+	cp $< $@
+else
+	echo "$(EXPNAME) {" >$@
+	echo "  global :" >>$@
+	sed -e's/^/    /;/#/!s/$$/;/' <$< >>$@
+	echo "  local : *;" >>$@
+	echo "};" >>$@
+endif
+
+$(DLLNAME): $(BUILDFILES) $(MDLLIBFILES) $(EXPFILE)
+	@mkdir -p $(@D)
+	$(DLL_LD) $(DLL_LDFLAGS) $(LDFLAGS) $(VMLINK) -o $@ \
+	$(BUILDFILES) $(MDLLIBARGS) $(OSLIBS)
+ifeq ($(HY_CAN_LINK_DEBUG),yes)
+	objcopy --only-keep-debug $@ $@.dbg
+	strip --strip-debug --strip-unneeded $@
+	( cd $(@D) && objcopy --add-gnu-debuglink=$(@F).dbg $(@F) )
+	-mkdir -p $(DBGPATH)
+	test "$@.dbg" = "$(DBGPATH)$(@F).dbg" || \
+		mv $@.dbg $(DBGPATH)$(@F).dbg
+endif
+ifeq ($(HY_OS),zos)
+	mv $(notdir $(basename $(DLLNAME)))$(HY_LINKLIB_SUFFIX) $(LIBPATH)
+endif
+
+$(EXENAME): $(BUILDFILES) $(MDLLIBFILES)
+	@mkdir -p $(@D)
+	$(CC) $(VMLINK) $(EXELDFLAGS) \
+	$(BUILDFILES) $(MDLLIBARGS) -o $@ $(OSLIBS) \
+	$(EXERPATHPREFIX) -L$(DLLPATH)
+	@chmod 755 $(EXENAME)
+
+clean:
+	-rm -f $(BUILDFILES) $(DLLNAME) $(EXENAME) $(LIBNAME) $(EXPFILE) \
+	       $(CLEANFILES) $(DBGPATH)$(notdir $(DLLNAME)).dbg
+
+# C rules
+$(HY_BIN)%.o: $(HY_PLATFORM)/%.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(HY_ARCH)/%.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(HY_OS)/%.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(SHAREDSUB)%.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(SHAREDSUB)additional/%.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: %.c
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(OSS_DIST)%.c # for zlib_dist / fdlibm_dist
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+# C++ rules
+$(HY_BIN)%.o: $(HY_ARCH)/%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(HY_OS)/%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(SHAREDSUB)$(HY_ARCH)/%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(SHAREDSUB)%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: %.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+
+# assembler rules
+$(HY_BIN)%.o: $(HY_PLATFORM)/%.s
+	@mkdir -p $(@D)
+	$(AS) $(ASFLAGS) -o $@ $<
+
+$(HY_BIN)%.o: $(HY_ARCH)/%.s
+	@mkdir -p $(@D)
+	$(AS) $(ASFLAGS) -o $@ $<
+
+$(HY_BIN)%.o: $(HY_OS)/%.s
+	@mkdir -p $(@D)
+	$(AS) $(ASFLAGS) -o $@ $<
+
+$(HY_BIN)%.o: $(SHAREDSUB)%.s
+	@mkdir -p $(@D)
+	$(AS) $(ASFLAGS) -o $@ $<
+
+$(HY_BIN)%.o: %.s
+	@mkdir -p $(@D)
+	$(AS) $(ASFLAGS) -o $@ $<
+
diff --git a/common_resources/make/depends.properties b/common_resources/make/depends.properties
index a0d6d95..8226cb8 100644
--- a/common_resources/make/depends.properties
+++ b/common_resources/make/depends.properties
@@ -13,8 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-depends.jars=${base.dep.dir}/jars
-depends.oss=${base.dep.dir}/oss
+depends.jars=${depends.dir}/jars
+depends.oss=${depends.dir}/oss
 
 depends.url=http://svn.apache.org/repos/asf/harmony/standard/depends
 eclipse.base=http://download.eclipse.org/eclipse/downloads/drops
@@ -44,7 +44,7 @@
 icuhdr.url=${depends.url}/oss/icu4c-3.4-harmony-includes.zip
 icuhdr.md5=46dbe39e5f6c4ea206a9daad9e29f8b0
 
-icudll=${base.dep.dir}/libs/${hy.platform.variant}/icu-3.4/icu-3.4.zip
+icudll=${depends.dir}/libs/${hy.platform.variant}/icu-3.4/icu-3.4.zip
 icudll.url=${depends.url}/libs/${hy.platform.variant}/icu-3.4.zip
 icuuc.linkname@windows@=icuuc.lib
 icuuc.linkname@unix@=libicuuc.so.34
@@ -78,12 +78,6 @@
 xerces.url=http://www.apache.org/dist/xml/xerces-j/Xerces-J-bin.2.10.0.zip
 xerces.md5=8da14a7b2848eff131b7cc10668887e8
 
-bcprov.ver=bcprov-jdk15-138
-bcprov.dir=${depends.jars}/${bcprov.ver}
-bcprov.jar=${bcprov.dir}/bcprov.noidea.jar
-bcprov.url=${depends.url}/jars/bcprov/${bcprov.ver}/bcprov.noidea.jar
-bcprov.md5=7e2cf5f39012b303b4246e33a66bf078
-
 msvcr.dir.x86=${depends.dir}/libs/windows.x86
 msvcr.dll.x86=${msvcr.dir.x86}/msvcr71.dll
 msvcr.url.x86=file:///${hyenv.SystemRoot}/system32/msvcr71.dll
@@ -119,26 +113,6 @@
 mx4j.jar=${mx4j.dir}/mx4j.jar
 mx4j.remote.jar=${mx4j.dir}/mx4j-remote.jar
 
-yoko.dir=${depends.jars}/yoko-1.0-SNAPSHOT-20080304
-yoko.jar=${yoko.dir}/yoko.jar
-yoko.url=http://people.apache.org/maven-snapshot-repository/org/apache/yoko/yoko-spec-corba/1.0-SNAPSHOT/yoko-spec-corba-1.0-20080304.193341-1.jar
-yoko.md5=884ac35840a92d13efa155812bfe54a9
-
-yoko-core.dir=${depends.jars}/yoko-1.0-SNAPSHOT-20080304
-yoko-core.jar=${yoko.dir}/yoko-core.jar
-yoko-core.url=http://people.apache.org/maven-snapshot-repository/org/apache/yoko/yoko-core/1.0-SNAPSHOT/yoko-core-1.0-20080304.193341-1.jar
-yoko-core.md5=03638ebf8c1da647ad64412a2c5fb2f4
-
-yoko-rmi-impl.dir=${depends.jars}/yoko-1.0-SNAPSHOT-20080304
-yoko-rmi-impl.jar=${yoko-rmi-impl.dir}/yoko-rmi-impl.jar
-yoko-rmi-impl.url=http://people.apache.org/maven-snapshot-repository/org/apache/yoko/yoko-rmi-impl/1.0-SNAPSHOT/yoko-rmi-impl-1.0-20080304.193341-1.jar
-yoko-rmi-impl.md5=4a45c7a0308227a46fd3ef675c6fde6c
-
-yoko-rmi-spec.dir=${depends.jars}/yoko-1.0-SNAPSHOT-20080304
-yoko-rmi-spec.jar=${yoko-rmi-spec.dir}/yoko-rmi-spec.jar
-yoko-rmi-spec.url=http://people.apache.org/maven-snapshot-repository/org/apache/yoko/yoko-rmi-spec/1.0-SNAPSHOT/yoko-rmi-spec-1.0-20080304.193341-1.jar
-yoko-rmi-spec.md5=8ef16849448ecccabc0f1aac8b840e9c
-
 # bcel is needed by yoko-rmi
 bcel.version=5.2
 bcel.base=bcel-${bcel.version}
diff --git a/common_resources/make/depends.xml b/common_resources/make/depends.xml
index 165781e..04c8229 100644
--- a/common_resources/make/depends.xml
+++ b/common_resources/make/depends.xml
@@ -38,126 +38,17 @@
       </filterchain>
     </loadproperties>
 
-    <macrodef name="poll-modules" 
-        description="directory-based macros for polling sub-builds">
-        <attribute name="target" />
-        <attribute name="dir" />
-        <attribute name="includes" default="${build.module}"/>
-        <attribute name="excludes" default="${exclude.module}"/>
-        <attribute name="antfile" default="*.xml"/>
-        <sequential>
-            <!-- convert dirset pattern to fileset pattern-->
-            <property name="@{dir}.loc" location="@{dir}"/>
-            <pathconvert property="list.@{dir}.@{target}" 
-                pathsep="${file.separator}@{antfile}," setonempty="no">
-                <path>
-                    <dirset dir="@{dir}"
-                            includes="@{includes}"
-                            excludes="@{excludes}">
-                        <exclude name=".*" />
-                    </dirset>
-                </path>
-                <map from="${@{dir}.loc}${file.separator}" to=""/>
-            </pathconvert>
-            <!-- append antfile suffix to last item in the list, if any -->
-            <condition property="poll.@{dir}.@{target}"
-                value="${list.@{dir}.@{target}}${file.separator}@{antfile}" 
-                else="">
-                <isset property="list.@{dir}.@{target}"/>
-            </condition>
-            <poll-build target="@{target}" dir="@{dir}" 
-                includes="${poll.@{dir}.@{target}}"/>
-        </sequential>
-    </macrodef>
+    <loadproperties srcfile="${basedir}/make/depends.properties">
+      <filterchain>
+        <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
+            <param type="token" name="${hy.arch}" value=""/>
+            <param type="token" name="${hy.os.family}" value=""/>
+            <param type="token" name="${hy.platform}" value=""/>
+            <param type="token" name="${hy.platform.variant}" value=""/>
+        </filterreader>
+      </filterchain>
+    </loadproperties>
 
-    <macrodef name="poll-build"
-        description="plain-filter macros for polling sub-builds">
-        <attribute name="target" />
-        <attribute name="dir" />
-        <attribute name="includes" default="**/*.xml"/>
-        <attribute name="excludes" default=""/>
-        <sequential>
-            <echo message="polling @{includes}"/>
-            <subant target="@{target}">
-                <fileset dir="@{dir}" includes="@{includes}" excludes="@{excludes}">
-                    <containsregexp expression="&lt;target[^&gt;]*name=&quot;@{target}&quot;"/>
-                </fileset>
-            </subant>
-        </sequential>
-    </macrodef>
-
-    <target name="fetch">
-        <fetch dep="${dependency}"/>
-    </target>
-    
-    <macrodef name="fetch">
-        <attribute name="dep" />
-        <sequential>
-            <dirname file="${@{dep}}" property="@{dep}.dir"/>
-            <mkdir dir="${@{dep}.dir}"/>
-            <download-one-file dest="${@{dep}}" 
-                src="${@{dep}.url}" md5="${@{dep}.md5}"/>
-            <unzip-one-file dep="@{dep}"/>
-        </sequential>
-    </macrodef>
-    
-    <target name="-really-unzip" unless="unzipped" if="unzip.path">
-        <tempfile destdir="${dest}" property="tmp"/>
-        <unzip src="${src}" dest="${tmp}" >
-            <patternset includes="${unzip.path}"/>
-        </unzip>
-        <touch>
-            <fileset dir="${tmp}">
-                <patternset includes="${unzip.path}"/>
-            </fileset>
-        </touch>
-        <move todir="${dest}" flatten="yes" failonerror="no">
-            <fileset dir="${tmp}">
-                <patternset includes="${unzip.path}"/>
-            </fileset>
-        </move>
-        <delete dir="${tmp}" />
-    </target>
-    
-    <macrodef name="unzip-one-file">
-        <attribute name="dep" />
-        <sequential>
-            <dirname file="${@{dep}}" property="@{dep}.dir"/>
-            <!-- quite tricky way to detect if unzip operation is pending,
-                still not very robust ...
-                Life could be simpler if unzip supported nested mappers
-            -->
-            <basename file="${@{dep}}" property="@{dep}.basename"/>
-            <basename file="${@{dep}.unzip.path}" property="@{dep}.unzip.basename"/>
-            <pathconvert property="@{dep}.matching.list" setonempty="no">
-                <path><fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}"/></path>
-            </pathconvert>
-            <pathconvert property="@{dep}.uptodate.list" setonempty="no">
-                <path>
-                    <fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}">
-                        <depend targetdir="${@{dep}.dir}">
-                            <mapper type="merge" to="${@{dep}.basename}"/>
-                        </depend>
-                    </fileset>
-                </path>
-            </pathconvert>
-            <condition property="@{dep}.unzipped">
-                <equals arg1="${@{dep}.uptodate.list}" arg2="${@{dep}.matching.list}"/>
-                <!--uptodate srcfile="${@{dep}}"
-                        targetfile="${@{dep}.dir}/${@{dep}.unzip.basename}"/-->
-            </condition>
-
-            <antcall target="-really-unzip">
-                <param name="src" value="${@{dep}}" />
-                <param name="dest" value="${@{dep}.dir}" />
-                <propertyset>
-                  <propertyref prefix="@{dep}.unzip"/>
-                  <globmapper from="@{dep}.*" to="*"/>
-                </propertyset>
-            </antcall>
-        </sequential>
-    </macrodef>
-    
     <macrodef name="download-one-file">
         <attribute name="src" />
         <attribute name="dest" />
@@ -238,6 +129,32 @@
         </sequential>
     </macrodef>
 
+    <macrodef name="check-os-file">
+        <attribute name="src" />
+        <attribute name="message" />
+        <sequential>
+            <echo level="info">Checking for system file @{src}</echo>
+            <available file="@{src}" type="file"
+                       property="@{src}.exists" />
+            <fail>
+                <condition>
+                    <not>
+                        <isset property="@{src}.exists" />
+                    </not>
+                </condition>
+...
+
+Missing dependency.  The system file:
+
+  @{src}
+
+is missing.
+
+@{message}
+            </fail>
+        </sequential>
+    </macrodef>
+
     <macrodef name="check-one-link">
         <attribute name="src" />
         <attribute name="dest" />
@@ -284,15 +201,76 @@
         <symlink resource="${src}" link="${dest}" />
     </target>
 
+    <target name="fetch">
+        <fetch dep="${dependency}"/>
+    </target>
     
-    <!--macrodef name="chksum">
-        <attribute name="file" />
-        <attribute name="type" default="md5" />
+    <macrodef name="fetch">
+        <attribute name="dep" />
         <sequential>
-            <checksum property="@{file}.@{type}" file="@{file}"
-                      algorithm="@{type}" />
-            <echo file="@{file}.@{type}"
-                  message="${@{file}.@{type}}  @{file}${line.separator}" />
+            <dirname file="${@{dep}}" property="@{dep}.dir"/>
+            <mkdir dir="${@{dep}.dir}"/>
+            <download-one-file dest="${@{dep}}" 
+                src="${@{dep}.url}" md5="${@{dep}.md5}"/>
+            <unzip-one-file dep="@{dep}"/>
         </sequential>
-    </macrodef-->
+    </macrodef>
+    
+    <target name="-really-unzip" unless="unzipped" if="unzip.path">
+        <tempfile destdir="${dest}" property="tmp"/>
+        <unzip src="${src}" dest="${tmp}" >
+            <patternset includes="${unzip.path}"/>
+        </unzip>
+        <touch>
+            <fileset dir="${tmp}">
+                <patternset includes="${unzip.path}"/>
+            </fileset>
+        </touch>
+        <move todir="${dest}" flatten="yes" failonerror="no">
+            <fileset dir="${tmp}">
+                <patternset includes="${unzip.path}"/>
+            </fileset>
+        </move>
+        <delete dir="${tmp}" />
+    </target>
+
+    <macrodef name="unzip-one-file">
+        <attribute name="dep" />
+        <sequential>
+            <dirname file="${@{dep}}" property="@{dep}.dir"/>
+            <!-- quite tricky way to detect if unzip operation is pending,
+                still not very robust ...
+                Life could be simpler if unzip supported nested mappers
+            -->
+            <basename file="${@{dep}}" property="@{dep}.basename"/>
+            <basename file="${@{dep}.unzip.path}" property="@{dep}.unzip.basename"/>
+            <pathconvert property="@{dep}.matching.list" setonempty="no">
+                <path><fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}"/></path>
+            </pathconvert>
+            <pathconvert property="@{dep}.uptodate.list" setonempty="no">
+                <path>
+                    <fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}">
+                        <depend targetdir="${@{dep}.dir}">
+                            <mapper type="merge" to="${@{dep}.basename}"/>
+                        </depend>
+                    </fileset>
+                </path>
+            </pathconvert>
+            <condition property="@{dep}.unzipped">
+                <equals arg1="${@{dep}.uptodate.list}" arg2="${@{dep}.matching.list}"/>
+                <!--uptodate srcfile="${@{dep}}"
+                        targetfile="${@{dep}.dir}/${@{dep}.unzip.basename}"/-->
+            </condition>
+
+            <antcall target="-really-unzip">
+                <param name="src" value="${@{dep}}" />
+                <param name="dest" value="${@{dep}.dir}" />
+                <propertyset>
+                  <propertyref prefix="@{dep}.unzip"/>
+                  <globmapper from="@{dep}.*" to="*"/>
+                </propertyset>
+            </antcall>
+        </sequential>
+    </macrodef>
+
 </project>
diff --git a/common_resources/make/platform.xml b/common_resources/make/platform.xml
index b15bb5b..c8555b1 100644
--- a/common_resources/make/platform.xml
+++ b/common_resources/make/platform.xml
@@ -183,7 +183,29 @@
         <isset property="is.ppc32" />
     </condition>
     <property name="hy.arch" value="${os.arch}" />
-    
+
+    <condition property="hy.arch.family" value="x86">
+        <or>
+            <isset property="is.x86" />
+            <isset property="is.x86_64" />
+        </or>
+    </condition>
+    <condition property="hy.arch.family" value="ia64">
+        <isset property="is.ia64" />
+    </condition>
+    <condition property="hy.arch.family" value="ppc">
+        <or>
+            <isset property="is.ppc32" />
+            <isset property="is.ppc64" />
+        </or>
+    </condition>
+    <condition property="hy.arch.family" value="s390">
+        <or>
+            <isset property="is.s390" />
+            <isset property="is.s390x" />
+        </or>
+    </condition>
+
     <!-- Normalized platform name -->
     <property name="hy.platform" value="${hy.os}.${hy.arch}"/>
     <property name="hy.platform.path" value="${hy.os}/${hy.arch}"/>
@@ -254,8 +276,19 @@
         <or>
             <isset property="is.aix"/>
             <isset property="is.freebsd"/>
+            <isset property="is.zos"/>
         </or>
     </condition>
     <property name="make.command" value="make" />
 
+    <condition property="make.arg" value="/nologo">
+        <isset property="is.windows"/>
+    </condition>
+    <property name="make.arg" value="-r" />
+
+    <condition property="make.suffix" value="mak">
+        <isset property="is.windows"/>
+    </condition>
+    <property name="make.suffix" value="mk" />
+
 </project>
diff --git a/common_resources/make/properties.xml b/common_resources/make/properties.xml
index 7917424..d92579f 100644
--- a/common_resources/make/properties.xml
+++ b/common_resources/make/properties.xml
@@ -26,17 +26,40 @@
 
     <property file="${user.home}/.harmony.properties" />
     <dirname property="common.basedir"
-             file="${ant.file.Common property definitions}/.."/>
+             file="${ant.file.Common property definitions}"/>
 
-    <import file="${common.basedir}/make/platform.xml"/>
-    <import file="${common.basedir}/make/svn.xml"/>
+    <import file="${common.basedir}/platform.xml"/>
+    <import file="${common.basedir}/svn.xml"/>
 
+    <fail message="Property 'hy.target' is not defined">
+        <condition>
+            <not><isset property="hy.target" /></not>
+        </condition>
+    </fail>
+    <fail message="Property 'hy.component' is not defined">
+        <condition>
+            <not><isset property="hy.component" /></not>
+        </condition>
+    </fail>
+    <fail message="Property 'hy.module' is not defined">
+        <condition>
+            <not><isset property="hy.module" /></not>
+        </condition>
+    </fail>
+    <property name="hy.hdk" location="${hy.target}/hdk" />
+    <property name="hy.jdk" location="${hy.hdk}/jdk" />
+    <property name="hy.jre" location="${hy.jdk}/jre" />
+    <property name="hy.build.root" location="${hy.target}/build" />
+    <property name="hy.build" location="${hy.build.root}/${hy.component}" />
+    <property name="hy.build.top" location="${hy.build}/toplevel" />
+    <property name="hy.build.mod" location="${hy.build}/${hy.module}" />
 
-    <!-- Root directory of the common dependemcy pool -->
-    <property name="base.dep.dir" location="${common.basedir}/depends"/>
+    <!-- Root directory of the common dependency pool -->
+    <property name="depends.dir" location="${hy.target}/depends" />
 
     <!-- Debug or release version -->
     <property name="hy.cfg" value="debug" />
+    <property name="hy.specification.version" value="1.5" />
 
     <!-- Javac properties -->
     <!-- Explicitly set to ECJ as the default compiler. -->
@@ -45,18 +68,20 @@
     <property name="hy.javac.source" value="1.5" />
     <property name="hy.javac.target" value="1.5" />
     <property name="hy.javac.maxmem" value="384M" />
+    <property name="build.compilerarg" value="-nowarn" />
 
     <!-- Temporarily always include class file debug info -->
     <condition property="hy.javac.debug" value="on" else="on">
         <equals arg1="${hy.cfg}" arg2="debug" />
     </condition>
 
-    <!-- Local variable tables should be available in debug, and
-         omitted in release modes. -->
-    <condition property="build.compilerarg" value="-nowarn -g"
-               else="-nowarn -g:lines,source">
+    <!-- Include only stack trace information into release build -->
+    <condition property="hy.javac.debuglevel" value="lines,vars,source"
+               else="lines,source">
         <equals arg1="${hy.cfg}" arg2="debug" />
     </condition>
+    <property name="hy.jar.compress" value="true" />
+
 
     <!-- During packaging, these files must be copied into the meta-inf dir -->
     <fileset id="hy.required.metainf-files" dir="${hy.hdk}">
@@ -68,6 +93,89 @@
     <property name="hy.test.forkmode" value="once" />
     <property name="hy.test.timeout" value="900000" />
     <property name="hy.test.vmargs" value="" />
+    <condition property="hy.run.impl.tests" value="true">
+        <istrue value="${hy.test.impl}" />
+    </condition>
+
+    <condition property="png.home" value="/usr/local">
+        <isset property="is.freebsd"/>
+    </condition>
+    <condition property="png.home" value="/opt/local">
+        <isset property="is.macosx"/>
+    </condition>
+    <property name="png.home" value="/usr" />
+
+    <condition property="lcms.home" value="/usr/local">
+        <isset property="is.freebsd"/>
+    </condition>
+    <condition property="lcms.home" value="/opt/local">
+        <isset property="is.macosx"/>
+    </condition>
+    <property name="lcms.home" value="/usr" />
+
+    <condition property="jpeg.home" value="/usr/local">
+        <isset property="is.freebsd"/>
+    </condition>
+    <condition property="jpeg.home" value="/opt/local">
+        <isset property="is.macosx"/>
+    </condition>
+    <property name="jpeg.home" value="/usr" />
+    
+    <condition property="is.select" value="true">
+        <istrue value="${hy.select}" />
+    </condition>
+    <condition property="is.not.select" value="true">
+        <not><istrue value="${hy.select}" /></not>
+    </condition>
+
+    <!-- default property for poll-modules macro - i.e. all modules -->
+    <property name="build.module" value="*" />
+    <condition property="exclude.module"
+            value="accessibility,applet,awt,imageio,orb,print,rmi,sound,swing">
+        <istrue value="${hy.select}" />
+    </condition>
+    <property name="exclude.module" value="nothing" />
+    <property name="build.java" value="true" />
+    <property name="build.native" value="true" />
+    <property name="build.test" value="true" />
+    <condition property="skip.java.build" value="true">
+        <equals arg1="${build.java}" arg2="false" />
+    </condition>
+    <condition property="skip.native.build" value="true">
+        <equals arg1="${build.native}" arg2="false" />
+    </condition>
+    <condition property="skip.test.build" value="true">
+        <equals arg1="${build.test}" arg2="false" />
+    </condition>
+
+    <!-- flags -->
+    <property name="hy.no.thr" value="false" />
+    <condition property="hy.skip.thr" value="true">
+        <istrue value="${hy.no.thr}" />
+    </condition>
+
+    <property name="hy.thr.no.deploy" value="false" />
+    <condition property="hy.thr.deploy" value="true">
+        <equals arg1="${hy.thr.no.deploy}" arg2="false" />
+    </condition>
+
+    <property name="hy.local.zlib" value="false" />
+    <condition property="hy.skip.zlib" value="true">
+        <istrue value="${hy.local.zlib}" />
+    </condition>
+
+    <property name="hy.zip.api" value="false" />
+    <condition property="hy.skip.zip.api" value="true">
+        <isfalse value="${hy.zip.api}" />
+     </condition>
+
+    <condition property="hy.portlib.stubs" value="true">
+        <or>
+            <equals arg1="${hy.os}" arg2="aix" />
+            <equals arg1="${hy.os}" arg2="zos" />
+        </or>
+    </condition>
+    <property name="hy.portlib.stubs" value="false" />
 
     <condition property="hy.platform.suffix" value=".libstdc++5">
         <isset property="use.libstdc++5"/>
@@ -92,63 +200,40 @@
     <property name="hy.platform.variant"
               value="${hy.platform}${hy.platform.suffix}" />
 
-    <condition property="png.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="png.home" value="/sw">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="png.home" value="/usr" />
+    <!-- fileset to represent classes built by a module. -->
+    <fileset id="classes" dir="${hy.build.top}/java">
+        <includesfile name="${hy.hdk}/build/ant/patternsets/${hy.module}.txt" />
+    </fileset>
 
-    <condition property="lcms.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="lcms.home" value="/sw">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="lcms.home" value="/usr" />
+    <!-- fileset for resources of a module. -->
+    <fileset id="resources" dir="src/main/java">
+        <exclude name="**/*.java" />
+    </fileset>
 
-    <condition property="jpeg.home" value="/usr/local">
-        <isset property="is.freebsd"/>
-    </condition>
-    <condition property="jpeg.home" value="/sw">
-        <isset property="is.macosx"/>
-    </condition>
-    <property name="jpeg.home" value="/usr" />
-    
-    <!-- default property for call-modules macro - i.e. all modules -->
-    <property name="build.module" value="*" />
-    <property name="exclude.module" value="nothing" />
+    <!-- fileset for resources of a module with platform-dependent code. -->
+    <fileset id="common.resources" dir="src/main/java/common">
+        <exclude name="**/*.java" />
+    </fileset>
 
-    <!-- names of exclude lists, used by prepare-exclude-list macro -->
-    <property name="common.exclude.file" value="exclude.common" />
-    <property name="common.exclude.interm" value="exclude.interm" />
-    <property name="platform.exclude.file"
-              value="exclude.${hy.platform}.${hy.test.vm.name}" />
-    <property name="platform.exclude.interm"
-              value="exclude.${hy.platform}.${hy.test.vm.name}.interm" />
+    <!-- test properties -->
+    <property name="tests.output" location="../../build/test_report" />
+    <property name="tests.hdk.dir" value="${hy.hdk}/build/test/${hy.module}" />
+    <property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" />
+    <property name="tests.resources.hdk.dir"
+              value="${tests.hdk.dir}/resources" />
 
-    <!-- flags -->
-    <property name="hy.no.thr" value="false" />
-    <condition property="hy.skip.thr" value="true">
-        <not>
-            <equals arg1="${hy.no.thr}" arg2="false" />
-        </not>
-    </condition>
+    <property name="findBugs.report" location="../../build/findbugs_report" />
 
-    <property name="hy.local.zlib" value="false" />
-    <condition property="hy.skip.zlib" value="true">
-        <not>
-            <equals arg1="${hy.local.zlib}" arg2="false" />
-        </not>
-    </condition>
-
-    <property name="hy.zip.api" value="false" />
-    <condition property="hy.skip.zip.api" value="true">
-        <not>
-            <equals arg1="${hy.zip.api}" arg2="true" />
-        </not>
-     </condition>
+    <propertyset id="module.props">
+        <propertyref name="hy.component" />
+        <propertyref name="hy.cfg" />
+        <propertyref name="hy.test.vm.name" />
+        <propertyref name="svn.revision" />
+        <propertyref name="svn.info" />
+        <propertyref name="hy.no.thr" />
+        <propertyref name="hy.zip.api" />
+        <propertyref name="hy.select" />
+    </propertyset>
 
     <target name="echo" depends="-svn-info, test-jre-vm-info"
             description="Display the properties defined by this ant file" >
@@ -172,6 +257,7 @@
     hy.test.timeout = ${hy.test.timeout}
     hy.test.vm.name = ${hy.test.vm.name}
     hy.test.vmargs = ${hy.test.vmargs}
+    findbugs.available = ${findbugs.available}
 
 Harmony platform properties:
 
@@ -205,7 +291,8 @@
   make.command = ${make.command}
 
   hy.hdk = ${hy.hdk}
-
+  hy.jdk = ${hy.jdk}
+  hy.jre = ${hy.jre}
 
 The following properties are only set if the "-svn-info" target has been
 called:
@@ -232,14 +319,14 @@
         </condition>
         <!-- FIXME current behavior relies on the fact that J9 VM doesn't
              support -version parameter -->
-        <condition property="hy.test.vm.name" value="drl" else="ibm" >
-            <contains string="${test.vm.info.tmp}" substring="harmony" />
+        <condition property="hy.test.vm.name" value="ibm" else="drl" >
+            <contains string="${test.vm.info.tmp}" substring="IBM" casesensitive="false" />
         </condition>
         <echo level="info" message="hy.test.vm.name = ${hy.test.vm.name}" />
     </target>
 
     <target name="-get-test-vm-output">
-        <condition property="test.jre.home" value="${hy.jdk}/jre">
+        <condition property="test.jre.home" value="${hy.jre}">
             <not><isset property="test.jre.home" /></not>
         </condition>
         <exec executable="${test.jre.home}/bin/java" failifexecutionfails="false">
@@ -248,24 +335,57 @@
         </exec>
     </target>
 
-    <macrodef name="call-modules">
+    <macrodef name="poll-modules" 
+        description="directory-based macros for polling sub-builds">
         <attribute name="target" />
+        <attribute name="dir" default="modules" />
+        <attribute name="includes" default="${build.module}"/>
+        <attribute name="excludes" default="${exclude.module}"/>
+        <attribute name="antfile" default="*.xml"/>
         <sequential>
-            <subant target="@{target}">
-                <property name="hy.test.vm.name" value="${hy.test.vm.name}"/>
-                <dirset dir="modules"
-                        includes="${build.module}"
-                        excludes="${exclude.module}">
-                    <exclude name=".*" />
-                </dirset>
-            </subant>
+            <!-- convert dirset pattern to fileset pattern-->
+            <property name="@{dir}.loc" location="@{dir}"/>
+            <pathconvert property="list.@{dir}.@{target}" 
+                pathsep="${file.separator}@{antfile}," setonempty="no">
+                <path>
+                    <dirset dir="@{dir}"
+                            includes="@{includes}"
+                            excludes="@{excludes}">
+                        <exclude name=".*" />
+                    </dirset>
+                </path>
+                <map from="${@{dir}.loc}${file.separator}" to=""/>
+            </pathconvert>
+            <!-- append antfile suffix to last item in the list, if any -->
+            <condition property="poll.@{dir}.@{target}"
+                value="${list.@{dir}.@{target}}${file.separator}@{antfile}" 
+                else="">
+                <isset property="list.@{dir}.@{target}"/>
+            </condition>
+            <poll-build target="@{target}" dir="@{dir}" 
+                includes="${poll.@{dir}.@{target}}"/>
         </sequential>
     </macrodef>
 
-    <condition property="make.arg" value="/nologo">
-        <isset property="is.windows"/>
-    </condition>
-    <property name="make.arg" value="" />
+    <macrodef name="poll-build"
+        description="plain-filter macros for polling sub-builds">
+        <attribute name="target" />
+        <attribute name="dir" />
+        <attribute name="includes" default="**/*.xml"/>
+        <attribute name="excludes" default=""/>
+        <sequential>
+            <echo message="polling @{includes}"/>
+            <subant target="@{target}">
+                <!-- TODO: modules probably need to work these properties
+                     out for themselves in order to reduce coupling -->
+                <property name="hy.target" location="${hy.target}"/>
+                <propertyset refid="module.props" />
+                <fileset dir="@{dir}" includes="@{includes}" excludes="@{excludes}">
+                    <containsregexp expression="&lt;target[^&gt;]*name=&quot;@{target}&quot;"/>
+                </fileset>
+            </subant>
+        </sequential>
+    </macrodef>
 
     <macrodef name="make">
         <attribute name="dir" />
@@ -273,10 +393,25 @@
         <element name="make-elements" optional="true" />
         <sequential>
             <echo>Making "@{target}" in @{dir}</echo>
+            <echo file="${hy.hdk}/build/make/properties.${make.suffix}">
+HY_ZIP_API=${hy.zip.api}
+HY_PORTLIB_STUBS=${hy.portlib.stubs}
+HY_CFG=${hy.cfg}
+HY_ARCH=${hy.arch}
+HY_ARCH_FAMILY=${hy.arch.family}
+HY_OS=${hy.os}
+HY_PLATFORM=${hy.platform}
+HY_NO_THR=${hy.no.thr}
+HY_THR_NO_DEPLOY=${hy.thr.no.deploy}
+HY_LOCAL_ZLIB=${hy.local.zlib}
+HY_SHLIB_SUFFIX=${shlib.suffix}
+HY_LINKLIB_SUFFIX=${linklib.suffix}
+            </echo>                
             <exec failonerror="true"
                   executable="${make.command}"
                   dir="@{dir}">
                 <env key="HY_HDK" value="${hy.hdk}" />
+                <env key="HY_TARGET" value="${hy.target}" />
                 <arg line="${make.arg}" />
                 <arg line="@{target}" />
                 <make-elements />
@@ -305,6 +440,14 @@
     </macrodef>
     <convert-test from="test.case" to="converted.tc" />
     
+    <!-- names of exclude lists, used by prepare-exclude-list macro -->
+    <property name="common.exclude.file" value="exclude.common" />
+    <property name="common.exclude.interm" value="exclude.interm" />
+    <property name="platform.exclude.file"
+              value="exclude.${hy.platform}.${hy.test.vm.name}" />
+    <property name="platform.exclude.interm"
+              value="exclude.${hy.platform}.${hy.test.vm.name}.interm" />
+
     <!-- Concatenate several exclude lists into single list -->
     <macrodef name="prepare-exclude-list">
        <attribute name="moduleName"/>
@@ -396,9 +539,383 @@
                 <attribute name="Implementation-URL"
                            value="http://harmony.apache.org"/>
                 <attribute name="Implementation-Version" value="${svn.info}"/> 
+                <attribute name="Specification-Vendor"
+                           value="Sun Microsystems, Inc." />
+                <attribute name="Specification-Title"
+                           value="Java Platform API Specification" />
+                <attribute name="Specification-Version"
+                           value="${hy.specification.version}" />
             </manifest>
             <metainf refid="hy.required.metainf-files"/>
         </jar>
     </presetdef>
+   
+    <macrodef name="compile-classes">
+        <attribute name="description" default="" />
+        <attribute name="destdir" default="${hy.build.top}/java" />
+        <element name="javac-elements" />
+        <sequential>
+            <echo message="Compiling @{description}" />
+            
+            <mkdir dir="@{destdir}" />
+
+            <hy.javac sourcepath="" destdir="@{destdir}">
+                <javac-elements />
+                <compilerarg line="${build.compilerarg}" />
+                <bootclasspath>
+                    <fileset dir="${hy.jre}/lib/boot">
+                        <include name="**/*.jar" />
+                    </fileset>
+                </bootclasspath>
+            </hy.javac>
+        </sequential>
+    </macrodef>
+
+    <macrodef name="compile-tests">
+        <attribute name="description" default="" />
+        <attribute name="destdir" default="${hy.build.mod}/test/api" />
+        <element name="javac-elements" />
+        <sequential>
+            <echo message="Compiling @{description}" />
+            
+            <mkdir dir="@{destdir}" />
+
+            <mkdir dir="${hy.hdk}/build/test" />
+            <copy file="${junit.jar}"
+                  tofile="${hy.hdk}/build/test/junit.jar" />
+            <copy file="${hamcrest-library.jar}"
+                  tofile="${hy.hdk}/build/test/hamcrest-library.jar" />
+            
+            <hy.javac destdir="@{destdir}">
+
+                <javac-elements />
+
+                <compilerarg line="${build.compilerarg}" />
+
+                <bootclasspath>
+                    <fileset dir="${hy.jre}/lib/boot">
+                        <include name="**/*.jar" />
+                    </fileset>
+                </bootclasspath>
+
+                <classpath location="${hy.build.top}/java" />
+                <classpath location="${hy.hdk}/build/test/junit.jar" />
+                <classpath
+                     location="${hy.hdk}/build/test/hamcrest-library.jar" />
+                <classpath location="${hy.hdk}/build/test/support.jar" />
+            </hy.javac>
+        </sequential>
+    </macrodef>
+
+    <macrodef name="run-hdk-tests">
+        <attribute name="module" />
+        <attribute name="jar" />
+        <element name="junit-elements" optional="true"/>
+        <element name="excludeorinclude" optional="true"/>
+        <sequential>
+            <echo message="Running @{module} Unit Test from @{jar}" />
+            <echo message="Tested jre: ${test.jre.home}/bin/java" />
+            <property name="test.module.dir" value="${hy.target}/@{module}" />
+            <property name="test.excludes.dir" value="${test.module.dir}/excludes" />
+            <property name="test.resources.dir" value="${test.module.dir}/resources" />
+            <property name="module.work.dir" location="${work.dir}/@{module}" />
+            <property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
+
+            <property name="module.temp.dir"
+                      location="${work.dir}/@{module}/temp" />
+            <property name="junit.tempdir"
+                      location="${module.temp.dir}/ant" />
+            <property name="junit.java.io.tmpdir"
+                      location="${module.temp.dir}/tmpdir" />
+            <property name="junit.user.home"
+                      location="${module.temp.dir}/user" />
+            
+            <mkdir dir="${tests.output}" /> 
+            <mkdir dir="${junit.tempdir}" />
+            <mkdir dir="${junit.java.io.tmpdir}" />
+            <mkdir dir="${junit.user.home}" />
+
+            <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
+            <junit fork="yes" 
+                   forkmode="${hy.test.forkmode}" 
+                   timeout="${hy.test.timeout}" 
+                   printsummary="withOutAndErr" 
+                   errorproperty="test.errors" 
+                   failureproperty="test.failures" 
+                   showoutput="on" 
+                   dir="${work.dir}/@{module}" 
+                   tempdir="${junit.tempdir}"
+                   jvm="${test.jre.home}/bin/java">
+
+                <jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
+                <jvmarg line="-Duser.home=${junit.user.home}" />
+
+                <classpath>
+                    <fileset dir="${hy.target}">
+                        <include name="*.jar" />
+                    </fileset>
+                    <pathelement path="${test.resources.dir}/" />
+                    <pathelement path="${test.module.dir}/" />
+                    <pathelement location="${test.module.dir}/@{jar}" />
+                </classpath>
+
+                <junit-elements />
+
+                <batchtest todir="${tests.output}" haltonfailure="no">
+                    <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
+                        <exclude name="Test.class" />
+                        <exclude name="**/*$*" />
+
+                        <!-- if ${test.case}     -->
+                        <include name="${converted.tc.class}" if="test.case" />
+                        <!-- unless ${test.case} -->
+                        <include name="**/*Test.class" unless="test.case" />
+                        <excludesfile name="${test.exclude.file}" unless="test.case"/>
+                        <excludeorinclude/>
+                    </zipfileset>
+                </batchtest>
+
+                <assertions enableSystemAssertions="true">
+                    <enable />
+                </assertions>
+
+                <jvmarg line="${hy.test.vmargs}" />
+                <!-- Used by Support_Exec.execJava() -->
+                <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
+
+                <formatter type="xml" />
+            </junit>
+
+            <delete dir="${module.temp.dir}"
+                    includeemptydirs="true" failonerror="false" />
+
+            <antcall target="touch-failures-file">
+                <param name="module" value="@{module}" />
+            </antcall>
+            <antcall target="touch-errors-file">
+                <param name="module" value="@{module}" />
+            </antcall>
+
+        </sequential>
+    </macrodef>
+
+    <!-- TOFIX: Can't seem to override the line:
+             <include name="**/*Test.class" unless="test.case" />
+         so this is just run-hdk-tests without that line -->
+    <macrodef name="run-selected-hdk-tests">
+        <attribute name="module" />
+        <attribute name="jar" />
+        <element name="junit-elements" optional="true"/>
+        <element name="excludeorinclude" optional="true"/>
+        <sequential>
+            <echo message="Running @{module} Unit Test from @{jar}" />
+            <echo message="Tested jre: ${test.jre.home}/bin/java" />
+            <property name="test.module.dir" value="${hy.target}/@{module}" />
+            <property name="test.excludes.dir" value="${test.module.dir}/excludes" />
+            <property name="test.resources.dir" value="${test.module.dir}/resources" />
+            <property name="module.work.dir" location="${work.dir}/@{module}" />
+            <property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
+
+            <property name="module.temp.dir"
+                      location="${work.dir}/@{module}/temp" />
+            <property name="junit.tempdir"
+                      location="${module.temp.dir}/ant" />
+            <property name="junit.java.io.tmpdir"
+                      location="${module.temp.dir}/tmpdir" />
+            <property name="junit.user.home"
+                      location="${module.temp.dir}/user" />
+            
+            <mkdir dir="${tests.output}" /> 
+            <mkdir dir="${junit.tempdir}" />
+            <mkdir dir="${junit.java.io.tmpdir}" />
+            <mkdir dir="${junit.user.home}" />
+
+            <prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
+            <junit fork="yes" 
+                   forkmode="${hy.test.forkmode}" 
+                   timeout="${hy.test.timeout}" 
+                   printsummary="withOutAndErr" 
+                   errorproperty="test.errors" 
+                   failureproperty="test.failures" 
+                   showoutput="on" 
+                   dir="${work.dir}/@{module}" 
+                   tempdir="${junit.tempdir}"
+                   jvm="${test.jre.home}/bin/java">
+
+                <jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
+                <jvmarg line="-Duser.home=${junit.user.home}" />
+
+                <classpath>
+                    <fileset dir="${hy.target}">
+                        <include name="*.jar" />
+                    </fileset>
+                    <pathelement path="${test.resources.dir}/" />
+                    <pathelement path="${test.module.dir}/" />
+                    <pathelement location="${test.module.dir}/@{jar}" />
+                </classpath>
+
+                <junit-elements />
+
+                <batchtest todir="${tests.output}" haltonfailure="no">
+                    <zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
+                        <exclude name="Test.class" />
+                        <exclude name="**/*$*" />
+
+                        <!-- if ${test.case}     -->
+                        <include name="${converted.tc.class}" if="test.case" />
+                        <!-- unless ${test.case} -->
+                        <excludesfile name="${test.exclude.file}" unless="test.case"/>
+                        <excludeorinclude/>
+                    </zipfileset>
+                </batchtest>
+
+                <assertions enableSystemAssertions="true">
+                    <enable />
+                </assertions>
+
+                <jvmarg line="${hy.test.vmargs}" />
+                <!-- Used by Support_Exec.execJava() -->
+                <jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
+
+                <formatter type="xml" />
+            </junit>
+
+            <delete dir="${module.temp.dir}"
+                    includeemptydirs="true" failonerror="false" />
+
+            <antcall target="touch-failures-file">
+                <param name="module" value="@{module}" />
+            </antcall>
+            <antcall target="touch-errors-file">
+                <param name="module" value="@{module}" />
+            </antcall>
+
+        </sequential>
+    </macrodef>
+
+    <target name="touch-failures-file" if="test.failures">
+        <echo file="${tests.output}/test.failures"
+            append="true">${module}${line.separator}</echo>
+    </target>
+
+    <target name="touch-errors-file" if="test.errors">
+        <echo file="${tests.output}/test.errors"
+            append="true">${module}${line.separator}</echo>
+    </target>
+
+    <!-- To use with -Dtest.case=... option                   -->
+    <!-- if ${test.case} is provided in package+class form    -->
+    <!-- it is converted to dir+filename form                 -->
+    <macrodef name="convert-test-as-class">
+        <attribute name="from" />
+        <attribute name="to" />
+        <sequential>
+            <pathconvert property="@{to}" setonempty="no">
+                <path path="${@{from}}" />
+                <chainedmapper>
+                    <filtermapper>
+                        <replaceregex pattern="\.java$$" />
+                    </filtermapper>
+                    <unpackagemapper from="${basedir}${file.separator}*" to="*.class" />
+                </chainedmapper>
+            </pathconvert>
+        </sequential>
+    </macrodef>
+
+    <macrodef name="make-patternset">
+        <attribute name="source" default="src/main" />
+        <attribute name="module" />
+        <attribute name="file"
+                   default="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
+        <sequential>
+            <dirname file="@{file}" property="@{file}.dir" />
+            <mkdir dir="${@{file}.dir}" />
+            <property name="@{source}.loc" location="@{source}"/>
+
+            <pathconvert targetos="unix" property="@{file}.content"
+                         pathsep="${line.separator}">
+                <fileset dir="${@{source}.loc}" includes="java*/**/*.java" />
+                <map from="${@{source}.loc}/java/unix/" to="" />
+                <map from="${@{source}.loc}/java/windows/" to="" />
+                <map from="${@{source}.loc}/java/common/" to="" />
+                <map from="${@{source}.loc}/java5/" to="" />
+                <map from="${@{source}.loc}/java/" to="" />
+                <compositemapper>
+                    <mapper type="regexp" from="^(.*)\.java$$" to="\1.*"/>
+                    <mapper type="regexp" from="^(.*)\.java$$" to="\1$*.*"/>
+                </compositemapper>
+            </pathconvert>
+            <echo message="${@{file}.content}${line.separator}"
+                  file="@{file}" />
+        </sequential>
+    </macrodef>
+
+    <macrodef name="delete-patternset">
+        <attribute name="module" />
+        <sequential>
+            <delete file="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
+        </sequential>
+    </macrodef>
+
+    <macrodef name="run-findBugs">
+       <attribute name="outputFile"/>
+       <attribute name="excludeFilter"/>
+       <attribute name="jarFile"/>
+       <sequential>
+           <!-- Find and define findbugs task -->
+           <property name="findbugs.home" location="${basedir}/../../depends/oss/findbugs-1.3.9"/>
+           <available
+               classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+               classpath="${findbugs.home}/lib/findbugs-ant.jar"
+               property="findbugs.available"/>
+           <taskdef
+               name="findbugs"
+               classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+               classpath="${findbugs.home}/lib/findbugs-ant.jar"
+               onerror="ignore"/>
+          <fail message="FindBugs is unavailable" unless="findbugs.available"/>
+
+          <!-- Run findbugs using the attributes given -->
+          <dirname file="@{outputFile}" property="@{outputFile}.dir" />
+          <mkdir dir="${@{outputFile}.dir}" />
+          <findbugs home="${findbugs.home}"
+            output="xml"
+            outputFile="@{outputFile}"
+            excludeFilter="@{excludeFilter}"
+            jvmargs="-Xmx512M"
+            workhard="true">
+            <auxClasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </auxClasspath>
+            <sourcePath path="src/main/java" />
+            <sourcePath path="src/main/java5" />
+            <sourcePath path="src/main/java/common" />
+            <sourcePath path="src/main/java/${hy.os.family}" />
+            <class location="@{jarFile}" />
+        </findbugs>
+       </sequential>
+    </macrodef>
+
+    <macrodef name="init-hdk">
+        <sequential>
+            <mkdir dir="${hy.hdk}/build/ant" />
+            <copy file="${common.resources}/make/depends.xml"
+                  tofile="${hy.hdk}/build/ant/depends.xml"
+                  outputencoding="UTF-8" />
+            <copy file="${common.resources}/make/depends.properties"
+                  tofile="${hy.hdk}/build/ant/depends.properties"
+                  outputencoding="UTF-8" />
+
+	    <mkdir dir="${hy.hdk}/build/make" />
+	    <copy todir="${hy.hdk}/build/make" overwrite="yes">
+                <fileset dir="${common.resources}/depends/build">
+                    <include name="**" />
+                </fileset>
+            </copy>
+
+        </sequential>
+    </macrodef>
 
 </project>
diff --git a/common_resources/make/svn.xml b/common_resources/make/svn.xml
index 576adb8..bae29b0 100644
--- a/common_resources/make/svn.xml
+++ b/common_resources/make/svn.xml
@@ -48,62 +48,6 @@
         </tstamp>
     </target>
     
-    <target name="fetch-svn">
-        <setup-svn dep="${dependency}"/>
-        <antcall target="svn-co" inheritAll="false">
-            <propertyset>
-                <propertyref prefix="${dependency}."/>
-                <mapper type="glob" from="${dependency}.*" to="dep.*"/>
-            </propertyset>
-        </antcall>
-    </target>
-
-    <target name="svn-co" unless="dep.svn.dir.uptodate">
-        <exec executable="svn" failonerror="true">
-            <arg line="co -r ${dep.svn.revision} ${dep.svn.url} ${dep.svn.dir}" />
-        </exec>
-    </target>
-
-    <target name="check-svn">
-        <check-svn dep="${dependency}"/>
-    </target>
-    
-    <macrodef name="check-svn">
-        <attribute name="dep" />
-        <sequential>
-            <setup-svn dep="@{dep}"/>
-            <echo message="Checking @{dep} SVN workspace at ${@{dep}.svn.dir}"/>
-            <fail unless="@{dep}.svn.dir.uptodate">
-                ...
-Dependency is not available or out of date: ${dependency}.
-It should be checked out
-    from SVN repository: ${@{dep}.svn.url} 
-    revision: ${@{dep}.svn.revision}
-    to: ${@{dep}.svn.dir}
-    
-Run "ant fetch-depends" to automatically fetch dependencies.
-Note: Some of Harmony's dependencies are licensed under terms other
-than the Apache License v2.                
-            </fail>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="setup-svn">
-        <attribute name="dep" />
-        <sequential>
-            <property name="@{dep}.svn.dir" value="${depends.oss}/@{dep}"/>
-            <property name="@{dep}.svn.revision" value="HEAD"/>
-            <svn-info dir="${@{dep}.svn.dir}" prefix="@{dep}"/>
-
-            <condition property="@{dep}.svn.dir.uptodate">
-                <and>
-                    <equals arg1="${@{dep}.svn.revision}" arg2="${@{dep}.entry.revision}"/>
-                    <equals arg1="${@{dep}.svn.url}" arg2="${@{dep}.entry.url}"/>
-                </and>
-            </condition>
-        </sequential>
-    </macrodef>
-    
     <macrodef name="svn-info">
         <attribute name="dir" />
         <attribute name="prefix" default=""/>
diff --git a/drlvm/build.xml b/drlvm/build.xml
index 04ef864..1eb6473 100644
--- a/drlvm/build.xml
+++ b/drlvm/build.xml
@@ -21,6 +21,16 @@
     	Build contributed source and lay out results in the required format 
     </description>
     
+    <property name="hy.target" location="target" />
+    <property name="hy.component" value="drlvm" />
+    <property name="hy.module" value="toplevel" />
+
+    <fail message="Property 'common.resources' is not defined">
+        <condition>
+            <not><isset property="common.resources" /></not>
+        </condition>
+    </fail>
+
     <import file="make/properties.xml"/>
 
     <target name="help">
@@ -111,63 +121,86 @@
 
     <target name="build-extra" depends=""
         description="Compiles external dependencies">
-        <ant antfile="make/extra/apr.xml"/>
+        <ant antfile="make/extra/apr.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
     </target>
 
     <target name="encoder">
-        <ant antfile="make/vm/encoder.xml"/>
+        <make dir="modules/vm/src/main/native/encoder/${hy.os.family}" />
     </target>
 
     <target name="port" depends="build-extra">
-        <ant antfile="make/vm/port.xml"/>
+        <make dir="modules/vm/src/main/native/port/${hy.os.family}" />
     </target>
 
     <target name="port_ch" depends="port">
-        <ant antfile="make/vm/port_ch.xml"/>
+        <make dir="modules/vm/src/main/native/port_ch/${hy.os.family}" />
     </target>
 
     <target name="hythr" depends="port">
-        <ant antfile="make/vm/hythr.xml"/>
+        <make dir="modules/vm/src/main/native/hythr/${hy.os.family}" />
     </target>
 
     <target name="verifier">
-        <ant antfile="make/vm/verifier.xml"/>
+        <make dir="modules/vm/src/main/native/verifier/${hy.os.family}" />
     </target>
 
-    <target name="verifier-ext" description="Build a verifier extentions library">
-        <ant antfile="make/vm/verifier-ext.xml"/>
+    <target name="verifier-ext"
+            description="Build a verifier extentions library">
+        <ant antfile="make/vm/verifier-ext.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
     </target>
 
-    <target name="clean-verifier-ext" description="Clean a verifier extentions library">
-        <ant antfile="make/vm/verifier-ext.xml" target="clean"/>
+    <target name="clean-verifier-ext"
+            description="Clean a verifier extentions library">
+        <ant antfile="make/vm/verifier-ext.xml" target="clean"
+             inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
     </target>
 
     <target name="vmcore" depends="encoder, port, port_ch, hythr, verifier">
-        <ant antfile="make/vm/vmcore.xml"/>
+        <ant antfile="make/vm/vmcore.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
+        <make dir="modules/vm/src/main/native/vmcore/${hy.os.family}" />
     </target>
 
     <target name="em" depends="vmcore">
-        <ant antfile="make/vm/em.xml"/>
+        <make dir="modules/vm/src/main/native/em/${hy.os.family}" />
     </target>
 
     <target name="interpreter" depends="vmcore">
-        <ant antfile="make/vm/interpreter.xml"/>
+        <ant antfile="make/vm/interpreter.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
+        <make dir="modules/vm/src/main/native/interpreter/${hy.os.family}" />
     </target>
 
     <target name="kernel">
-        <ant antfile="make/vm/kernel.xml"/>
+        <ant antfile="make/vm/kernel.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
     </target>
 
     <target name="vmi" depends="vmcore">
-        <ant antfile="make/vm/vmi.xml"/>
+        <make dir="modules/vm/src/main/native/vmi/${hy.os.family}" />
     </target>
 
     <target name="jitrino" depends="vmcore">
-        <ant antfile="make/vm/jitrino.xml"/>
+        <ant antfile="make/vm/jitrino.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
+        <make dir="modules/vm/src/main/native/jitrino/${hy.os.family}" />
     </target>
 
     <target name="gc_gen" depends="vmcore,kernel">
-        <ant antfile="make/vm/gc_gen.xml"/>
+        <ant antfile="make/vm/gc_gen.xml" inheritall="false">
+            <propertyset refid="module.props" />
+        </ant>
+        <make dir="modules/vm/src/main/native/gc_gen/${hy.os.family}" />
     </target>
 
     <target name="-init-hdk">
diff --git a/drlvm/make/build-java.xml b/drlvm/make/build-java.xml
index f5e1420..24bcbbf 100644
--- a/drlvm/make/build-java.xml
+++ b/drlvm/make/build-java.xml
@@ -41,7 +41,7 @@
     </macrodef>
 
     <macrodef name="make-java">
-        <attribute name="component" default="${component}"/>
+        <attribute name="component" default="${hy.module}"/>
         <attribute name="src"/>
         <attribute name="manifest"/>
         <element name="javac-elements" implicit="yes" optional="yes"/>
diff --git a/drlvm/make/build-native.xml b/drlvm/make/build-native.xml
index 2f2eae9..5b772a2 100644
--- a/drlvm/make/build-native.xml
+++ b/drlvm/make/build-native.xml
@@ -21,7 +21,7 @@
     <import file="${bn.imported.basedir}/properties.xml"/>
     
     <macrodef name="clean-native">
-        <attribute name="component" default="${component}"/>
+        <attribute name="component" default="${hy.module}"/>
         <sequential>
             <delete quiet="true" dir="${drlvm.semi.dir}/@{component}" />
         </sequential>
@@ -118,7 +118,7 @@
         </presetdef>
 
         <macrodef name="init-native">
-            <attribute name="component" default="${component}"/>
+            <attribute name="component" default="${hy.module}"/>
             <sequential>
                 <echo message="## Building '@{component}'" />
                 
@@ -144,7 +144,7 @@
         </presetdef>
 
         <macrodef name="make-native">
-            <attribute name="libname" default="${component}"/>
+            <attribute name="libname" default="${hy.module}"/>
             <attribute name="type" />
             <element name="cc-elements" implicit="yes" optional="yes"/>
             <sequential>
@@ -172,7 +172,7 @@
         </macrodef>
         
         <macrodef name="link-lib">
-            <attribute name="name" default="${component}"/>
+            <attribute name="name" default="${hy.module}"/>
             <attribute name="type" />
             <element name="link-elements" implicit="yes" optional="yes"/>
             <sequential>    
diff --git a/drlvm/make/depends.xml b/drlvm/make/depends.xml
index ab52fac..c3df21b 100644
--- a/drlvm/make/depends.xml
+++ b/drlvm/make/depends.xml
@@ -26,10 +26,7 @@
         <fail>
             <condition>
                 <not>
-                    <and>
-                    <available file="${hy.hdk}/include"/>
-                    <available file="${hy.hdk}/lib"/>
-                    </and>
+                    <available file="${hy.hdk}/build/ant"/>
                 </not>
             </condition>
 ...
diff --git a/drlvm/make/extra/apr.xml b/drlvm/make/extra/apr.xml
index 047bd27..88ce22f 100644
--- a/drlvm/make/extra/apr.xml
+++ b/drlvm/make/extra/apr.xml
@@ -18,7 +18,8 @@
 
 <project name="apr-dep" default="build">
     
-    <property name="component" value="apr"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="apr"/>
     <import file="../build-native.xml"/>
 
     <target name="fetch-depends">
diff --git a/drlvm/make/extra/make/depends.properties b/drlvm/make/extra/make/depends.properties
new file mode 100644
index 0000000..3934223
--- /dev/null
+++ b/drlvm/make/extra/make/depends.properties
@@ -0,0 +1,15 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
diff --git a/drlvm/make/properties.xml b/drlvm/make/properties.xml
index 0073082..6ee91ef 100644
--- a/drlvm/make/properties.xml
+++ b/drlvm/make/properties.xml
@@ -46,21 +46,8 @@
     </condition>
     <property name="hy.cpp.compiler" value="gcc"/>
         
-    
-    <!-- set the path root for the external resources  -->
-    <property name="common.resources.loc" value="${drlvm.base.dir}/../common_resources" />
-    <property name="common.resources" location="${common.resources.loc}" />
-    <fail>
-        <condition>
-            <not><available file="${common.resources}/make/properties.xml"/></not>
-        </condition>
-        Primary dependency is missing: common_resources.
-        You need to check it out from SVN repository or specify it's location:
-        ant -Dcommon.resources.loc=path
-    </fail>
-    
-    <import file="${common.resources}/make/properties.xml"/>
-    <import file="${common.resources}/make/depends.xml"/>
+    <import file="${hy.target}/hdk/build/ant/properties.xml"/>
+    <import file="${hy.target}/hdk/build/ant/depends.xml"/>
 
     <!-- define drlvm-specific resources -->
     <loadproperties srcfile="${prop.imported.basedir}/depends.properties">
@@ -87,7 +74,7 @@
     </condition>
 
     <property name="vm.home" location="${drlvm.base.dir}/vm" />        
-    <property name="drlvm.build.dir" location="${drlvm.base.dir}/build/${hy.os}_${hy.arch}_${hy.cpp.compiler}_${hy.cfg}" />
+    <property name="drlvm.build.dir" location="${hy.target}/build/drlvm/all" />
     <property name="drlvm.deploy.dir" location="${drlvm.build.dir}/deploy" />
     <property name="drlvm.semi.dir" location="${drlvm.build.dir}/semis" />
     <property name="drlvm.bin.dir" location="${drlvm.deploy.dir}/jdk/jre/bin/default"/>
@@ -118,7 +105,7 @@
         <echo message="    hy.local.zlib = ${hy.local.zlib}" />
         <echo message=" common resources = ${common.resources}" />
         <echo message="         HDK root = ${hy.hdk}" />
-        <echo message="       target dir = ${drlvm.deploy.dir}" />
+        <echo message="       deploy dir = ${drlvm.deploy.dir}" />
     </target>
 
     <target name="debug-echo">
diff --git a/drlvm/make/tests/ehwa-test.xml b/drlvm/make/tests/ehwa-test.xml
index 41eccc1..ae5fe51 100644
--- a/drlvm/make/tests/ehwa-test.xml
+++ b/drlvm/make/tests/ehwa-test.xml
@@ -20,7 +20,7 @@
     <import file="test-common.xml"/>
     <property name="ehwa.test.dir" location="${base.test.dir}/ehwa"/>
     <property name="ehwa.test.summary" location="${ehwa.test.dir}/status.txt"/>
-    <property name="ECLIPSE_ARCHIVE.home" location="${base.dep.dir}/eclipse"/>
+    <property name="ECLIPSE_ARCHIVE.home" location="${depends.dir}/eclipse"/>
 
     <target name="ehwa" depends="-init-test,setup-ehwa, run-ehwa, check-ehwa-result"/>
 
diff --git a/drlvm/make/tests/make/depends.properties b/drlvm/make/tests/make/depends.properties
new file mode 100644
index 0000000..3934223
--- /dev/null
+++ b/drlvm/make/tests/make/depends.properties
@@ -0,0 +1,15 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
diff --git a/drlvm/make/tests/test-common.xml b/drlvm/make/tests/test-common.xml
index 9f52f63..b0d80c4 100644
--- a/drlvm/make/tests/test-common.xml
+++ b/drlvm/make/tests/test-common.xml
@@ -16,7 +16,10 @@
      limitations under the License.
 -->
 <project name="test-common">
-    
+
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="test-common"/>
+
     <dirname property="tc.imported.basedir" file="${ant.file.test-common}"/>
     <import file="${tc.imported.basedir}/../build-java.xml"/>
 
diff --git a/drlvm/make/vm/em.xml b/drlvm/make/vm/em.xml
index 475f9cd..541432d 100644
--- a/drlvm/make/vm/em.xml
+++ b/drlvm/make/vm/em.xml
@@ -18,7 +18,8 @@
 
 <project name="em" default="build" basedir="../..">
     
-    <property name="component" value="em"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="em"/>
     <import file="common-vm.xml"/>
     
     <target name="build" depends="-common-vm">        
diff --git a/drlvm/make/vm/encoder.xml b/drlvm/make/vm/encoder.xml
index 6f5af94..6a52b2c 100644
--- a/drlvm/make/vm/encoder.xml
+++ b/drlvm/make/vm/encoder.xml
@@ -18,7 +18,8 @@
 
 <project name="encoder" default="build" basedir="../..">
     
-    <property name="component" value="encoder"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="encoder"/>
     <import file="common-vm.xml"/>
     
     <target name="build" depends="-common-vm">        
diff --git a/drlvm/make/vm/gc_gen.xml b/drlvm/make/vm/gc_gen.xml
index 1f488dc..fae1c7a 100644
--- a/drlvm/make/vm/gc_gen.xml
+++ b/drlvm/make/vm/gc_gen.xml
@@ -17,17 +17,15 @@
 -->
 
 <project name="gc_gen" default="build" basedir="../..">
+
     
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="gc_gen"/>
+
     <import file="common-vm.xml"/>
     <import file="../build-java.xml"/>
     
     <target name="build">
-        <antcall target="build-uncompressed">
-            <param name="component" value="gc_gen_uncomp"/>
-        </antcall>
-        <antcall target="build-compressed">
-            <param name="component" value="gc_gen"/>
-        </antcall>
         <make-java component="gc_gen" src="${vm.home}/gc_gen/javasrc"
             manifest="${vm.home}/gc_gen/resource/MANIFEST.MF">
             <classpath>
@@ -37,100 +35,6 @@
             </classpath>
         </make-java>
     </target>
-        
-    <target name="init" depends="-common-vm">
-        <condition property="build.compressed.gc">
-            <not><!-- refs.comp.mode is not REFS_USE_UNCOMPRESSED for compressed and runtime switching modes -->
-                <equals arg1="${refs.comp.mode}" arg2="REFS_USE_UNCOMPRESSED" />
-            </not>
-        </condition>
-        <condition property="build.uncompressed.gc">
-            <not><!-- refs.comp.mode is not REFS_USE_COMPRESSED for uncompressed and runtime switching modes -->
-                <equals arg1="${refs.comp.mode}" arg2="REFS_USE_COMPRESSED" />
-            </not>
-        </condition>
-        
-        <path id="gc.includes">
-            <dirset dir="${vm.home}">
-                <include name="include" />
-                <include name="port/include" />
-                <include name="vmcore/include" />
-                <include name="vmcore/src/util/win/include" if="is.windows"/>
-                <include name="vmcore/src/util/linux/include" if="is.unix"/>
-            </dirset>
-            <dirset dir="${vm.home}/gc_gen/src">
-            	<include name="common" />
-                <include name="gen" />
-                <include name="mark_compact" />
-                <include name="mark_sweep" />
-                <include name="move_compact" />
-                <include name="semi_space" />
-                <include name="los" />
-                <include name="thread" />
-                <include name="trace_forward" />
-                <include name="utils" />
-                <include name="jni" />
-                <include name="verify" />
-                <include name="finalizer_weakref" />
-            </dirset>
-            <pathelement location="${drlvm.include.dir}" />
-        </path>
-        
-        <compiler id="cpp.compiler" extends="common.cpp.compiler">
-            <includepath><path refid="gc.includes"/></includepath>
-            <fileset dir="${vm.home}/gc_gen/src">
-                <selector refid="gc.depends"/>
-                <include name="common/*.cpp" />
-                <include name="gen/*.cpp" />
-                <include name="mark_compact/*.cpp" />
-                <include name="mark_sweep/*.cpp" />
-                <include name="move_compact/*.cpp" />
-                <include name="semi_space/*.cpp" />
-                <include name="los/*.cpp" />
-                <include name="thread/*.cpp" />
-                <include name="trace_forward/*.cpp" />
-                <include name="utils/*.cpp" />
-                <include name="jni/*.cpp" />
-                <include name="verify/*.cpp" />
-                <include name="finalizer_weakref/*.cpp" />
-            </fileset>
-
-            <defineset define="BUILDING_GC" />
-        </compiler>
-
-        <linker id="linker" extends="common.linker">
-            <libset libs="harmonyvm" dir="${drlvm.lib.dir}" if="is.windows"/>
-            <libset libs="hythr" dir="${drlvm.shlib.dir}" />
-            <linkerarg value="-Bsymbolic" if="is.unix"/>
-            <linkerarg value="--version-script=${vm.home}/gc_gen/build/gc_gen.exp" if="is.unix"/>
-        </linker>
-
-    </target>
-    
-    <target name="build-uncompressed" depends="init" if="build.uncompressed.gc">
-        <init-native />
-        <depend-includes paths="gc.includes"/>
-        <depend-selector rebuild-flag="gc.includes.uptodate" id="gc.depends"/>
-        <compile-cc>
-            <compiler refid="cpp.compiler"/>
-        </compile-cc>
-        <link-lib name="gc_gen_uncomp" type="shared">
-            <linker refid="linker"/>
-        </link-lib>
-   </target>
-    
-    <target name="build-compressed" depends="init" if="build.compressed.gc">
-        <init-native/>
-        <depend-includes paths="gc.includes"/>
-        <depend-selector rebuild-flag="gc.includes.uptodate" id="gc.depends"/>
-        <compile-cc>
-            <compiler refid="cpp.compiler"/>
-            <defineset define="COMPRESS_REFERENCE" />
-        </compile-cc>
-        <link-lib name="gc_gen" type="shared">
-            <linker refid="linker"/>
-        </link-lib>        
-   </target>
     
     <target name="clean" >
         <clean-native component="gc_gen"/>
diff --git a/drlvm/make/vm/hythr.xml b/drlvm/make/vm/hythr.xml
index a9935bb..3bf1625 100644
--- a/drlvm/make/vm/hythr.xml
+++ b/drlvm/make/vm/hythr.xml
@@ -18,7 +18,8 @@
 
 <project name="hythr" default="build" basedir="../..">
     
-    <property name="component" value="hythr"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="hythr"/>
     <import file="common-vm.xml"/>
     
     <condition property="hy.thr.ver" value="_0.1">
diff --git a/drlvm/make/vm/interpreter.xml b/drlvm/make/vm/interpreter.xml
index c9811b1..a82a5da 100644
--- a/drlvm/make/vm/interpreter.xml
+++ b/drlvm/make/vm/interpreter.xml
@@ -18,74 +18,13 @@
 
 <project name="interpreter" default="build" basedir="../..">
         
-    <property name="component" value="interpreter"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="interpreter"/>
     <import file="common-vm.xml"/>
         
     <target name="build" depends="-common-vm">        
-        <init-native/>
-        
-        <compile-asm>
-            <fileset id="int.asm" dir="${vm.home}/interpreter/src">
-                <include name="invokeJNI_ia32.asm" if="is.unix.x86"/>
-                <include name="invokeJNI_em64t.asm" if="is.unix.x86_64"/>
-                <include name="invokeJNI_ipf.asm" if="is.unix.ia64"/>
-    
-                <exclude name="*" if="is.windows.x86"/>
-                <include name="invokeJNI_Windows_ipf.asm" if="is.windows.ia64"/>
-                <include name="invokeJNI_Windows_em64t.asm" if="is.windows.x86_64"/>
-            </fileset>
-        </compile-asm>
-        
-        <path id="int.includes">
-            <dirset dir="${vm.home}">
-                <include name="include" />
-                <include name="vmcore/include" />
-                <include name="port/include" />
-
-                <include name="vmcore/src/util/win/include" if="is.windows"/>
-                <include name="vmcore/src/util/linux/include" if="is.unix"/>
-
-                <include name="vmcore/src/util/ipf/include" if="is.ia64"/>
-                <include name="vmcore/src/util/ipf/base_natives" if="is.ia64"/>
-                <include name="vmcore/src/lil/ipf/include" if="is.ia64"/>
-
-                <include name="vmcore/src/util/ia32/base_natives" if="is.x86"/>
-                <include name="port/src/encoder/ia32_em64t" if="is.x86"/>
-                <include name="vmcore/src/lil/ia32/include" if="is.x86"/>
-
-                <include name="vmcore/src/util/em64t/base_natives" if="is.x86_64"/>
-                <include name="port/src/encoder/ia32_em64t" if="is.x86_64"/>
-                <include name="vmcore/src/lil/em64t/include" if="is.x86_64"/>
-            </dirset>
-            <pathelement location="${drlvm.include.dir}" />
-        </path>
-        <depend-includes paths="int.includes"/>
-        <depend-selector rebuild-flag="int.includes.uptodate" id="int.depends"/>
-
-        <compile-cc>
-        <compiler id="cpp.compiler" extends="common.cpp.compiler">
-            <includepath><path refid="int.includes"/></includepath>
-            <fileset dir="${vm.home}/interpreter/src">
-                <selector refid="int.depends"/>
-                <include name="*.cpp" />
-                <exclude name="interp_native_ia32.cpp" unless="is.x86"/>
-                <exclude name="interp_native_ipf.cpp" unless="is.ia64"/>
-                <exclude name="interp_native_em64t.cpp" unless="is.x86_64"/>
-            </fileset>
-
-            <compilerarg value="/Op" if="is.windows" unless="is.cfg.debug"/>
-            <compilerarg value="-Qwd1572" if="is.icl"/>
-        </compiler>
-        </compile-cc>
-
-        <link-lib name="interpreter" type="shared">
-            <linker id="linker" extends="common.linker">
-                <linkerarg value="--version-script=${vm.home}/interpreter/build/interpreter.exp" if="is.unix"/>
-                <libset libs="harmonyvm,hythr" dir="${drlvm.shlib.dir}" />
-            </linker>
-        </link-lib>
-
-        <copy todir="${drlvm.bin.dir}" file="${vm.home}/interpreter/interpreter.emconf" />
+        <copy todir="${drlvm.bin.dir}"
+              file="${vm.home}/interpreter/interpreter.emconf" />
     </target>
     
     <target name="clean" >
diff --git a/drlvm/make/vm/jitrino.xml b/drlvm/make/vm/jitrino.xml
index 3cc3f0e..3f399af 100644
--- a/drlvm/make/vm/jitrino.xml
+++ b/drlvm/make/vm/jitrino.xml
@@ -16,86 +16,18 @@
 -->
 <project name="jitrino" default="build" basedir="../..">
     
-    <property name="component" value="jitrino"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="jitrino"/>
     <import file="common-vm.xml"/>
 
     <target name="clean" >
         <clean-native />
     </target>
  
-    <target name="build" depends="-init-win,-init-unix">
-        <init-native/>
-        
-        <path id="jit.includes">
-            <dirset dir="${vm.home}/jitrino/src">
-                <include name="dynopt" />
-                <include name="main" />
-                <include name="shared" />
-                <include name="optimizer" />
-                <include name="optimizer/ssa" />
-                <include name="optimizer/abcd" />
-                <include name="translator" />
-                <include name="translator/java" />
-                <include name="vm" />
-                <include name="codegenerator" />
-
-                <include name="codegenerator/ia32" unless="is.ia64"/>
-                <include name="jet" unless="is.ia64"/>
-
-                <include name="codegenerator/ipf" if="is.ia64"/>
-                <include name="codegenerator/ipf/include" if="is.ia64"/>
-            </dirset>
-            <dirset dir="${vm.home}">
-                <include name="port/src/encoder/ia32_em64t" unless="is.ia64"/>
-                <include name="vmcore/src/util/win/include" if="is.windows"/>
-                <include name="vmcore/src/util/linux/include" if="is.unix"/>
-            </dirset>
-            <pathelement location="${vm.home}/include" />
-            <pathelement location="${vm.home}/vmcore/include" />
-            <pathelement location="${vm.home}/port/include" />
-            <pathelement location="${drlvm.include.dir}" />
-        </path>
-        <depend-includes paths="jit.includes"/>
-        <depend-selector rebuild-flag="jit.includes.uptodate" id="jit.depends"/>
-
-        <compile-cc>
-            <compiler id="cpp.compiler" extends="plaf.cpp.compiler">
-                <includepath><path refid="jit.includes"/></includepath>
-                <fileset dir="${vm.home}/jitrino/src">
-                    <selector refid="jit.depends"/>
-                    <include name="dynopt/*.cpp" />
-                    <include name="main/*.cpp" />
-                    <include name="shared/*.cpp" />
-                    <include name="optimizer/*.cpp" />
-                    <include name="optimizer/ssa/*.cpp" />
-                    <include name="optimizer/abcd/*.cpp" />
-                    <include name="translator/*.cpp" />
-                    <include name="translator/java/*.cpp" />
-                    <include name="vm/*.cpp" />
-                    <include name="codegenerator/*.cpp"/>
-    
-                    <include name="codegenerator/ipf/*.cpp" if="is.ia64"/>
-                    <include name="codegenerator/ia32/*.cpp" unless="is.ia64"/>
-                    <include name="jet/*.cpp" unless="is.ia64"/>
-                </fileset>
-    
-                <defineset define="PROJECT_JITRINO" />
-                <defineset define="JIT_LOGS,JIT_STATS" if="is.cfg.debug" />
-            </compiler>
-        </compile-cc>
-        <link-lib name="jitrino" type="shared">
-            <linker id="jitrino.linker" extends="common.linker">
-                <libset libs="harmonyvm,encoder,hythr" dir="${drlvm.lib.dir}" if="is.windows"/>
-                <linkerarg value="/OPT:REF" if="is.windows"/>
-        
-                <syslibset type="shared" libs="m" if="is.unix"/>
-                <syslibset type="shared" libs="dl" if="is.linux"/>
-                <linkerarg value="--version-script=${vm.home}/jitrino/build/jitrino.exp" if="is.unix"/>
-            </linker>
-        </link-lib>
-
+    <target name="build">
         <echo message="Copying configuration files for jitrino..."/> 
         <copy todir="${drlvm.bin.dir}" flatten="true">
+            <!-- TOFIX: move to more appropriate directory -->
               <fileset dir="${vm.home}/jitrino/config">
                   <include name="ia32/*" if="is.x86"/>
                   <include name="em64t/*" if="is.x86_64"/>
@@ -104,109 +36,4 @@
         </copy>
     </target>
 
-            <!-- windows specific -->
-        <target name="-init-win" depends="-common-vm" if="is.windows">
-            <compiler id="plaf.cpp.compiler" extends="common.cpp.compiler">
-                <!-- _CRT_SECURE_NO_DEPRECATE added to suppress a huge amount of complaints from msvc em64t compiler -->
-                <defineset define="_MBCS,_REENTRANT,__SMP__,_HAS_ITERATOR_DEBUGGING=0,_SECURE_SCL=0" />
-
-                <compilerarg value="/TP" />
-                <compilerarg value="/Zc:forScope" />
-                <compilerarg value="/WL" />
-                <compilerarg value="/W4" />
-<!--                <compilerarg value="/WX" /> -->
-
-                <compilerarg value="/Gm" if="is.cfg.debug"/>
-                <compilerarg value="/RTC1" if="is.cfg.debug"/>
-
-                <compilerarg value="/Ot" if="is.cfg.release"/>
-
-                <compilerarg value="/Qvec_report0" if="is.icl" unless="is.cfg.debug"/>
-                <compilerarg value="/Qww1,82,111,172,181,279,280,373,424,593,654,858" if="is.icl"/>
-                <compilerarg value="/Qwd82,193,271,304,373,383,424,444,654,869,981,1125,1418,1419,1572,1683" if="is.icl"/>
-                    <!--
-                      # /Qwd[tag,...] Disable the soft diagnostics that corresponds to tag. 
-                      # /Qwr[tag,...] Override the severity of the soft diagnostics corresponding to tag and make it a remark. 
-                      # /Qww[tag,...] Override the severity of the soft diagnostics corresponding to tag and make it a warning. 
-                      # /Qwe[tag,...] Override the severity of the soft diagnostics corresponding to tag and make it an error.
-                      #
-                      # Following icl warning added to icl command line
-                      #
-                      # remark #1: last line of file ends without a newline      
-                      # remark #82: storage class is not first
-                      # remark #111: statement is unreachable
-                      # remark #181: argument is incompatible with corresponding format string conversion
-                      # remark #193: zero used for undefined preprocessing identifier
-                      # remark #271: trailing comma is nonstandard   
-                      # remark #279: controlling expression is constant    
-                      # remark #280: selector expression is constant
-                      # remark #304: access control not specified ("private" by default)     
-                      # remark #373: "xxx" is inaccessible
-                      # remark #383: value copied to temporary, reference to temporary used
-                      # remark #424: extra ";" ignored
-                      # remark #444: destructor for base class "..." is not virtual    
-                      # remark #593: variable "xxx" was set but never used
-                      # remark #654: overloaded virtual function "xxx" is only partially overridden in class "yyy"
-                      # remark #858: type qualifier on return type is meaningless
-                      # remark #869: parameter "o" was never referenced    
-                      # remark #981: operands are evaluated in unspecified order
-                      # remark #1418: external definition with no prior declaration    
-                      # remark #1419: external declaration in primary source file      
-                      #
-                      # warning #1125: function "xxx" is hidden by "yyy" - virtual function override intended?
-                      # warning #1572: floating-point equality and inequality comparisons are unreliable
-                    -->
-
-                <compilerarg value="/wd4201" if="is.msvc"/>
-                <compilerarg value="/wd4244" if="is.msvc"/>
-                <compilerarg value="/wd4512" if="is.msvc"/>
-                <compilerarg value="/wd4702" if="is.msvc"/>
-                <compilerarg value="/wd4100" if="is.msvc"/>
-                <compilerarg value="/wd4127" if="is.msvc"/>
-                <compilerarg value="/wd4718" if="is.msvc" unless="is.cfg.debug"/>
-                    <!--
-                      #4201 - W4, nonstandart extention - nameless struct or union
-                      #4702 - W4, unreachable code (fired in STL's <list>)
-                      #4512 - assigment operator can not be generated
-                      #4100 - unreferenced formal parameter
-                      #4127 - conditional expression is constant
-                      #4718 - release: recursive call has no side effects, deleting
-
-                      # specify where to put the per-compilation unit pdb
-                      # this is needed to make the parallel compilation to work with cl: 
-                      # the default name is the same for all input files (vc70.pdb) and 
-                      # thus causes problems during parralel build.
-                    -->
-            </compiler>
-        </target>
-        
-        <target name="-init-unix" depends="-common-vm" if="is.unix">
-            <compiler id="plaf.cpp.compiler" extends="common.cpp.compiler">
-                <compilerarg value="-fmessage-length=0" if="is.gcc"/>
-                <compilerarg value="-Wall" if="is.gcc"/>
-                <compilerarg value="-Werror" if="is.gcc"/>
-                <compilerarg value="-Wno-uninitialized" if="is.gcc"/>
-
-                <compilerarg value="-x" />
-                <compilerarg value="c++" />
-                <compilerarg value="-fPIC" />
-                <compilerarg value="-fno-exceptions" />
-
-                <compilerarg value="-wd68" if="is.icc"/>
-                <compilerarg value="-wd654" if="is.icc"/>
-                <compilerarg value="-wd854" if="is.icc"/>
-                <compilerarg value="-wd470" if="is.icc"/>
-                <compilerarg value="-wd1572" if="is.icc"/>
-                <compilerarg value="-wd1125" if="is.icc"/>
-                    <!--                        
-                      # 470 - 'qualified name is not allowed in member declaration'
-                      # warning #1125: function "xxx" is hidden by "yyy"
-                      - virtual function override intended 
-                      # warning #1572: floating-point equality and inequality comparisons are unreliable
-                    -->
-
-                <compilerarg value="-O" if="is.unix" unless="is.cfg.debug"/>
-            </compiler>
-        </target>
-
 </project>
diff --git a/drlvm/make/vm/kernel.xml b/drlvm/make/vm/kernel.xml
index 57e6569..be88707 100644
--- a/drlvm/make/vm/kernel.xml
+++ b/drlvm/make/vm/kernel.xml
@@ -18,6 +18,8 @@
 
 <project name="kernel" default="build" basedir="../..">
     
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="kernel"/>
     <import file="../build-java.xml"/>
     
     <target name="fetch-depends">
diff --git a/drlvm/make/vm/port.xml b/drlvm/make/vm/port.xml
index 9239ce9..ae0392f 100644
--- a/drlvm/make/vm/port.xml
+++ b/drlvm/make/vm/port.xml
@@ -18,7 +18,8 @@
 
 <project name="portlib" default="build" basedir="../..">
     
-    <property name="component" value="portlib"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="portlib"/>
     
     <import file="common-vm.xml"/>
     
diff --git a/drlvm/make/vm/port_ch.xml b/drlvm/make/vm/port_ch.xml
index 80c99b7..8f0445c 100644
--- a/drlvm/make/vm/port_ch.xml
+++ b/drlvm/make/vm/port_ch.xml
@@ -18,7 +18,8 @@
 
 <project name="port_ch" default="build" basedir="../..">
 
-    <property name="component" value="port_ch"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="port_ch"/>
 
     <import file="common-vm.xml"/>
 
diff --git a/drlvm/make/vm/verifier-ext.xml b/drlvm/make/vm/verifier-ext.xml
index 5c3a6ec..0fe81de 100644
--- a/drlvm/make/vm/verifier-ext.xml
+++ b/drlvm/make/vm/verifier-ext.xml
@@ -18,7 +18,8 @@
 
 <project name="verifier-ext" default="build" basedir="../..">
     
-    <property name="component" value="verifier-ext"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="verifier-ext"/>
     <property name="drlvm.verifier-ext.includes"
         value="${drlvm.deploy.dir}/include/verifier-ext"/> 
     <import file="common-vm.xml"/>
diff --git a/drlvm/make/vm/verifier.xml b/drlvm/make/vm/verifier.xml
index 5e9f500..b1031da 100644
--- a/drlvm/make/vm/verifier.xml
+++ b/drlvm/make/vm/verifier.xml
@@ -18,7 +18,8 @@
 
 <project name="verifier" default="build" basedir="../..">
     
-    <property name="component" value="verifier"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="verifier"/>
     <import file="common-vm.xml"/>
     
     <target name="build" depends="-common-vm">        
diff --git a/drlvm/make/vm/vmcore.xml b/drlvm/make/vm/vmcore.xml
index 990c255..36459e4 100644
--- a/drlvm/make/vm/vmcore.xml
+++ b/drlvm/make/vm/vmcore.xml
@@ -18,7 +18,8 @@
 
 <project name="vmcore" default="build" basedir="../..">
 
-    <property name="component" value="vmcore"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="vmcore"/>
     <import file="common-vm.xml"/>
 
     <target name="fetch-depends">
@@ -66,144 +67,12 @@
     </target>
 
     <target name="build" depends="setup,stamp-version,-common-vm">
-        <init-native component="vmcore"/>
-        
-        <compile-asm>
-            <fileset id="vmcore.asm" dir="${vm.home}/vmcore">
-                <include name="src/util/ipf/base/*.asm" if="is.unix.ia64"/>
-                <include name="src/util/win/em64t/*.asm" if="is.windows.x86_64"/>
-            </fileset>
-        </compile-asm>
-
-        <path id="vmcore.includes">
-            <dirset dir="${vm.home}">
-                <include name="include" />
-                <include name="vmcore/include" />
-                <include name="port/include" />
-            
-                <include name="vmcore/src/util/win/include" if="is.windows"/>
-                <include name="vmcore/src/util/linux/include" if="is.unix"/>
-
-                <include name="vmcore/src/util/ipf/include" if="is.ia64"/>
-                <include name="vmcore/src/util/ipf/base_natives" if="is.ia64"/>
-                <include name="vmcore/src/lil/ipf/include" if="is.ia64"/>
-
-                <include name="vmcore/src/util/ia32/base_natives" if="is.x86"/>
-                <include name="port/src/encoder/ia32_em64t" if="is.x86"/>
-                <include name="vmcore/src/lil/ia32/include" if="is.x86"/>
-
-                <include name="vmcore/src/util/em64t/base_natives" if="is.x86_64"/>
-                <include name="port/src/encoder/ia32_em64t" if="is.x86_64"/>
-                <include name="vmcore/src/lil/em64t/include" if="is.x86_64"/>
-            </dirset>
-            <pathelement location="${drlvm.include.dir}" />
-            <pathelement location="${hy.hdk}/include" />
-        </path>
-        <depend-includes paths="vmcore.includes"/>
-        <depend-selector rebuild-flag="vmcore.includes.uptodate" id="vmcore.depends"/>
-
-        <compile-cc>
-        <compiler id="cpp.compiler" extends="common.cpp.compiler">
-            <includepath><path refid="vmcore.includes"/></includepath>
-            <fileset dir="${vm.home}/vmcore/src">
-                <selector refid="vmcore.depends"/>
-                <include name="class_support/*.cpp" />
-                <include name="exception/*.cpp" />
-                <include name="init/*.cpp" />
-                <include name="gc/*.cpp" />
-                <include name="interpreter/*.cpp" />
-                <include name="jit/*.cpp" />
-                <include name="jni/*.cpp" />
-                <include name="jvmti/*.cpp" />
-                <include name="ncai/*.cpp" />
-                <include name="object/*.cpp" />
-                <include name="reflection/*.cpp" />
-                <include name="stack/*.cpp" />
-                <include name="thread/*.cpp" />
-                <include name="thread/helpers/thread_helpers.cpp" />
-                <include name="thread/helpers/thread_helpers_ia32.cpp" if="is.x86"/>
-                <include name="thread/helpers/thread_helpers_em64t.cpp" if="is.x86_64"/>
-                <include name="thread/helpers/thread_helpers_ipf.cpp" if="is.ia64"/>
-                <include name="util/*.cpp" />
-                <include name="lil/*.cpp" />
-                <include name="lil/stack_iterator/*.cpp" />
-            </fileset>
-
-            <fileset dir="${vm.home}/vmcore/src/kernel_classes/native">
-                <selector refid="vmcore.depends"/>
-                <include name="*.cpp" />
-                <exclude name="Runtime_win.cpp" if="is.unix"/>
-                <exclude name="System_win.cpp" if="is.unix"/>
-                <exclude name="Runtime_lnx.cpp" if="is.windows"/>
-                <exclude name="System_lnx.cpp" if="is.windows"/>
-            </fileset>
-
-            <fileset dir="${vm.home}">
-                <selector refid="vmcore.depends"/>
-                <include name="vmstart/src/compmgr/*.cpp" />
-            </fileset>
-
-            <fileset dir="${vm.home}/vmcore/src">
-                <selector refid="vmcore.depends"/>
-                <include name="thread/win/*.cpp" if="is.windows"/>
-                <include name="util/win/*.cpp" if="is.windows"/>
-                <include name="ncai/utils/*win.cpp" if="is.windows"/>
-
-                <include name="util/win/ia32/*.cpp" if="is.windows.x86"/>
-                <include name="util/win/em64t/*.cpp" if="is.windows.x86_64"/>
-                <include name="util/win/ia32_em64t/*.cpp" if="is.windows" unless="is.ia64"/>
-                <include name="util/win/ipf/*.cpp" if="is.windows.ia64"/>
-
-                <include name="util/ipf/**/*.cpp" if="is.ia64"/>
-                <include name="util/ia32/**/*.cpp" if="is.x86"/>
-                <include name="util/em64t/**/*.cpp" if="is.x86_64"/>
-
-                <include name="ncai/utils/*ipf.cpp" if="is.ia64"/>
-                <include name="ncai/utils/*ia32.cpp" if="is.x86"/>
-                <include name="ncai/utils/*em64t.cpp" if="is.x86_64"/>
-
-                <include name="thread/linux/*.cpp" if="is.unix"/>
-                <include name="util/linux/*.cpp" if="is.unix"/>
-                <include name="ncai/utils/*linux.cpp" if="is.unix"/>
-                <exclude name="util/linux/signals_ia32.cpp" unless="is.unix.x86"/>
-                <exclude name="util/linux/signals_em64t.cpp" unless="is.unix.x86_64"/>
-                <exclude name="util/linux/signals_ipf.cpp" unless="is.unix.ia64"/>
-                <include name="util/linux/ia32_em64t/*.cpp" if="is.unix" unless="is.ia64"/>
-
-                <include name="lil/ipf/*.cpp" if="is.ia64"/>
-                <include name="lil/ia32/*.cpp" if="is.x86"/>
-                <include name="lil/em64t/*.cpp" if="is.x86_64"/>
-            </fileset>
-
-            <compilerarg value="/Qwd94" if="is.icl"/>
-            <defineset define="BUILDING_VM,APR_DECLARE_STATIC" />
-        </compiler>
-        </compile-cc>
-        
-        <link-lib name="harmonyvm" type="shared">
-            <linker id="linker" extends="common.linker">
-                <libset libs="port,encoder,verifier,apr-1"
-                    dir="${drlvm.lib.dir}" />
-                <libset libs="hythr" dir="${drlvm.shlib.dir}" />
-                <libset libs="icuuc" dir="${drlvm.shlib.dir}"/>
-                <libset libs="ch" dir="${drlvm.shlib.dir}" />
-                <libset libs="hyzlib" dir="${hy.hdk.shlibs}"
-                        unless="hy.skip.zlib"/>
-                <syslibset type="shared" libs="z" if="hy.skip.zlib"/>
-
-                <linkerarg value="/DEF:${vm.home}/vmcore/src/harmonyvm64.def" if="is.windows.x86_64"/>
-                <linkerarg value="/DEF:${vm.home}/vmcore/src/harmonyvm.def" if="is.windows.x86"/>
-                <linkerarg value="--version-script=${vm.home}/vmcore/build/vmcore.exp" if="is.unix"/>
-                
-                <syslibset type="shared" libs="m,dl,stdc++,pthread,gcc_s,rt" if="is.linux"/>
-                <syslibset type="shared" libs="m,stdc++,pthread" if="is.freebsd"/> 
-                <linkerarg value="--export-dynamic" if="is.freebsd"/>
-            </linker>
-        </link-lib>        
-        
         <echo message="Copying files for internationalization..."/>
         <copy todir="${drlvm.bin.dir}" flatten="true" >
-            <fileset dir="${vm.home}/vmcore/src/init">
+            <!--
+                 TOFIX: move to more appropriate directory or copy in makefile?
+              -->
+            <fileset dir="modules/vm/src/main/native/vmcore/shared/init">
                 <include name="harmony*.properties" />
             </fileset>
         </copy>
diff --git a/drlvm/make/vm/vmi.xml b/drlvm/make/vm/vmi.xml
index c6c25e1..92b30b5 100644
--- a/drlvm/make/vm/vmi.xml
+++ b/drlvm/make/vm/vmi.xml
@@ -18,7 +18,8 @@
 
 <project name="vmi" default="build" basedir="../..">
     
-    <property name="component" value="vmi"/>
+    <property name="hy.component" value="drlvm"/>
+    <property name="hy.module" value="vmi"/>
     <import file="common-vm.xml"/>
     
     <target name="build" depends="-common-vm">        
diff --git a/drlvm/vm/em/src/DrlEMImpl.cpp b/drlvm/modules/vm/src/main/native/em/shared/DrlEMImpl.cpp
similarity index 100%
rename from drlvm/vm/em/src/DrlEMImpl.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/DrlEMImpl.cpp
diff --git a/drlvm/vm/em/src/DrlEMImpl.h b/drlvm/modules/vm/src/main/native/em/shared/DrlEMImpl.h
similarity index 100%
rename from drlvm/vm/em/src/DrlEMImpl.h
rename to drlvm/modules/vm/src/main/native/em/shared/DrlEMImpl.h
diff --git a/drlvm/vm/em/src/DrlProfileCollectionFramework.h b/drlvm/modules/vm/src/main/native/em/shared/DrlProfileCollectionFramework.h
similarity index 100%
rename from drlvm/vm/em/src/DrlProfileCollectionFramework.h
rename to drlvm/modules/vm/src/main/native/em/shared/DrlProfileCollectionFramework.h
diff --git a/drlvm/vm/em/src/EBProfileCollector.cpp b/drlvm/modules/vm/src/main/native/em/shared/EBProfileCollector.cpp
similarity index 100%
rename from drlvm/vm/em/src/EBProfileCollector.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/EBProfileCollector.cpp
diff --git a/drlvm/vm/em/src/EBProfileCollector.h b/drlvm/modules/vm/src/main/native/em/shared/EBProfileCollector.h
similarity index 100%
rename from drlvm/vm/em/src/EBProfileCollector.h
rename to drlvm/modules/vm/src/main/native/em/shared/EBProfileCollector.h
diff --git a/drlvm/vm/em/src/EdgeProfileCollector.cpp b/drlvm/modules/vm/src/main/native/em/shared/EdgeProfileCollector.cpp
similarity index 100%
rename from drlvm/vm/em/src/EdgeProfileCollector.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/EdgeProfileCollector.cpp
diff --git a/drlvm/vm/em/src/EdgeProfileCollector.h b/drlvm/modules/vm/src/main/native/em/shared/EdgeProfileCollector.h
similarity index 100%
rename from drlvm/vm/em/src/EdgeProfileCollector.h
rename to drlvm/modules/vm/src/main/native/em/shared/EdgeProfileCollector.h
diff --git a/drlvm/vm/em/src/MTable.cpp b/drlvm/modules/vm/src/main/native/em/shared/MTable.cpp
similarity index 100%
rename from drlvm/vm/em/src/MTable.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/MTable.cpp
diff --git a/drlvm/vm/em/src/MTable.h b/drlvm/modules/vm/src/main/native/em/shared/MTable.h
similarity index 100%
rename from drlvm/vm/em/src/MTable.h
rename to drlvm/modules/vm/src/main/native/em/shared/MTable.h
diff --git a/drlvm/vm/em/src/NValueProfileCollector.cpp b/drlvm/modules/vm/src/main/native/em/shared/NValueProfileCollector.cpp
similarity index 100%
rename from drlvm/vm/em/src/NValueProfileCollector.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/NValueProfileCollector.cpp
diff --git a/drlvm/vm/em/src/NValueProfileCollector.h b/drlvm/modules/vm/src/main/native/em/shared/NValueProfileCollector.h
similarity index 100%
rename from drlvm/vm/em/src/NValueProfileCollector.h
rename to drlvm/modules/vm/src/main/native/em/shared/NValueProfileCollector.h
diff --git a/drlvm/vm/em/src/em_intf.cpp b/drlvm/modules/vm/src/main/native/em/shared/em_intf.cpp
similarity index 100%
rename from drlvm/vm/em/src/em_intf.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/em_intf.cpp
diff --git a/drlvm/vm/em/src/method_lookup.cpp b/drlvm/modules/vm/src/main/native/em/shared/method_lookup.cpp
similarity index 100%
rename from drlvm/vm/em/src/method_lookup.cpp
rename to drlvm/modules/vm/src/main/native/em/shared/method_lookup.cpp
diff --git a/drlvm/vm/em/src/method_lookup.h b/drlvm/modules/vm/src/main/native/em/shared/method_lookup.h
similarity index 100%
rename from drlvm/vm/em/src/method_lookup.h
rename to drlvm/modules/vm/src/main/native/em/shared/method_lookup.h
diff --git a/drlvm/modules/vm/src/main/native/em/unix/exports.txt b/drlvm/modules/vm/src/main/native/em/unix/exports.txt
new file mode 100644
index 0000000..46b023a
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/em/unix/exports.txt
@@ -0,0 +1 @@
+EmInitialize
diff --git a/drlvm/modules/vm/src/main/native/em/unix/makefile b/drlvm/modules/vm/src/main/native/em/unix/makefile
new file mode 100644
index 0000000..16e1c98
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/em/unix/makefile
@@ -0,0 +1,45 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'em'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/em/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)vmcore/include $(INCLUDES)
+
+BUILDFILES := \
+  DrlEMImpl.o EBProfileCollector.o EdgeProfileCollector.o MTable.o \
+  NValueProfileCollector.o em_intf.o method_lookup.o
+
+OSLIBS += $(STDCLIBS)
+MDLLIBFILES += $(DLLPATH)default/libharmonyvm$(HY_LINKLIB_SUFFIX) \
+  $(LIBPATH)libapr-1.a
+
+DLLNAME = $(DLLPATH)default/libem$(HY_SHLIB_SUFFIX)
+EXPNAME = EM_0.1
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/dec_base.cpp b/drlvm/modules/vm/src/main/native/encoder/shared/x86/dec_base.cpp
similarity index 99%
rename from drlvm/vm/port/src/encoder/ia32_em64t/dec_base.cpp
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/dec_base.cpp
index 77d61b1..d04968d 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/dec_base.cpp
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/dec_base.cpp
@@ -172,7 +172,7 @@
     return tmp.size;
 }
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #define EXTEND_REG(reg, flag)                        \
     ((NULL == rex || 0 == rex->flag) ? reg : (reg + 8))
 #else
@@ -301,7 +301,7 @@
         *pbuf += 4;
         }        
         return true;
-#ifdef _EM64T_
+#ifdef HYX86_64
     case OpcodeByteKind_io:
         {
         long long int ival = *(long long int*)*pbuf;
@@ -338,12 +338,12 @@
         char *opcode_ptr = const_cast<char *>(odesc.opcode);
         int opcode_len = odesc.opcode_len;
         Rex *prex = NULL;
-#ifdef _EM64T_
+#ifdef HYX86_64
         Rex rex;
 #endif
 
         *pbuf = save_pbuf;
-#ifdef _EM64T_
+#ifdef HYX86_64
         // Match REX prefixes
         unsigned char rex_byte = (*pbuf)[0];
         if ((rex_byte & 0xf0) == 0x40)
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/dec_base.h b/drlvm/modules/vm/src/main/native/encoder/shared/x86/dec_base.h
similarity index 100%
rename from drlvm/vm/port/src/encoder/ia32_em64t/dec_base.h
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/dec_base.h
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/enc_base.cpp b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.cpp
similarity index 98%
rename from drlvm/vm/port/src/encoder/ia32_em64t/enc_base.cpp
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.cpp
index 208ad7d..c1827c8 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/enc_base.cpp
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.cpp
@@ -122,7 +122,7 @@
         else {
             modrm.mod = 3; // 11
             modrm.rm = getHWRegIndex(opnds[memidx].reg());
-#ifdef _EM64T_
+#ifdef HYX86_64
             if (opnds[memidx].need_rex() && needs_rex_r(opnds[memidx].reg())) {
                 prex->b = 1;
             }
@@ -130,7 +130,7 @@
             ++stream;
         }
         modrm.reg = getHWRegIndex(opnds[regidx].reg());
-#ifdef _EM64T_
+#ifdef HYX86_64
         if (opnds[regidx].need_rex() && needs_rex_r(opnds[regidx].reg())) {
             prex->r = 1;
         }
@@ -156,7 +156,7 @@
         else {
             modrm.mod = 3; // 11
             modrm.rm = getHWRegIndex(opnds[idx].reg());
-#ifdef _EM64T_
+#ifdef HYX86_64
             if (opnds[idx].need_rex() && needs_rex_r(opnds[idx].reg())) {
                 prex->b = 1;
             }
@@ -184,9 +184,9 @@
     case OpcodeByteKind_ib>>8:
     case OpcodeByteKind_iw>>8:
     case OpcodeByteKind_id>>8:
-#ifdef _EM64T_
+#ifdef HYX86_64
     case OpcodeByteKind_io>>8:
-#endif //_EM64T_
+#endif //HYX86_64
         //  ib, iw, id - A 1-byte (ib), 2-byte (iw), or 4-byte (id) 
         //  immediate operand to the instruction that follows the 
         //  opcode, ModR/M bytes or scale-indexing bytes. The opcode 
@@ -208,7 +208,7 @@
                 *(unsigned*)stream = (unsigned)opnds[idx].imm();
                 stream += 4;
             }
-#ifdef _EM64T_
+#ifdef HYX86_64
             else {
                 assert(kind == OpcodeByteKind_io);
                 *(long long*)stream = (long long)opnds[idx].imm();
@@ -254,7 +254,7 @@
         const unsigned lowByte = (byte & OpcodeByteKind_OpcodeMask);
         *(unsigned char*)stream = (unsigned char)lowByte + 
                                    getHWRegIndex(opnds[*pargsCount].reg());
-#ifdef _EM64T_
+#ifdef HYX86_64
         if (opnds[*pargsCount].need_rex() && needs_rex_r(opnds[*pargsCount].reg())) {
         prex->b = 1;
         }
@@ -288,7 +288,7 @@
 #endif
 
     const OpcodeDesc * odesc = lookup(mn, opnds);
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
     bool copy_opcode = true;
     Rex *prex = NULL;
 #else
@@ -460,7 +460,7 @@
         // ... yes - only have disp
         // On EM64T, the simply [disp] addressing means 'RIP-based' one - 
         // must have to use SIB to encode 'DS: based'
-#ifdef _EM64T_
+#ifdef HYX86_64
         modrm.mod = 0;  // 00 - ..
         modrm.rm = 4;   // 100 - have SIB
         
@@ -562,12 +562,12 @@
         // the only reason we're here without index, is that we have {E|R}SP 
         // or R12 as a base. Another possible reason - EBP without a disp - 
         // is handled above by adding a fake disp8
-#ifdef _EM64T_
+#ifdef HYX86_64
         assert(op.base() != RegName_Null && (equals(op.base(), REG_STACK) || 
                                              equals(op.base(), RegName_R12)));
-#else  // _EM64T_
+#else  // HYX86_64
         assert(op.base() != RegName_Null && equals(op.base(), REG_STACK));
-#endif //_EM64T_
+#endif //HYX86_64
         sib.scale = 0;  // SS = 00
         sib.index = 4;  // SS + index=100 means 'no index'
     }
@@ -757,7 +757,7 @@
     assert(!odesc->last);
     assert(odesc->roles.count == opnds.count());
     assert(odesc->platf != OpcodeInfo::decoder);
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
     // tuning was done for IA32 only, so no size restriction on EM64T
     //assert(sizeof(OpcodeDesc)==128);
 #endif
@@ -885,7 +885,7 @@
 }
 
 registers[] = {
-#ifdef _EM64T_
+#ifdef HYX86_64
     {"RAX",         RegName_RAX},
     {"RBX",         RegName_RBX},
     {"RCX",         RegName_RCX},
@@ -912,7 +912,7 @@
     {"EBP",         RegName_EBP},
     {"ESI",         RegName_ESI},
     {"EDI",         RegName_EDI},
-#ifdef _EM64T_
+#ifdef HYX86_64
     {"R8D",         RegName_R8D},
     {"R9D",         RegName_R9D},
     {"R10D",        RegName_R10D},
@@ -936,7 +936,7 @@
     {"CL",          RegName_CL},
     {"DL",          RegName_DL},
     {"BL",          RegName_BL},
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
     {"AH",          RegName_AH},
     {"CH",          RegName_CH},
     {"DH",          RegName_DH},
@@ -998,7 +998,7 @@
     {"XMM5",        RegName_XMM5},
     {"XMM6",        RegName_XMM6},
     {"XMM7",        RegName_XMM7},
-#ifdef _EM64T_
+#ifdef HYX86_64
     {"XMM8",       RegName_XMM8},
     {"XMM9",       RegName_XMM9},
     {"XMM10",      RegName_XMM10},
@@ -1018,7 +1018,7 @@
     {"XMM5S",       RegName_XMM5S},
     {"XMM6S",       RegName_XMM6S},
     {"XMM7S",       RegName_XMM7S},
-#ifdef _EM64T_
+#ifdef HYX86_64
     {"XMM8S",       RegName_XMM8S},
     {"XMM9S",       RegName_XMM9S},
     {"XMM10S",      RegName_XMM10S},
@@ -1037,7 +1037,7 @@
     {"XMM5D",       RegName_XMM5D},
     {"XMM6D",       RegName_XMM6D},
     {"XMM7D",       RegName_XMM7D},
-#ifdef _EM64T_
+#ifdef HYX86_64
     {"XMM8D",       RegName_XMM8D},
     {"XMM9D",       RegName_XMM9D},
     {"XMM10D",      RegName_XMM10D},
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/enc_base.h b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.h
similarity index 99%
rename from drlvm/vm/port/src/encoder/ia32_em64t/enc_base.h
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.h
index 7f53fae..6a794a1 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/enc_base.h
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_base.h
@@ -400,7 +400,7 @@
          */
         unsigned hash(void) const { return m_hash; }
         //
-#ifdef _EM64T_
+#ifdef HYX86_64
         bool need_rex(void) const { return m_need_rex; }
 #else
         bool need_rex(void) const { return false; }
@@ -475,7 +475,7 @@
         void hash_it(void)
         {
             m_hash = size_hash[m_size] | kind_hash[m_kind];
-#ifdef _EM64T_
+#ifdef HYX86_64
             m_need_rex = false;
             if (is_reg() && is_em64t_extra_reg(m_reg)) {
                 m_need_rex = true;
@@ -544,7 +544,7 @@
             m_operands[m_count++] = op;
             m_need_rex = m_need_rex || op.m_need_rex;
         }
-#ifdef _EM64T_
+#ifdef HYX86_64
         bool need_rex(void) const { return m_need_rex; }
 #else
         bool need_rex(void) const { return false; }
@@ -584,7 +584,7 @@
     static char* encode_aux(char* stream, unsigned aux, 
                             const Operands& opnds, const OpcodeDesc * odesc,
                             unsigned * pargsCount, Rex* prex);
-#ifdef _EM64T_
+#ifdef HYX86_64
     /**
      * @brief Returns true if the 'reg' argument represents one of the new 
      *        EM64T registers - R8(D)-R15(D).
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/enc_defs.h b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_defs.h
similarity index 98%
rename from drlvm/vm/port/src/encoder/ia32_em64t/enc_defs.h
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_defs.h
index 4661652..f4231c3 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/enc_defs.h
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_defs.h
@@ -40,7 +40,7 @@
     #define COUNTOF(a)      (sizeof(a)/sizeof(a[0]))
 #endif
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /**
      * A stack pointer of default platform's size.
      */
@@ -166,7 +166,7 @@
 
     RegName_Null = 0, 
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /*
     An index part of the RegName-s for RAX-RDI, EAX-ESI, AX-SI and AL-BH is 
     the same as the index used during instructions encoding. The same rule 
@@ -191,7 +191,7 @@
     RegName_R13 = REGNAME(OpndKind_GPReg,OpndSize_64,13),
     RegName_R14 = REGNAME(OpndKind_GPReg,OpndSize_64,14),
     RegName_R15 = REGNAME(OpndKind_GPReg,OpndSize_64,15),
-#endif //~_EM64T_
+#endif //~HYX86_64
 
     RegName_EAX=REGNAME(OpndKind_GPReg,OpndSize_32,0),
     RegName_ECX=REGNAME(OpndKind_GPReg,OpndSize_32,1),
@@ -202,7 +202,7 @@
     RegName_ESI=REGNAME(OpndKind_GPReg,OpndSize_32,6),
     RegName_EDI=REGNAME(OpndKind_GPReg,OpndSize_32,7),
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_R8D  = REGNAME(OpndKind_GPReg,OpndSize_32,8),
     RegName_R9D  = REGNAME(OpndKind_GPReg,OpndSize_32,9),
     RegName_R10D = REGNAME(OpndKind_GPReg,OpndSize_32,10),
@@ -211,7 +211,7 @@
     RegName_R13D = REGNAME(OpndKind_GPReg,OpndSize_32,13),
     RegName_R14D = REGNAME(OpndKind_GPReg,OpndSize_32,14),
     RegName_R15D = REGNAME(OpndKind_GPReg,OpndSize_32,15),
-#endif //~_EM64T_
+#endif //~HYX86_64
 
     RegName_AX=REGNAME(OpndKind_GPReg,OpndSize_16,0),
     RegName_CX=REGNAME(OpndKind_GPReg,OpndSize_16,1),
@@ -222,7 +222,7 @@
     RegName_SI=REGNAME(OpndKind_GPReg,OpndSize_16,6),
     RegName_DI=REGNAME(OpndKind_GPReg,OpndSize_16,7),
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_R8S  = REGNAME(OpndKind_GPReg,OpndSize_16,8),
     RegName_R9S  = REGNAME(OpndKind_GPReg,OpndSize_16,9),
     RegName_R10S = REGNAME(OpndKind_GPReg,OpndSize_16,10),
@@ -231,7 +231,7 @@
     RegName_R13S = REGNAME(OpndKind_GPReg,OpndSize_16,13),
     RegName_R14S = REGNAME(OpndKind_GPReg,OpndSize_16,14),
     RegName_R15S = REGNAME(OpndKind_GPReg,OpndSize_16,15),
-#endif //~_EM64T_
+#endif //~HYX86_64
     
     RegName_AL=REGNAME(OpndKind_GPReg,OpndSize_8,0),
     RegName_CL=REGNAME(OpndKind_GPReg,OpndSize_8,1),
@@ -241,7 +241,7 @@
     // AH is not accessible on EM64T, instead encoded register is SPL, so decoded
     // register will return incorrect enum
     RegName_AH=REGNAME(OpndKind_GPReg,OpndSize_8,4),
-#if !defined(_EM64T_)    
+#if !defined(HYX86_64)    
     RegName_CH=REGNAME(OpndKind_GPReg,OpndSize_8,5),
     RegName_DH=REGNAME(OpndKind_GPReg,OpndSize_8,6),
     RegName_BH=REGNAME(OpndKind_GPReg,OpndSize_8,7),
@@ -307,7 +307,7 @@
     RegName_XMM6=REGNAME(OpndKind_XMMReg,OpndSize_128,6),
     RegName_XMM7=REGNAME(OpndKind_XMMReg,OpndSize_128,7),
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_XMM8  = REGNAME(OpndKind_XMMReg,OpndSize_128,0), 
     RegName_XMM9  = REGNAME(OpndKind_XMMReg,OpndSize_128,1),
     RegName_XMM10 = REGNAME(OpndKind_XMMReg,OpndSize_128,2),
@@ -316,7 +316,7 @@
     RegName_XMM13 = REGNAME(OpndKind_XMMReg,OpndSize_128,5),
     RegName_XMM14 = REGNAME(OpndKind_XMMReg,OpndSize_128,6),
     RegName_XMM15 = REGNAME(OpndKind_XMMReg,OpndSize_128,7),
-#endif //~_EM64T_
+#endif //~HYX86_64
 
 #endif  // ~TESTING_ENCODER
 
@@ -328,7 +328,7 @@
     RegName_XMM5S=REGNAME(OpndKind_XMMReg,OpndSize_32,5),
     RegName_XMM6S=REGNAME(OpndKind_XMMReg,OpndSize_32,6),
     RegName_XMM7S=REGNAME(OpndKind_XMMReg,OpndSize_32,7),
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_XMM8S=REGNAME(OpndKind_XMMReg,OpndSize_32,8), 
     RegName_XMM9S=REGNAME(OpndKind_XMMReg,OpndSize_32,9),
     RegName_XMM10S=REGNAME(OpndKind_XMMReg,OpndSize_32,10),
@@ -337,7 +337,7 @@
     RegName_XMM13S=REGNAME(OpndKind_XMMReg,OpndSize_32,13),
     RegName_XMM14S=REGNAME(OpndKind_XMMReg,OpndSize_32,14),
     RegName_XMM15S=REGNAME(OpndKind_XMMReg,OpndSize_32,15),
-#endif // ifdef _EM64T_
+#endif // ifdef HYX86_64
     RegName_XMM0D=REGNAME(OpndKind_XMMReg,OpndSize_64,0), 
     RegName_XMM1D=REGNAME(OpndKind_XMMReg,OpndSize_64,1),
     RegName_XMM2D=REGNAME(OpndKind_XMMReg,OpndSize_64,2),
@@ -346,7 +346,7 @@
     RegName_XMM5D=REGNAME(OpndKind_XMMReg,OpndSize_64,5),
     RegName_XMM6D=REGNAME(OpndKind_XMMReg,OpndSize_64,6),
     RegName_XMM7D=REGNAME(OpndKind_XMMReg,OpndSize_64,7),
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_XMM8D=REGNAME(OpndKind_XMMReg,OpndSize_64,8), 
     RegName_XMM9D=REGNAME(OpndKind_XMMReg,OpndSize_64,9),
     RegName_XMM10D=REGNAME(OpndKind_XMMReg,OpndSize_64,10),
@@ -355,7 +355,7 @@
     RegName_XMM13D=REGNAME(OpndKind_XMMReg,OpndSize_64,13),
     RegName_XMM14D=REGNAME(OpndKind_XMMReg,OpndSize_64,14),
     RegName_XMM15D=REGNAME(OpndKind_XMMReg,OpndSize_64,15),
-#endif // ifdef _EM64T_
+#endif // ifdef HYX86_64
 #ifdef _HAVE_MMX_
     RegName_MMX0=REGNAME(OpndKind_MMXReg,OpndSize_64,0),
     RegName_MMX1=REGNAME(OpndKind_MMXReg,OpndSize_64,1),
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/enc_prvt.h b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_prvt.h
similarity index 98%
rename from drlvm/vm/port/src/encoder/ia32_em64t/enc_prvt.h
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_prvt.h
index 453b30d..09f01c7 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/enc_prvt.h
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_prvt.h
@@ -42,7 +42,7 @@
     OpcodeByteKind_ib                       = 0x0400,
     OpcodeByteKind_iw                       = 0x0500,
     OpcodeByteKind_id                       = 0x0600,
-#ifdef _EM64T_
+#ifdef HYX86_64
     OpcodeByteKind_io                       = 0x0700,
 #endif
     OpcodeByteKind_cb                       = 0x0800,
@@ -55,7 +55,7 @@
     OpcodeByteKind_rb                       = 0x0E00,
     OpcodeByteKind_rw                       = 0x0F00,
     OpcodeByteKind_rd                       = 0x1000,
-#ifdef _EM64T_
+#ifdef HYX86_64
     OpcodeByteKind_ro                       = 0x1100,
     //OpcodeByteKind_REX                    = 0x1200,
     OpcodeByteKind_REX_W                    = 0x1300,
@@ -139,36 +139,36 @@
 #define AH          {OpndKind_GPReg, OpndSize_8, RegName_AH}
 #define AX          {OpndKind_GPReg, OpndSize_16, RegName_AX}
 #define EAX         {OpndKind_GPReg, OpndSize_32, RegName_EAX}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define RAX     {OpndKind_GPReg, OpndSize_64, RegName_RAX }
 #endif
 
 #define CL          {OpndKind_GPReg, OpndSize_8, RegName_CL}
 #define ECX         {OpndKind_GPReg, OpndSize_32, RegName_ECX}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define RCX         {OpndKind_GPReg, OpndSize_64, RegName_RCX}
 #endif
 
 #define DX          {OpndKind_GPReg, OpndSize_16, RegName_DX}
 #define EDX         {OpndKind_GPReg, OpndSize_32, RegName_EDX}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define RDX     { OpndKind_GPReg, OpndSize_64, RegName_RDX }
 #endif
 
 #define ESI         {OpndKind_GPReg, OpndSize_32, RegName_ESI}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define RSI     { OpndKind_GPReg, OpndSize_64, RegName_RSI }
 #endif
 
 #define EDI         {OpndKind_GPReg, OpndSize_32, RegName_EDI}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define RDI     { OpndKind_GPReg, OpndSize_64, RegName_RDI }
 #endif
 
 #define r8          {OpndKind_GPReg, OpndSize_8, RegName_Null}
 #define r16         {OpndKind_GPReg, OpndSize_16, RegName_Null}
 #define r32         {OpndKind_GPReg, OpndSize_32, RegName_Null}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define r64     { OpndKind_GPReg, OpndSize_64, RegName_Null }
 #endif
 
@@ -183,14 +183,14 @@
 #define m16         {OpndKind_Mem, OpndSize_16, RegName_Null}
 #define m32         {OpndKind_Mem, OpndSize_32, RegName_Null}
 #define m64         {OpndKind_Mem, OpndSize_64, RegName_Null}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define r_m64   { (OpndKind)(OpndKind_GPReg|OpndKind_Mem),      OpndSize_64, RegName_Null }
 #endif
 
 #define imm8        {OpndKind_Imm, OpndSize_8, RegName_Null}
 #define imm16       {OpndKind_Imm, OpndSize_16, RegName_Null}
 #define imm32       {OpndKind_Imm, OpndSize_32, RegName_Null}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define imm64   {OpndKind_Imm, OpndSize_64, RegName_Null }
 #endif
 
@@ -199,7 +199,7 @@
 #define moff8        {OpndKind_Imm, OpndSize_32, RegName_Null}
 #define moff16       {OpndKind_Imm, OpndSize_32, RegName_Null}
 #define moff32       {OpndKind_Imm, OpndSize_32, RegName_Null}
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define moff64       {OpndKind_Imm, OpndSize_64, RegName_Null}
 #endif
 
@@ -224,7 +224,7 @@
 #define fp32        {OpndKind_FPReg, OpndSize_32, RegName_Null}
 #define fp64        {OpndKind_FPReg, OpndSize_64, RegName_Null}
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define io      OpcodeByteKind_io
     #define REX_W   OpcodeByteKind_REX_W
 
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_tabl.cpp
similarity index 99%
rename from drlvm/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_tabl.cpp
index 4a46572..f4b3b1f 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/enc_tabl.cpp
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/enc_tabl.cpp
@@ -28,9 +28,9 @@
 
 
 // need to use EM64T-specifics - new registers, defines from enc_prvt, etc...
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
     #define UNDEF_EM64T
-    #define _EM64T_
+    #define HYX86_64
 #endif
 
 #define USE_ENCODER_DEFINES
@@ -38,7 +38,7 @@
 #include "enc_defs.h"
 
 #ifdef UNDEF_EM64T
-    #undef _EM64T_
+    #undef HYX86_64
 #endif
 
 #if !defined(_HAVE_MMX_)
@@ -942,7 +942,7 @@
 
 BEGIN_MNEMONIC(IDIV, MF_AFFECTS_FLAGS, DU_DU_U)
 BEGIN_OPCODES()
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
     {OpcodeInfo::all,   {0xF6, _7},         {AH, AL, r_m8},     DU_DU_U },
     {OpcodeInfo::all,   {Size16, 0xF7, _7}, {DX, AX, r_m16},    DU_DU_U },
 #endif
@@ -1698,7 +1698,7 @@
             break;
         }
         odesc.last = 0;
-#ifdef _EM64T_
+#ifdef HYX86_64
         if (oinfo.platf == OpcodeInfo::ia32) { continue; }
         if (oinfo.platf == OpcodeInfo::decoder32) { continue; }
 #else
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.cpp b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.cpp
similarity index 98%
rename from drlvm/vm/port/src/encoder/ia32_em64t/encoder.cpp
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.cpp
index 7c1fc7a..032ea82 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.cpp
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.cpp
@@ -35,7 +35,7 @@
 
 
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 
 R_Opnd rax_opnd(rax_reg);
 R_Opnd rcx_opnd(rcx_reg);
@@ -75,7 +75,7 @@
 R_Opnd esi_opnd(esi_reg);
 R_Opnd edi_opnd(edi_reg);
 
-#endif //_EM64T_
+#endif //HYX86_64
 
 XMM_Opnd xmm0_opnd(xmm0_reg);
 XMM_Opnd xmm1_opnd(xmm1_reg);
@@ -95,7 +95,7 @@
 extern const Mnemonic map_of_shift_opcode_2_mnemonic[];
 
 const RegName map_of_regno_2_regname [] = {
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_RAX,    RegName_RBX,    RegName_RCX,    RegName_RDX,
     RegName_RDI,    RegName_RSI,    RegName_RSP,    RegName_RBP,
     RegName_R8,     RegName_R9,     RegName_R10,    RegName_R11,
@@ -111,7 +111,7 @@
     RegName_XMM0,   RegName_XMM1,   RegName_XMM2,   RegName_XMM3,
     RegName_XMM4,   RegName_XMM5,   RegName_XMM6,   RegName_XMM7,
     RegName_FS,
-#endif  // _EM64T_
+#endif  // HYX86_64
 
     RegName_Null,
 };
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.h b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.h
similarity index 98%
rename from drlvm/vm/port/src/encoder/ia32_em64t/encoder.h
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.h
index fb7a6a6..9b69cbc 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.h
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.h
@@ -22,7 +22,7 @@
  * @brief Simple interface for generating processor instructions.
  *
  * The interface works for both IA32 and EM64T. By default, only IA32 
- * capabilities are presented. To enable EM64T feature, the _EM64T_ macro 
+ * capabilities are presented. To enable EM64T feature, the HYX86_64 macro 
  * must be defined (and, of course, a proper library version to be used).
  * 
  * The interface is based on the original ia32.h encoder interface,
@@ -40,7 +40,7 @@
 #include "enc_base.h"
 #include "open/types.h"
 
-#ifdef _EM64T_ 
+#ifdef HYX86_64 
 // size of general-purpose value on the stack in bytes
 #define GR_STACK_SIZE 8
 // size of floating-point value on the stack in bytes
@@ -75,7 +75,7 @@
 #endif
 
 enum Reg_No {
-#ifdef _EM64T_
+#ifdef HYX86_64
     rax_reg = 0,rbx_reg,    rcx_reg,    rdx_reg,
     rdi_reg,    rsi_reg,    rsp_reg,    rbp_reg,
     r8_reg,     r9_reg,     r10_reg,    r11_reg,
@@ -85,7 +85,7 @@
     xmm8_reg,   xmm9_reg,   xmm10_reg,  xmm11_reg,
     xmm12_reg,  xmm13_reg,  xmm14_reg,  xmm15_reg,
 
-#else   // !defined(_EM64T_)
+#else   // !defined(HYX86_64)
 
     eax_reg = 0,ebx_reg,    ecx_reg,    edx_reg,
     edi_reg,    esi_reg,    esp_reg,    ebp_reg,        
@@ -105,7 +105,7 @@
     size_32,
     size_64,
     n_size,
-#ifdef _EM64T_
+#ifdef HYX86_64
     size_platf = size_64
 #else
     size_platf = size_32
@@ -217,7 +217,7 @@
 
 protected:
     union {
-#ifdef _EM64T_
+#ifdef HYX86_64
         int64           value;
         unsigned char   bytes[8];
 #else
@@ -238,7 +238,7 @@
     }
     Imm_Opnd(const Imm_Opnd& that): Opnd(Imm), value(that.value), size(that.size) {};
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     Imm_Opnd(Opnd_Size sz, int64 val): Opnd(Imm), value(val), size(sz) {
 #ifndef NDEBUG
         switch (size) {
@@ -392,7 +392,7 @@
 //
 // operand structures for ia32 registers
 //
-#ifdef _EM64T_
+#ifdef HYX86_64
 
 extern R_Opnd rax_opnd;
 extern R_Opnd rcx_opnd;
@@ -431,7 +431,7 @@
 extern R_Opnd esi_opnd;
 extern R_Opnd edi_opnd;
 
-#endif // _EM64T_
+#endif // HYX86_64
 
 extern XMM_Opnd xmm0_opnd;
 extern XMM_Opnd xmm1_opnd;
diff --git a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.inl b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.inl
similarity index 99%
rename from drlvm/vm/port/src/encoder/ia32_em64t/encoder.inl
rename to drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.inl
index 32e8125..df59f7d 100644
--- a/drlvm/vm/port/src/encoder/ia32_em64t/encoder.inl
+++ b/drlvm/modules/vm/src/main/native/encoder/shared/x86/encoder.inl
@@ -114,7 +114,7 @@
 
 ENCODER_DECLARE_EXPORT char * push(char * stream, const Imm_Opnd & imm) {
     EncoderBase::Operands args;
-#ifdef _EM64T_
+#ifdef HYX86_64
     add_imm(args, imm);
 #else
     // we need this workaround to be compatible with the former ia32 encoder implementation
@@ -289,7 +289,7 @@
 // divide instructions: div, idiv
 ENCODER_DECLARE_EXPORT char * idiv(char * stream, const RM_Opnd & rm, Opnd_Size sz) {
     EncoderBase::Operands args;
-#ifdef _EM64T_
+#ifdef HYX86_64
     add_r(args, rdx_opnd, sz);
     add_r(args, rax_opnd, sz);
 #else
@@ -602,7 +602,7 @@
  *       destroyed).
  */
 ENCODER_DECLARE_EXPORT char * jump(char * stream, char * target) {
-#ifdef _EM64T_
+#ifdef HYX86_64
     int64 offset = target - stream;
     // sub 2 bytes for the short version
     offset -= 2;
@@ -698,7 +698,7 @@
 */
 ENCODER_DECLARE_EXPORT char * call(char * stream, const char * target)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     int64 offset = target - stream;
     if (fit32(offset)) {
         offset -= 5; // sub 5 bytes for this instruction
diff --git a/drlvm/modules/vm/src/main/native/encoder/unix/makefile b/drlvm/modules/vm/src/main/native/encoder/unix/makefile
new file mode 100644
index 0000000..6bd3d67
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/encoder/unix/makefile
@@ -0,0 +1,50 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'encoder'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/port/native/encoder/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE
+
+INCLUDES := -I$(VM_HOME)port/include -I$(VM_HOME)include $(INCLUDES)
+
+OPT += -fno-exceptions -Wno-deprecated -g -O2
+
+HDKINCLUDES = $(HY_HDK)/include/dec_base.h $(HY_HDK)/include/enc_base.h \
+  $(HY_HDK)/include/enc_prvt.h $(HY_HDK)/include/enc_defs.h \
+  $(HY_HDK)/include/encoder.h $(HY_HDK)/include/encoder.inl
+BUILDFILES = dec_base.o enc_base.o encoder.o enc_tabl.o
+LIBNAME = $(LIBPATH)libencoder.a
+
+include $(HY_HDK)/build/make/rules.mk
+
+$(HY_BIN)%.o: $(SHAREDSUB)$(HY_ARCH_FAMILY)/%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_HDK)/include/%.h: $(SHAREDSUB)$(HY_ARCH_FAMILY)/%.h
+	mkdir -p $(@D)
+	cp -p $< $@
+
+$(HY_HDK)/include/%.inl: $(SHAREDSUB)$(HY_ARCH_FAMILY)/%.inl
+	mkdir -p $(@D)
+	cp -p $< $@
diff --git a/drlvm/vm/gc_gen/src/COPYRIGHT b/drlvm/modules/vm/src/main/native/gc_gen/shared/COPYRIGHT
similarity index 100%
rename from drlvm/vm/gc_gen/src/COPYRIGHT
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/COPYRIGHT
diff --git a/drlvm/vm/gc_gen/src/LICENSE b/drlvm/modules/vm/src/main/native/gc_gen/shared/LICENSE
similarity index 100%
rename from drlvm/vm/gc_gen/src/LICENSE
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/LICENSE
diff --git a/drlvm/vm/gc_gen/src/NOTICE b/drlvm/modules/vm/src/main/native/gc_gen/shared/NOTICE
similarity index 100%
rename from drlvm/vm/gc_gen/src/NOTICE
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/NOTICE
diff --git a/drlvm/vm/gc_gen/src/common/collection_scheduler.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/collection_scheduler.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/collection_scheduler.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/collection_scheduler.cpp
diff --git a/drlvm/vm/gc_gen/src/common/collection_scheduler.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/collection_scheduler.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/collection_scheduler.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/collection_scheduler.h
diff --git a/drlvm/vm/gc_gen/src/common/compressed_ref.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/compressed_ref.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/compressed_ref.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/compressed_ref.cpp
diff --git a/drlvm/vm/gc_gen/src/common/compressed_ref.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/compressed_ref.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/compressed_ref.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/compressed_ref.h
diff --git a/drlvm/vm/gc_gen/src/common/concurrent_collection_scheduler.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/concurrent_collection_scheduler.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/concurrent_collection_scheduler.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/concurrent_collection_scheduler.cpp
diff --git a/drlvm/vm/gc_gen/src/common/concurrent_collection_scheduler.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/concurrent_collection_scheduler.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/concurrent_collection_scheduler.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/concurrent_collection_scheduler.h
diff --git a/drlvm/vm/gc_gen/src/common/fix_repointed_refs.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/fix_repointed_refs.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/fix_repointed_refs.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/fix_repointed_refs.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_block.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_block.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_block.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_block.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_block.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_block.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_block.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_block.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_common.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_common.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_common.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_common.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_common.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_common.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_common.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_common.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_concurrent.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_concurrent.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_concurrent.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_concurrent.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_concurrent.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_concurrent.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_concurrent.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_concurrent.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_for_barrier.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_barrier.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_for_barrier.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_barrier.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_for_barrier.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_barrier.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_for_barrier.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_barrier.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_for_class.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_class.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_for_class.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_class.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_for_class.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_class.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_for_class.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_class.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_for_vm.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_vm.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_for_vm.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_for_vm.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_metadata.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_metadata.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_metadata.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_metadata.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_metadata.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_metadata.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_metadata.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_metadata.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_options.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_options.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_options.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_options.cpp
diff --git a/drlvm/vm/gc_gen/src/common/gc_platform.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_platform.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_platform.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_platform.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_properties.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_properties.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_properties.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_properties.h
diff --git a/drlvm/vm/gc_gen/src/common/gc_space.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_space.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/gc_space.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/gc_space.h
diff --git a/drlvm/vm/gc_gen/src/common/hashcode.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/hashcode.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/hashcode.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/hashcode.cpp
diff --git a/drlvm/vm/gc_gen/src/common/hashcode.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/hashcode.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/hashcode.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/hashcode.h
diff --git a/drlvm/vm/gc_gen/src/common/interior_pointer.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/interior_pointer.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/interior_pointer.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/interior_pointer.cpp
diff --git a/drlvm/vm/gc_gen/src/common/interior_pointer.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/interior_pointer.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/interior_pointer.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/interior_pointer.h
diff --git a/drlvm/vm/gc_gen/src/common/large_pages.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/large_pages.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/large_pages.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/large_pages.cpp
diff --git a/drlvm/vm/gc_gen/src/common/mark_scan_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/mark_scan_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/mark_scan_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/mark_scan_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/common/object_status.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/object_status.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/object_status.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/object_status.h
diff --git a/drlvm/vm/gc_gen/src/common/space_tuner.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/space_tuner.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/space_tuner.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/space_tuner.cpp
diff --git a/drlvm/vm/gc_gen/src/common/space_tuner.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/space_tuner.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/space_tuner.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/space_tuner.h
diff --git a/drlvm/vm/gc_gen/src/common/weak_roots.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/common/weak_roots.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/common/weak_roots.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/common/weak_roots.cpp
diff --git a/drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref.cpp
diff --git a/drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref.h
diff --git a/drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref_metadata.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref_metadata.cpp
diff --git a/drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref_metadata.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/finalizer_weakref/finalizer_weakref_metadata.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/finalizer_weakref/finalizer_weakref_metadata.h
diff --git a/drlvm/vm/gc_gen/src/gen/gen.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen.cpp
diff --git a/drlvm/vm/gc_gen/src/gen/gen.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen.h
diff --git a/drlvm/vm/gc_gen/src/gen/gen_adapt.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_adapt.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen_adapt.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_adapt.cpp
diff --git a/drlvm/vm/gc_gen/src/gen/gen_stats.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_stats.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen_stats.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_stats.cpp
diff --git a/drlvm/vm/gc_gen/src/gen/gen_stats.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_stats.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen_stats.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_stats.h
diff --git a/drlvm/vm/gc_gen/src/gen/gen_utils.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_utils.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/gen/gen_utils.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/gen/gen_utils.cpp
diff --git a/drlvm/vm/gc_gen/src/jni/java_natives.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_natives.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/jni/java_natives.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_natives.cpp
diff --git a/drlvm/vm/gc_gen/src/jni/java_support.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_support.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/jni/java_support.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_support.cpp
diff --git a/drlvm/vm/gc_gen/src/jni/java_support.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_support.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/jni/java_support.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/jni/java_support.h
diff --git a/drlvm/vm/gc_gen/src/los/free_area_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/los/free_area_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/los/free_area_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/los/free_area_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/los/free_area_pool.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/los/free_area_pool.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/los/free_area_pool.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/los/free_area_pool.h
diff --git a/drlvm/vm/gc_gen/src/los/lspace.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/los/lspace.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace.cpp
diff --git a/drlvm/vm/gc_gen/src/los/lspace.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/los/lspace.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace.h
diff --git a/drlvm/vm/gc_gen/src/los/lspace_alloc_collect.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace_alloc_collect.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/los/lspace_alloc_collect.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/los/lspace_alloc_collect.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/fallback_mark_scan.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/fallback_mark_scan.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/fallback_mark_scan.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace.h
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_alloc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_alloc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_alloc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_alloc.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_collect_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_collect_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_collect_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_collect_compact.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_collect_compact.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_collect_compact.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_collect_compact.h
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_extend_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_extend_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_extend_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_move_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_move_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_move_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_slide_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/mspace_slide_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/mspace_slide_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_compact/space_tune_mark_scan.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/space_tune_mark_scan.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_compact/space_tune_mark_scan.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_compact/space_tune_mark_scan.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/gc_ms.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/gc_ms.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/gc_ms.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/gc_ms.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/gc_ms.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/gc_ms.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/gc_ms.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/gc_ms.h
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/sspace_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/sspace_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/sspace_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/sspace_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/sspace_mark_concurrent.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/sspace_mark_concurrent.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/sspace_mark_concurrent.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/sspace_mark_concurrent.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace.h
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_alloc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_alloc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_alloc.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_alloc.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_alloc.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_alloc.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_alloc.h
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_chunk.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_chunk.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_chunk.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_chunk.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_chunk.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_chunk.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_chunk.h
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_compact.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_compact.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_compact.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_compact.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_concurrent_gc_stats.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_concurrent_gc_stats.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_concurrent_gc_stats.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_fallback_mark.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_fallback_mark.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_fallback_mark.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_mark.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_mark.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_mostly_concurrent.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_mostly_concurrent.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_mostly_concurrent.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_otf_concurrent.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_otf_concurrent.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_otf_concurrent.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_sweep.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_sweep.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_sweep.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_mark_sweep.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_mark_sweep.h
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_sweep.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_sweep.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_sweep.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_sweep.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_sweep_concurrent.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_sweep_concurrent.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_sweep_concurrent.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_verify.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_verify.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_verify.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_verify.cpp
diff --git a/drlvm/vm/gc_gen/src/mark_sweep/wspace_verify.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_verify.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/mark_sweep/wspace_verify.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/mark_sweep/wspace_verify.h
diff --git a/drlvm/vm/gc_gen/src/move_compact/gc_mc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/move_compact/gc_mc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/move_compact/gc_mc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/move_compact/gc_mc.cpp
diff --git a/drlvm/vm/gc_gen/src/move_compact/gc_mc.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/move_compact/gc_mc.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/move_compact/gc_mc.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/move_compact/gc_mc.h
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace.cpp
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace.h
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace_alloc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_alloc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace_alloc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_alloc.cpp
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace_forward.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_forward.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace_forward.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_forward.cpp
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_gen_ss_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace_gen_ss_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_gen_ss_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_nongen_ss_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/semi_space/sspace_nongen_ss_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/semi_space/sspace_nongen_ss_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/thread/collector.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/collector.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector.cpp
diff --git a/drlvm/vm/gc_gen/src/thread/collector.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/collector.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector.h
diff --git a/drlvm/vm/gc_gen/src/thread/collector_alloc.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector_alloc.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/collector_alloc.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/collector_alloc.h
diff --git a/drlvm/vm/gc_gen/src/thread/conclctor.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/conclctor.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/conclctor.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/conclctor.cpp
diff --git a/drlvm/vm/gc_gen/src/thread/conclctor.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/conclctor.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/conclctor.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/conclctor.h
diff --git a/drlvm/vm/gc_gen/src/thread/gc_thread.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/gc_thread.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/gc_thread.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/gc_thread.cpp
diff --git a/drlvm/vm/gc_gen/src/thread/gc_thread.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/gc_thread.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/gc_thread.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/gc_thread.h
diff --git a/drlvm/vm/gc_gen/src/thread/mutator.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/mutator.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator.cpp
diff --git a/drlvm/vm/gc_gen/src/thread/mutator.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/mutator.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator.h
diff --git a/drlvm/vm/gc_gen/src/thread/mutator_alloc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator_alloc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/thread/mutator_alloc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/thread/mutator_alloc.cpp
diff --git a/drlvm/vm/gc_gen/src/trace_forward/fspace.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/fspace.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace.cpp
diff --git a/drlvm/vm/gc_gen/src/trace_forward/fspace.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/fspace.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace.h
diff --git a/drlvm/vm/gc_gen/src/trace_forward/fspace_alloc.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_alloc.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/fspace_alloc.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_alloc.cpp
diff --git a/drlvm/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_gen_forward_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/fspace_gen_forward_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_gen_forward_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_nongen_forward_pool.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/fspace_nongen_forward_pool.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/fspace_nongen_forward_pool.cpp
diff --git a/drlvm/vm/gc_gen/src/trace_forward/sspace_temp.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/sspace_temp.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/trace_forward/sspace_temp.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/trace_forward/sspace_temp.cpp
diff --git a/drlvm/vm/gc_gen/src/utils/bidir_list.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/bidir_list.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/bidir_list.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/bidir_list.h
diff --git a/drlvm/vm/gc_gen/src/utils/bit_ops.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/bit_ops.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/bit_ops.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/bit_ops.h
diff --git a/drlvm/vm/gc_gen/src/utils/seq_list.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/seq_list.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/seq_list.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/seq_list.h
diff --git a/drlvm/vm/gc_gen/src/utils/sync_pool.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_pool.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/sync_pool.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_pool.h
diff --git a/drlvm/vm/gc_gen/src/utils/sync_queue.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_queue.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/sync_queue.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_queue.h
diff --git a/drlvm/vm/gc_gen/src/utils/sync_stack.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_stack.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/sync_stack.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/sync_stack.h
diff --git a/drlvm/vm/gc_gen/src/utils/uneven_map.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/uneven_map.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/uneven_map.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/uneven_map.h
diff --git a/drlvm/vm/gc_gen/src/utils/vector_block.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/utils/vector_block.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/utils/vector_block.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/utils/vector_block.h
diff --git a/drlvm/vm/gc_gen/src/verify/verifier_common.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_common.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verifier_common.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_common.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verifier_common.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_common.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verifier_common.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_common.h
diff --git a/drlvm/vm/gc_gen/src/verify/verifier_metadata.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_metadata.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verifier_metadata.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_metadata.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verifier_metadata.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_metadata.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verifier_metadata.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_metadata.h
diff --git a/drlvm/vm/gc_gen/src/verify/verifier_scanner.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_scanner.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verifier_scanner.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verifier_scanner.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_blocked_space.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_blocked_space.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_blocked_space.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_blocked_space.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_concurrent_mark.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_concurrent_mark.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_concurrent_mark.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_concurrent_mark.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_gc_effect.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_gc_effect.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_gc_effect.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_gc_effect.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_gc_effect.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_gc_effect.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_gc_effect.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_gc_effect.h
diff --git a/drlvm/vm/gc_gen/src/verify/verify_live_heap.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_live_heap.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_live_heap.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_live_heap.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_live_heap.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_live_heap.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_live_heap.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_live_heap.h
diff --git a/drlvm/vm/gc_gen/src/verify/verify_mutator_effect.cpp b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_mutator_effect.cpp
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_mutator_effect.cpp
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_mutator_effect.cpp
diff --git a/drlvm/vm/gc_gen/src/verify/verify_mutator_effect.h b/drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_mutator_effect.h
similarity index 100%
rename from drlvm/vm/gc_gen/src/verify/verify_mutator_effect.h
rename to drlvm/modules/vm/src/main/native/gc_gen/shared/verify/verify_mutator_effect.h
diff --git a/drlvm/modules/vm/src/main/native/gc_gen/unix/exports.txt b/drlvm/modules/vm/src/main/native/gc_gen/unix/exports.txt
new file mode 100644
index 0000000..a082306
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/gc_gen/unix/exports.txt
@@ -0,0 +1,55 @@
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_TLSGCOffset
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getGenMode
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getNosBoundary
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_helperCallback
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getPrefetchDist
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getZeroingSize
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getPrefetchStride
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getTlaFreeOffset
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getTlaCeilingOffset
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getTlaEndOffset
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getGCObjectAlignment
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getLargeObjectSize
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_isPrefetchEnabled
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getVTBase
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getArrayElemSizeOffsetInGCVT
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getArrayFirstElemOffsetInGCVT
+Java_org_apache_harmony_drlvm_gc_1gen_GCHelper_getGCAllocatedSizeOffsetInGCVT
+gc_add_compressed_root_set_entry
+gc_add_root_set_entry
+gc_add_root_set_entry_interior_pointer
+gc_add_weak_root_set_entry
+gc_alloc
+gc_alloc_fast
+gc_class_prepared
+gc_clear_mutator_block_flag
+gc_finalize_on_exit
+gc_force_gc
+gc_free_memory
+gc_get_collection_count
+gc_get_collection_time
+gc_get_hashcode
+gc_get_next_live_object
+gc_heap_base_address
+gc_heap_ceiling_address
+gc_heap_slot_write_ref
+gc_heap_write_global_slot
+gc_heap_write_ref
+gc_heap_wrote_object
+gc_heap_copy_object_array
+gc_init
+gc_is_object_pinned
+gc_iterate_heap
+gc_max_memory
+gc_pin_object
+gc_requires_barriers
+gc_set_mutator_block_flag
+gc_supports_class_unloading
+gc_supports_compressed_references
+gc_thread_init
+gc_thread_kill
+gc_time_since_last_gc
+gc_total_memory
+gc_unpin_object
+gc_vm_initialized
+gc_wrapup
diff --git a/drlvm/modules/vm/src/main/native/gc_gen/unix/makefile b/drlvm/modules/vm/src/main/native/gc_gen/unix/makefile
new file mode 100644
index 0000000..45959f8
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/gc_gen/unix/makefile
@@ -0,0 +1,81 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'gc_gen_uncomp'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/gc_gen_uncomp/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DBUILDING_GC -DREFS_USE_COMPRESSED
+
+OPT += -fexceptions
+
+INCLUDES := \
+  -I$(VM_HOME)port/include \
+  -I$(VM_HOME)include -I$(VM_HOME)vmcore/include \
+  -I$(SHAREDSUB)common \
+  $(INCLUDES)
+
+BUILDFILES := \
+  common/collection_scheduler.o common/compressed_ref.o \
+  common/concurrent_collection_scheduler.o common/gc_block.o \
+  common/gc_common.o common/gc_concurrent.o common/gc_for_barrier.o \
+  common/gc_for_class.o common/gc_for_vm.o common/gc_metadata.o \
+  common/gc_options.o common/hashcode.o common/interior_pointer.o \
+  common/large_pages.o common/mark_scan_pool.o common/space_tuner.o \
+  common/weak_roots.o \
+  finalizer_weakref/finalizer_weakref.o \
+  finalizer_weakref/finalizer_weakref_metadata.o \
+  gen/gen.o gen/gen_adapt.o gen/gen_stats.o gen/gen_utils.o \
+  jni/java_natives.o jni/java_support.o \
+  los/free_area_pool.o los/lspace.o los/lspace_alloc_collect.o \
+  mark_compact/fallback_mark_scan.o mark_compact/mspace.o \
+  mark_compact/mspace_alloc.o mark_compact/mspace_collect_compact.o \
+  mark_compact/mspace_extend_compact.o mark_compact/mspace_move_compact.o \
+  mark_compact/mspace_slide_compact.o mark_compact/space_tune_mark_scan.o \
+  mark_sweep/gc_ms.o mark_sweep/sspace_compact.o \
+  mark_sweep/sspace_mark_concurrent.o mark_sweep/wspace.o \
+  mark_sweep/wspace_alloc.o mark_sweep/wspace_chunk.o \
+  mark_sweep/wspace_compact.o mark_sweep/wspace_concurrent_gc_stats.o \
+  mark_sweep/wspace_fallback_mark.o mark_sweep/wspace_mark.o \
+  mark_sweep/wspace_mark_mostly_concurrent.o \
+  mark_sweep/wspace_mark_otf_concurrent.o mark_sweep/wspace_mark_sweep.o \
+  mark_sweep/wspace_sweep.o mark_sweep/wspace_sweep_concurrent.o \
+  mark_sweep/wspace_verify.o \
+  move_compact/gc_mc.o \
+  semi_space/sspace.o semi_space/sspace_alloc.o semi_space/sspace_forward.o \
+  semi_space/sspace_gen_ss_pool.o semi_space/sspace_nongen_ss_pool.o \
+  thread/collector.o thread/conclctor.o thread/gc_thread.o thread/mutator.o \
+  thread/mutator_alloc.o \
+  trace_forward/fspace.o trace_forward/fspace_alloc.o \
+  trace_forward/fspace_gen_forward_pool.o \
+  trace_forward/fspace_nongen_forward_pool.o trace_forward/sspace_temp.o \
+  verify/verifier_common.o verify/verifier_metadata.o \
+  verify/verifier_scanner.o verify/verify_blocked_space.o \
+  verify/verify_concurrent_mark.o verify/verify_gc_effect.o \
+  verify/verify_live_heap.o verify/verify_mutator_effect.o
+
+LDFLAGS += -Bsymbolic
+
+DLLNAME = $(DLLPATH)default/libgc_gen_uncomp$(HY_SHLIB_SUFFIX)
+EXPNAME = GC_GEN_0.1
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/thread/src/thread_classlib_defs.h b/drlvm/modules/vm/src/main/native/hythr/shared/thread_classlib_defs.h
similarity index 100%
rename from drlvm/vm/thread/src/thread_classlib_defs.h
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_classlib_defs.h
diff --git a/drlvm/vm/thread/src/thread_init.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_init.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_init.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_init.c
diff --git a/drlvm/vm/thread/src/thread_native_attrs.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_attrs.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_attrs.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_attrs.c
diff --git a/drlvm/vm/thread/src/thread_native_basic.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_basic.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_basic.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_basic.c
diff --git a/drlvm/vm/thread/src/thread_native_condvar.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_condvar.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_condvar.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_condvar.c
diff --git a/drlvm/vm/thread/src/thread_native_fat_monitor.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_fat_monitor.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_fat_monitor.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_fat_monitor.c
diff --git a/drlvm/vm/thread/src/thread_native_groups.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_groups.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_groups.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_groups.c
diff --git a/drlvm/vm/thread/src/thread_native_interrupt.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_interrupt.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_interrupt.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_interrupt.c
diff --git a/drlvm/vm/thread/src/thread_native_iterator.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_iterator.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_iterator.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_iterator.c
diff --git a/drlvm/vm/thread/src/thread_native_latch.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_latch.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_latch.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_latch.c
diff --git a/drlvm/vm/thread/src/thread_native_park.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_park.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_park.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_park.c
diff --git a/drlvm/vm/thread/src/thread_native_semaphore.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_semaphore.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_semaphore.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_semaphore.c
diff --git a/drlvm/vm/thread/src/thread_native_state.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_state.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_state.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_state.c
diff --git a/drlvm/vm/thread/src/thread_native_suspend.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_suspend.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_suspend.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_suspend.c
diff --git a/drlvm/vm/thread/src/thread_native_thin_monitor.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_thin_monitor.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_native_thin_monitor.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_thin_monitor.c
diff --git a/drlvm/vm/thread/src/thread_native_tls.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_tls.c
similarity index 98%
rename from drlvm/vm/thread/src/thread_native_tls.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_native_tls.c
index 9d94514..be9e41f 100644
--- a/drlvm/vm/thread/src/thread_native_tls.c
+++ b/drlvm/modules/vm/src/main/native/hythr/shared/thread_native_tls.c
@@ -51,7 +51,7 @@
 }
 
 #if !defined(_WIN32) && defined(HYTHREAD_FAST_TLS)
-    #if defined(_EM64T_)
+    #if defined(HYX86_64)
         #define HYTHREAD_TLS_GET_VAR_OFFSET(var,offset) \
         { \
             void* tmp1 = &var; \
@@ -62,7 +62,7 @@
         //TODO: GCC-specific, need to add ICL
         //#define HYTHREAD_TLS_GET_VAR_OFFSET(var,offset) \
         //    { void* tmp;  __asm ("movq " #var "@GOTTPOFF(%%rip), %0" : "=r" (tmp)); offset = tmp; }
-    #elif defined(_IA32_)
+    #elif defined(HYX86)
         #define HYTHREAD_TLS_GET_VAR_OFFSET(var,offset) \
         { \
             void* tmp1 = &var; \
diff --git a/drlvm/vm/thread/src/thread_ncai_common.c b/drlvm/modules/vm/src/main/native/hythr/shared/thread_ncai_common.c
similarity index 100%
rename from drlvm/vm/thread/src/thread_ncai_common.c
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_ncai_common.c
diff --git a/drlvm/vm/thread/src/thread_private.h b/drlvm/modules/vm/src/main/native/hythr/shared/thread_private.h
similarity index 100%
rename from drlvm/vm/thread/src/thread_private.h
rename to drlvm/modules/vm/src/main/native/hythr/shared/thread_private.h
diff --git a/drlvm/modules/vm/src/main/native/hythr/unix/exports.txt b/drlvm/modules/vm/src/main/native/hythr/unix/exports.txt
new file mode 100644
index 0000000..3a2c547
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/hythr/unix/exports.txt
@@ -0,0 +1,175 @@
+get_tls_helper
+hythread_allocate_library
+hythread_startup_library
+hythread_shutdown_library
+hythread_detach
+hythread_detach_ex
+hythread_tls_alloc
+hythread_sleep_interruptable
+hythread_cancel
+hythread_monitor_enter
+hythread_monitor_notify_all
+hythread_attach
+hythread_attach_ex
+hythread_monitor_destroy
+hythread_monitor_num_waiting
+hythread_interrupted
+hythread_park
+hythread_monitor_init_with_name
+hythread_monitor_try_enter
+hythread_self_slow
+hythread_self
+hythread_set_self
+tm_self_tls
+hythread_tls_free
+hythread_yield
+hythread_yield_other
+hythread_suspend
+hythread_interrupt
+hythread_tls_set
+hythread_create
+hythread_monitor_wait
+hythread_monitor_wait_interruptable
+hythread_monitor_exit
+hythread_set_priority
+hythread_unpark
+hythread_sleep
+hythread_global
+hythread_tls_alloc_with_finalizer
+hythread_monitor_wait_timed
+hythread_resume
+hythread_monitor_notify
+hythread_get_priority
+hythread_tls_get
+hythread_tls_get_request_offset
+hythread_get_hythread_offset_in_tls
+hythread_uses_fast_tls
+hythread_tls_get_offset
+hythread_get_struct_size
+hythread_global_lock
+hythread_global_unlock
+hythread_create_ex
+hythread_clear_interrupted_other
+hythread_get_self_id
+hythread_get_id
+hythread_get_thread
+hythread_get_thread_times
+hythread_struct_init
+hythread_cancel_all
+hythread_group_create
+hythread_group_release
+hythread_group_get_list
+hythread_set_to_group
+hythread_is_suspend_enabled
+hythread_suspend_enable
+hythread_suspend_disable
+hythread_exception_safe_point
+hythread_safe_point
+hythread_safe_point_other
+hythread_send_suspend_request
+hythread_suspend_other
+hythread_set_safepoint_callback
+hythread_suspend_all
+hythread_resume_all
+hythread_iterator_create
+hythread_iterator_release
+hythread_iterator_reset
+hythread_iterator_reset
+hythread_iterator_next
+hythread_iterator_has_next
+hythread_iterator_size
+hythread_thin_monitor_create
+hythread_thin_monitor_enter
+hythread_thin_monitor_try_enter
+hythread_thin_monitor_exit
+hythread_thin_monitor_release
+hythread_thin_monitor_wait
+hythread_thin_monitor_wait_timed
+hythread_thin_monitor_wait_interruptable
+hythread_thin_monitor_notify
+hythread_thin_monitor_notify_all
+hythread_thin_monitor_destroy
+hythread_thin_monitor_get_owner
+hythread_native_resource_is_live
+hythread_reclaim_resources
+hythread_suspend_thread_native
+hythread_resume_thread_native
+hythread_get_suspend_count_native
+hythread_get_thread_context
+hythread_set_thread_context
+hythread_add_task
+hythread_get_function_pointer
+hythread_get_data_pointer
+hythread_get_next_task
+hythread_destroy_task_iterator
+hythread_create_task_iterator
+hythread_init_task_manager
+hythread_destroy_task_manager
+hythread_join_all_task
+hythread_shutdown_after_execute_all_task
+hythread_get_thread_count
+hythread_get_task_count
+hysem_post
+hysem_wait
+hysem_destroy
+hycond_create
+hycond_wait
+hycond_wait_timed
+hycond_wait_timed_raw
+hycond_wait_interruptable
+hycond_notify
+hycond_notify_all
+hycond_destroy
+hylatch_create
+hylatch_wait
+hylatch_wait_timed
+hylatch_wait_interruptable
+hylatch_set
+hylatch_count_down
+hylatch_get_count
+hylatch_destroy
+hysem_create
+hysem_wait_timed
+hysem_wait_interruptable
+hysem_getvalue
+hysem_set
+hythread_exit
+hythread_is_alive
+hythread_init
+hythread_shutdown
+hythread_shutdowning
+hythread_lib_state
+hythread_lib_create
+hythread_lib_destroy
+hythread_lib_lock
+hythread_lib_unlock
+set_safepoint_callback
+hythread_inflate_lock
+hythread_is_fat_lock
+hythread_owns_thin_lock
+hythread_unreserve_lock
+hythread_set_suspend_disable
+hythread_reset_suspend_disable
+hythread_is_blocked_on_monitor_enter
+hythread_is_waiting
+hythread_is_in_native
+hythread_is_suspended
+hythread_is_parked
+hythread_is_in_monitor_wait
+hythread_is_sleeping
+hythread_is_waiting_with_timeout
+hythread_is_waiting_indefinitely
+hythread_is_runnable
+hythread_is_terminated
+hythread_thin_monitor_get_recursion
+get_java_thread_group
+tm_properties
+hythread_thread_lock
+hythread_thread_unlock
+hythread_get_state
+hythread_set_state
+hythread_get_thread_id_offset
+hythread_set_thread_stop_callback
+hythread_wait_for_nondaemon_threads
+hythread_increase_nondaemon_threads_count
+hythread_decrease_nondaemon_threads_count
diff --git a/drlvm/modules/vm/src/main/native/hythr/unix/makefile b/drlvm/modules/vm/src/main/native/hythr/unix/makefile
new file mode 100644
index 0000000..c3c9999
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/hythr/unix/makefile
@@ -0,0 +1,55 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'hythr'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/port/native/hythr/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DAPR_DECLARE_EXPORT
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)port/src/thread/include $(INCLUDES)
+
+BUILDFILES := \
+  os_condvar.o \
+  thread_init.o thread_native_attrs.o thread_native_basic.o \
+  thread_native_condvar.o thread_native_fat_monitor.o \
+  thread_native_groups.o thread_native_interrupt.o thread_native_iterator.o \
+  thread_native_latch.o thread_native_park.o thread_native_semaphore.o \
+  thread_native_state.o thread_native_suspend.o \
+  thread_native_thin_monitor.o thread_native_tls.o thread_ncai_common.o
+
+DLLNAME = $(DLLPATH)default/libhythr$(HY_SHLIB_SUFFIX)
+ifeq ($(HY_NO_THR),false)
+EXPNAME = HYTHR_0.1
+else
+EXPNAME = HYTHR_0.2
+endif
+
+OSLIBS += -lpthread -lrt
+MDLLIBFILES += $(LIBPATH)libapr-1.a $(LIBPATH)libport.a
+LDFLAGS += -Wl,-init -Wl,hythread_library_init
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/thread/src/linux/os_condvar.c b/drlvm/modules/vm/src/main/native/hythr/unix/os_condvar.c
similarity index 100%
rename from drlvm/vm/thread/src/linux/os_condvar.c
rename to drlvm/modules/vm/src/main/native/hythr/unix/os_condvar.c
diff --git a/drlvm/vm/thread/src/win/os_condvar.c b/drlvm/modules/vm/src/main/native/hythr/windows/os_condvar.c
similarity index 100%
rename from drlvm/vm/thread/src/win/os_condvar.c
rename to drlvm/modules/vm/src/main/native/hythr/windows/os_condvar.c
diff --git a/drlvm/vm/interpreter/src/interp_native_ipf.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/ia64/interp_native.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_native_ipf.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/ia64/interp_native.cpp
diff --git a/drlvm/vm/interpreter/src/interp_defs.h b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_defs.h
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_defs.h
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_defs.h
diff --git a/drlvm/vm/interpreter/src/interp_exports.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_exports.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_exports.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_exports.cpp
diff --git a/drlvm/vm/interpreter/src/interp_native.h b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_native.h
similarity index 94%
rename from drlvm/vm/interpreter/src/interp_native.h
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_native.h
index 35310d0..40219cc 100644
--- a/drlvm/vm/interpreter/src/interp_native.h
+++ b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_native.h
@@ -20,14 +20,7 @@
  */
 
 #include "vm_core_types.h"
-
-#ifdef _IPF_
-#include "../m2n_ipf_internal.h"
-#elif defined _EM64T_
-#include "../m2n_em64t_internal.h"
-#else
-#include "../m2n_ia32_internal.h"
-#endif
+#include "m2n_internal.h"
 
 /**
  * Enumerates thread-assocciated references that are not stored on the
diff --git a/drlvm/vm/interpreter/src/interp_stack_trace.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_stack_trace.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_stack_trace.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_stack_trace.cpp
diff --git a/drlvm/vm/interpreter/src/interp_vm_helpers.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_vm_helpers.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_vm_helpers.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_vm_helpers.cpp
diff --git a/drlvm/vm/interpreter/src/interp_vm_helpers.h b/drlvm/modules/vm/src/main/native/interpreter/shared/interp_vm_helpers.h
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_vm_helpers.h
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interp_vm_helpers.h
diff --git a/drlvm/vm/interpreter/src/interpreter.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/interpreter.cpp
similarity index 99%
rename from drlvm/vm/interpreter/src/interpreter.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interpreter.cpp
index 0f0a59a..a00d8cb 100644
--- a/drlvm/vm/interpreter/src/interpreter.cpp
+++ b/drlvm/modules/vm/src/main/native/interpreter/shared/interpreter.cpp
@@ -854,7 +854,7 @@
     arg1 = frame.stack.getLong(2);
     frame.stack.pop(2);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (arg1.i64 == -arg1.i64) {
         if (arg0.i64 == -1) {
             res.i64 = arg1.i64;
@@ -878,7 +878,7 @@
     }
     arg1 = frame.stack.getLong(2);
     frame.stack.pop(2);
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (arg1.i64 == -arg1.i64) {
         if (arg0.i64 == -1) {
             res.i64 = 0l;
diff --git a/drlvm/vm/interpreter/src/interpreter_ti.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/interpreter_ti.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interpreter_ti.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/interpreter_ti.cpp
diff --git a/drlvm/vm/interpreter/src/interp_native_ia32.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/x86/interp_native.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_native_ia32.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/x86/interp_native.cpp
diff --git a/drlvm/vm/interpreter/src/interp_native_em64t.cpp b/drlvm/modules/vm/src/main/native/interpreter/shared/x86_64/interp_native.cpp
similarity index 100%
rename from drlvm/vm/interpreter/src/interp_native_em64t.cpp
rename to drlvm/modules/vm/src/main/native/interpreter/shared/x86_64/interp_native.cpp
diff --git a/drlvm/modules/vm/src/main/native/interpreter/unix/exports.txt b/drlvm/modules/vm/src/main/native/interpreter/unix/exports.txt
new file mode 100644
index 0000000..a28312c
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/interpreter/unix/exports.txt
@@ -0,0 +1,15 @@
+JIT_call_returns_a_reference
+JIT_can_enumerate
+JIT_compile_method
+JIT_compile_method_with_params
+JIT_deinit
+JIT_execute_method
+JIT_fix_handler_context
+JIT_gen_method_info
+JIT_get_address_of_this
+JIT_get_root_set_for_thread_dump
+JIT_get_root_set_from_stack_frame
+JIT_init
+JIT_init_with_data
+JIT_supports_compressed_references
+JIT_unwind_stack_frame
diff --git a/drlvm/vm/interpreter/src/invokeJNI_ipf.asm b/drlvm/modules/vm/src/main/native/interpreter/unix/ia64/invokeJNI.s
similarity index 100%
rename from drlvm/vm/interpreter/src/invokeJNI_ipf.asm
rename to drlvm/modules/vm/src/main/native/interpreter/unix/ia64/invokeJNI.s
diff --git a/drlvm/modules/vm/src/main/native/interpreter/unix/makefile b/drlvm/modules/vm/src/main/native/interpreter/unix/makefile
new file mode 100644
index 0000000..ab26aa6
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/interpreter/unix/makefile
@@ -0,0 +1,44 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'interpreter'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/interpreter/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)vmcore/include $(INCLUDES)
+
+BUILDFILES := \
+  interp_exports.o interp_native.o interp_stack_trace.o interp_vm_helpers.o \
+  interpreter.o interpreter_ti.o invokeJNI.o
+
+DLLNAME = $(DLLPATH)default/libinterpreter$(HY_SHLIB_SUFFIX)
+EXPNAME = INTERPRETER_0.1
+
+AS := $(CXX)
+ASFLAGS := -Wa,--fatal-warnings -c -x assembler-with-cpp -g
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/interpreter/src/invokeJNI_ia32.asm b/drlvm/modules/vm/src/main/native/interpreter/unix/x86/invokeJNI.s
similarity index 100%
rename from drlvm/vm/interpreter/src/invokeJNI_ia32.asm
rename to drlvm/modules/vm/src/main/native/interpreter/unix/x86/invokeJNI.s
diff --git a/drlvm/vm/interpreter/src/invokeJNI_em64t.asm b/drlvm/modules/vm/src/main/native/interpreter/unix/x86_64/invokeJNI.s
similarity index 100%
rename from drlvm/vm/interpreter/src/invokeJNI_em64t.asm
rename to drlvm/modules/vm/src/main/native/interpreter/unix/x86_64/invokeJNI.s
diff --git a/drlvm/vm/interpreter/src/invokeJNI_Windows_ipf.asm b/drlvm/modules/vm/src/main/native/interpreter/windows/ia64/invokeJNI.s
similarity index 100%
rename from drlvm/vm/interpreter/src/invokeJNI_Windows_ipf.asm
rename to drlvm/modules/vm/src/main/native/interpreter/windows/ia64/invokeJNI.s
diff --git a/drlvm/modules/vm/src/main/native/interpreter/windows/x86/invokeJNI.s b/drlvm/modules/vm/src/main/native/interpreter/windows/x86/invokeJNI.s
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/interpreter/windows/x86/invokeJNI.s
diff --git a/drlvm/vm/interpreter/src/invokeJNI_Windows_em64t.asm b/drlvm/modules/vm/src/main/native/interpreter/windows/x86_64/invokeJNI.s
similarity index 100%
rename from drlvm/vm/interpreter/src/invokeJNI_Windows_em64t.asm
rename to drlvm/modules/vm/src/main/native/interpreter/windows/x86_64/invokeJNI.s
diff --git a/drlvm/vm/jitrino/src/codegenerator/CodeGenIntfc.h b/drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/CodeGenIntfc.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/CodeGenIntfc.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/CodeGenIntfc.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/RuntimeInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/RuntimeInterface.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/RuntimeInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/RuntimeInterface.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/RuntimeInterface.h b/drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/RuntimeInterface.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/RuntimeInterface.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/codegenerator/RuntimeInterface.h
diff --git a/drlvm/vm/jitrino/src/dynopt/EdgeProfiler.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/EdgeProfiler.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/dynopt/EdgeProfiler.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/EdgeProfiler.cpp
diff --git a/drlvm/vm/jitrino/src/dynopt/StaticProfiler.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/StaticProfiler.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/dynopt/StaticProfiler.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/StaticProfiler.cpp
diff --git a/drlvm/vm/jitrino/src/dynopt/StaticProfiler.h b/drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/StaticProfiler.h
similarity index 100%
rename from drlvm/vm/jitrino/src/dynopt/StaticProfiler.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/StaticProfiler.h
diff --git a/drlvm/vm/jitrino/src/dynopt/ValueProfiler.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/ValueProfiler.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/dynopt/ValueProfiler.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/dynopt/ValueProfiler.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/CodeGenerator_arch.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/CodeGenerator_arch.cpp
index 8e87425..2edff15 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeGenerator.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/CodeGenerator_arch.cpp
@@ -22,7 +22,7 @@
 
 #include "Jitrino.h"
 #include "CodeSelectors.h"
-#include "IpfCodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "IpfCodeSelector.h"
 #include "IpfCodeLayouter.h"
 #include "IpfLiveAnalyzer.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCfg.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCfg.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfCfg.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCfg.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCfgVerifier.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCfgVerifier.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfCfgVerifier.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCfgVerifier.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeLayouter.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCodeLayouter.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeLayouter.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCodeLayouter.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCodeSelector.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfCodeSelector.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfEmitter.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfEmitter.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfEmitter.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfEmitter.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfEncoder.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfEncoder.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfEncoder.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfEncoder.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfInst.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInst.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfInst.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInst.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInstCodeSelector.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInstCodeSelector.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfInstrumentator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInstrumentator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfInstrumentator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfInstrumentator.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfIrPrinter.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfIrPrinter.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfIrPrinter.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfLiveAnalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfLiveAnalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfLiveAnalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfLiveAnalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfLiveManager.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfLiveManager.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfLiveManager.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfLiveManager.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfOpnd.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfOpnd.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfOpnd.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfOpnd.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfOpndManager.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfOpndManager.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfOpndManager.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfOpndManager.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfPrologEpilogGenerator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfPrologEpilogGenerator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfPrologEpilogGenerator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfPrologEpilogGenerator.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfRegisterAllocator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfRegisterAllocator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfRegisterAllocator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfRegisterAllocator.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeSupport.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfRuntimeSupport.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeSupport.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfRuntimeSupport.cpp
index b382d37..7070ecf 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeSupport.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfRuntimeSupport.cpp
@@ -75,7 +75,7 @@
 //   Root Set info
 //
 // Stack info structure
-//   see struct StackInfo in IpfRuntimeInterface.h
+//   see struct StackInfo in RuntimeInterface_arch.h
 //
 // Root set info structure
 //                +---------------+
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfSpillGen.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfSpillGen.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfSpillGen.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfSpillGen.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfType.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfType.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfType.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfType.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfVerifier.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfVerifier.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfVerifier.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/IpfVerifier.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/RuntimeInterface_arch.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/RuntimeInterface_arch.cpp
index b0ff775..86254f4 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/RuntimeInterface_arch.cpp
@@ -20,7 +20,7 @@
  *
  */
 
-#include "IpfRuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 #include "IpfEncoder.h"
 #include "IpfType.h"
 #include "IpfOpndManager.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/CodeGenerator_arch.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/CodeGenerator_arch.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCfg.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCfg.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCfgVerifier.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCfgVerifier.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCfgVerifier.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCfgVerifier.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCodeLayouter.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCodeLayouter.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCodeSelector.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfCodeSelector.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfEmitter.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfEmitter.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfEmitter.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfEmitter.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfEncoder.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfEncoder.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfEncoder.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfEncoder.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfInstrumentator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfInstrumentator.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfIrPrinter.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfIrPrinter.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfLiveAnalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfLiveAnalyzer.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfLiveManager.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfLiveManager.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfOpndManager.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfOpndManager.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfPrologEpilogGenerator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfPrologEpilogGenerator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfPrologEpilogGenerator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfPrologEpilogGenerator.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfRegisterAllocator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfRegisterAllocator.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfRuntimeSupport.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfRuntimeSupport.h
index 4996438..1ab41ea 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfRuntimeSupport.h
@@ -25,7 +25,7 @@
 
 #include "IpfCfg.h"
 #include "IpfOpndManager.h"
-#include "IpfRuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 
 namespace Jitrino {
 namespace IPF {
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfSpillGen.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfSpillGen.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfSpillGen.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfSpillGen.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfType.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfType.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfType.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfType.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfVerifier.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfVerifier.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfVerifier.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/IpfVerifier.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h b/drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/RuntimeInterface_arch.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeInterface.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/ia64/codegenerator/include/RuntimeInterface_arch.h
diff --git a/drlvm/vm/jitrino/src/jet/arith_rt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/arith_rt.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/arith_rt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/arith_rt.cpp
diff --git a/drlvm/vm/jitrino/src/jet/arith_rt.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/arith_rt.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/arith_rt.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/arith_rt.h
diff --git a/drlvm/vm/jitrino/src/jet/bcproc.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/bcproc.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/bcproc.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/bcproc.cpp
diff --git a/drlvm/vm/jitrino/src/jet/bcproc.inl b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/bcproc.inl
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/bcproc.inl
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/bcproc.inl
diff --git a/drlvm/vm/jitrino/src/jet/cg.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg.cpp
index 701dd1c..1a1ba2c 100644
--- a/drlvm/vm/jitrino/src/jet/cg.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg.cpp
@@ -729,7 +729,7 @@
 
 void CodeGen::gen_throw(Class_Handle exnClass, bool restore)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     bool lazy = false;
 #else
     bool lazy = true;
@@ -737,7 +737,7 @@
     BBState saveBB;
 
     //TODO: Workaround for x86-64 stack should be aligned to half of 16
-#ifdef _EM64T_
+#ifdef HYX86_64
     alu(alu_sub, sp, (unsigned)STACK_SLOT_SIZE);
     alu(alu_and, sp, ~((unsigned)STACK_SLOT_SIZE));
     alu(alu_add, sp, (unsigned)STACK_SLOT_SIZE);
diff --git a/drlvm/vm/jitrino/src/jet/cg.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg.h
diff --git a/drlvm/vm/jitrino/src/jet/cg_arith.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_arith.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg_arith.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_arith.cpp
index b20649a..926ed43 100644
--- a/drlvm/vm/jitrino/src/jet/cg_arith.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_arith.cpp
@@ -247,7 +247,7 @@
     const Val& v2 = m_jframe->dip(0);
 /*    if (false )v2.
         
-#ifdef _IA32_
+#ifdef HYX86
         // on IA32 can use address in a displacement
         alu(to_alu(op), v1, ar_x, (int)v2.addr());
 #else
diff --git a/drlvm/vm/jitrino/src/jet/cg_br.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_br.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg_br.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_br.cpp
index d445ecc..97604f1 100644
--- a/drlvm/vm/jitrino/src/jet/cg_br.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_br.cpp
@@ -221,7 +221,7 @@
     
     AR gr_tabl = valloc(jobj);
     movp(gr_tabl, DATA_SWITCH_TABLE | m_curr_inst->pc, m_bbinfo->start);
-#ifdef _EM64T_
+#ifdef HYX86_64
     // On EM64T, we operate with I_32 value in a register, but the 
     // register will be used as 64 bit in address form - have to extend
     sx(Opnd(i64, val.reg()), Opnd(i32, val.reg()));
diff --git a/drlvm/vm/jitrino/src/jet/cg_dbg.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_dbg.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg_dbg.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_dbg.cpp
diff --git a/drlvm/vm/jitrino/src/jet/cg_fld_arr.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_fld_arr.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg_fld_arr.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_fld_arr.cpp
diff --git a/drlvm/vm/jitrino/src/jet/cg_ia32.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_ia32.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg_ia32.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_ia32.cpp
diff --git a/drlvm/vm/jitrino/src/jet/cg_instr.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_instr.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg_instr.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_instr.cpp
index e8bfb16..e7ceda4 100644
--- a/drlvm/vm/jitrino/src/jet/cg_instr.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_instr.cpp
@@ -43,7 +43,7 @@
         return;
     }
 
-#ifdef _IA32_
+#ifdef HYX86
     AR addr = ar_x;
     int off = (int)m_p_backedge_counter;
 #else
@@ -126,7 +126,7 @@
     //JVMTI helper takes field handle, method handle, byte code location, pointer
     //to reference for fields or NULL for statics, pointer to field value
 
-#ifndef _EM64T_
+#ifndef HYX86_64
     // Workaround since do_mov do not put jlong on stack in gen_args on ia32
     SYNC_FIRST(static const CallSig cs_ti_fmodif(CCONV_HELPERS, jvoid, jobj, jobj, i32, i32, jobj, jobj));
     Val vlocation((jlong)m_pc);
@@ -164,7 +164,7 @@
     if (field_op) {
         vobject = vstack(ref_depth);
     }
-#ifndef _EM64T_
+#ifndef HYX86_64
     // Workaround since do_mov do not put jlong on stack in gen_args on ia32
     gen_args(cs_ti_fmodif, 0, &vfield, &vmeth, &vlocationHi, &vlocation, &vobject, &fieldValPtr);
 #else
@@ -223,7 +223,7 @@
     //JVMTI helper takes field handle, method handle, byte code location, pointer
     //to reference for fields or NULL for statics
 
-#ifndef _EM64T_
+#ifndef HYX86_64
     // Workaround since do_mov do not put jlong on stack in gen_args on ia32
     SYNC_FIRST(static const CallSig cs_ti_faccess(CCONV_HELPERS, jvoid, jobj, jobj, i32, i32, jobj));
     Val vlocation((jlong)m_pc);
@@ -243,7 +243,7 @@
         vobject = vstack(0);
     }
     
-#ifndef _EM64T_
+#ifndef HYX86_64
     // Workaround since do_mov do not put jlong on stack in gen_args on ia32
     gen_args(cs_ti_faccess, 0, &vfield, &vmeth, &vlocationHi, &vlocation, &vobject);
 #else
diff --git a/drlvm/vm/jitrino/src/jet/cg_meth.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_meth.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg_meth.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_meth.cpp
index 38d87a1..3f8a137 100644
--- a/drlvm/vm/jitrino/src/jet/cg_meth.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_meth.cpp
@@ -169,7 +169,7 @@
         push(idx);
     }
     //
-#ifdef _EM64T_
+#ifdef HYX86_64
     mov(fill, (uint_ptr)0xDEADBEEFDEADBEEF);
 #else
     mov(fill, 0xDEADBEEF);
@@ -694,7 +694,7 @@
         }
     }
     else if (is_big(retType)) {
-#ifdef _IA32_
+#ifdef HYX86
         vswap(0);
         vswap(1);
         AR out_reg1 = cs.ret_reg(1); 
@@ -949,7 +949,7 @@
             gen_check_null(*thiz, false);
 
         void * paddr = method_get_indirect_address(meth);
-#ifdef _IA32_
+#ifdef HYX86
         Opnd ptr(jobj, ar_x, paddr);
 #else
         AR gr = valloc(jobj);
@@ -1020,7 +1020,7 @@
         zx2(Opnd(i32, ar), Opnd(jt,ar));
         jt = i32;
     }
-#ifdef _IA32_
+#ifdef HYX86
     if(ar == fp0) {
         // Cant use vstack_off right here, as the item is not yet pushed.
         unsigned slot = m_jframe->size();
diff --git a/drlvm/vm/jitrino/src/jet/cg_obj.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_obj.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg_obj.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_obj.cpp
diff --git a/drlvm/vm/jitrino/src/jet/cg_regs.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_regs.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/cg_regs.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_regs.cpp
index f725dc9..3b49094 100644
--- a/drlvm/vm/jitrino/src/jet/cg_regs.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_regs.cpp
@@ -266,7 +266,7 @@
     //}
     
     if (s.jt() == jobj) {
-#ifdef _EM64T_
+#ifdef HYX86_64
         //TODO: it may be not always necessary to upload to register.
         toReg = true;
 #endif    
diff --git a/drlvm/vm/jitrino/src/jet/cg_stk.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_stk.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/cg_stk.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/cg_stk.cpp
diff --git a/drlvm/vm/jitrino/src/jet/compiler.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/compiler.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/compiler.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/compiler.cpp
diff --git a/drlvm/vm/jitrino/src/jet/compiler.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/compiler.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/compiler.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/compiler.h
diff --git a/drlvm/vm/jitrino/src/jet/csig.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/csig.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/csig.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/csig.cpp
diff --git a/drlvm/vm/jitrino/src/jet/csig.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/csig.h
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/csig.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/csig.h
index 656eb6d..6eee568 100644
--- a/drlvm/vm/jitrino/src/jet/csig.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/csig.h
@@ -90,7 +90,7 @@
  */
 #define CCONV_CDECL_IA32       (CCONV_CALLER_POPS | CCONV_MEM | CCONV_RETURN_FP_THROUGH_FPU)
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /**
      * @brief EM64T calling convention.
      */
@@ -127,7 +127,7 @@
  */
 #define CCONV_MULTIANEWARRAY    CCONV_CDECL_IA32
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /**
      * @brief On IA-32 it's CCONV_MANAGED_IA32, on EM64T it's CCONV_EM64T.
      */
diff --git a/drlvm/vm/jitrino/src/jet/enc.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/enc.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.cpp
index 520b1bc..a7da127 100644
--- a/drlvm/vm/jitrino/src/jet/enc.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.cpp
@@ -330,7 +330,7 @@
                    const CallSig& cs, unsigned idx, ...)
 {
 //TODO: Add IA-64 check
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (check_stack) {
         alu(alu_test, sp, 0x0F);
         unsigned br_off = br(z, 0, 0, hint_none);
@@ -368,7 +368,7 @@
                 mov(Opnd(i32, sp, cs.off(i)), val);
             }
             else {
-#ifdef _EM64T_
+#ifdef HYX86_64
                 int_ptr val = va_arg(valist, int_ptr);
                 mov(Opnd(i64, sp, cs.off(i)), val);
 #else
@@ -380,7 +380,7 @@
             }
         }
         else if (jt==i64) {
-#ifdef _EM64T_
+#ifdef HYX86_64
             int_ptr val = va_arg(valist, int_ptr);
             mov(gr == gr_x ? Opnd(i64, sp, cs.off(i)) : Opnd(i64, gr), val);
 #else
diff --git a/drlvm/vm/jitrino/src/jet/enc.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.h
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/enc.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.h
index 5d2fc73..0fac059 100644
--- a/drlvm/vm/jitrino/src/jet/enc.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc.h
@@ -214,7 +214,7 @@
  */
 inline bool is_big(jtype jt)
 {
-#if defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86_64) || defined(_IPF_)
     return false;
 #else
     return jt==i64;
@@ -241,7 +241,7 @@
  */
 inline bool is_ia32(void)
 {
-#if defined(_IA32_)
+#if defined(HYX86)
     return true;
 #else
     return false;
@@ -264,7 +264,7 @@
  */
 inline bool fits32(const void* addr)
 {
-#ifdef _IA32_
+#ifdef HYX86
     return true;
 #else
     return fits32((jlong)(int_ptr)addr);
@@ -295,7 +295,7 @@
     //
     // EAX, EBX, ECX, EDX, ESI, EDI, 
     gr0, gr1, gr2, gr3, gr4, gr5, 
-#ifdef _EM64T_
+#ifdef HYX86_64
     // R8, R9, R10, R11, R12, R13, R14, R15
     gr6, gr7, gr8, gr9, gr10, gr11, gr12, gr13, 
 #endif
@@ -304,7 +304,7 @@
     // Float-point registers
     //
     fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7, 
-#ifdef _EM64T_
+#ifdef HYX86_64
     fr8, fr9, fr10, fr11, fr12, fr13, fr14, fr15, 
 #endif
     //
@@ -312,7 +312,7 @@
     //
     fp0, // top FPU stacked register
     //
-#ifdef _EM64T_
+#ifdef HYX86_64
     gr_num=15,      /// not including sp
     gr_total = 16,  /// including sp
     fr_num=16,
@@ -604,7 +604,7 @@
         m_base = base; m_index = index;
         m_scale = scale; m_disp = disp;
     }
-#ifdef _IA32_
+#ifdef HYX86
     /**
      * @brief Constructs memory operand, the given pointer is stored as 
      *        displacement.
diff --git a/drlvm/vm/jitrino/src/jet/enc_ia32.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/jet/enc_ia32.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.cpp
index 8f6f343..682d37a 100644
--- a/drlvm/vm/jitrino/src/jet/enc_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.cpp
@@ -26,7 +26,7 @@
 #include "enc_ia32.h"
 #include "trace.h"
 
-#ifdef _IA32_
+#ifdef HYX86
 #include "enc_prvt.h"
 #endif
 
@@ -59,10 +59,10 @@
 static const RegName reg_map[] = {
     RegName_EAX, RegName_EBX, RegName_ECX, RegName_EDX, 
     RegName_ESI, RegName_EDI, 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName_R8D, RegName_R9D, RegName_R10D, RegName_R11D, 
     RegName_R12D, RegName_R13D, RegName_R14D, RegName_R15D, 
-#endif //_EM64T_
+#endif //HYX86_64
     RegName_EBP,  RegName_ESP
 };
 
@@ -83,7 +83,7 @@
             assert(idx<COUNTOF(reg_map));
             reg = reg_map[idx];
         
-#if !defined(_EM64T_) && defined(_DEBUG)
+#if !defined(HYX86_64) && defined(_DEBUG)
             // On IA32 can not encode the lower 8 bits of the following regs
             if (equals(reg, RegName_EBP) || equals(reg, RegName_ESI) ||
                 equals(reg, RegName_EDI) || equals(reg, RegName_ESP)) {
@@ -92,7 +92,7 @@
 #endif
             OpndSize sz;
             if (jt == jvoid) {
-#ifdef _EM64T_
+#ifdef HYX86_64
                 sz = OpndSize_64;
 #else
                 sz = OpndSize_32;
@@ -199,7 +199,7 @@
 }
 
 AR get_cconv_fr(unsigned i, unsigned pos_in_args) {
-#ifdef _EM64T_
+#ifdef HYX86_64
 #ifdef _WIN64
     bool compact = false;
 #else
@@ -223,7 +223,7 @@
 }
 
 AR get_cconv_gr(unsigned i, unsigned pos_in_args) {
-#ifdef _EM64T_
+#ifdef HYX86_64
 #ifdef _WIN64
     bool compact = false;
 	static const AR grs[] = {
@@ -305,7 +305,7 @@
     assert(getRegKind(reg)==OpndKind_GPReg);
     if (equals(reg, RegName_EBX))   return true;
     if (equals(reg, RegName_EBP))   return true;
-#ifdef _EM64T_
+#ifdef HYX86_64
 #ifdef _WIN64
     if (equals(reg, RegName_RDI))   return true;
     if (equals(reg, RegName_RSI))   return true;
@@ -369,7 +369,7 @@
     if (jt == i32 || jt == flt32) return OpndSize_32;
     if (jt == i16 || jt == u16) return OpndSize_16;
     if (jt == i8) return OpndSize_8;
-#ifdef _IA32_
+#ifdef HYX86
     if (jt == jobj) return OpndSize_32;
 #else
     if (jt == jobj) return OpndSize_64;
@@ -382,7 +382,7 @@
                           Opnd& op0, Opnd& op1, 
                           const Opnd& _op0, const Opnd& _op1)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     // no op.
     op0 = _op0;
     op1 = _op1;
@@ -440,7 +440,7 @@
                           const Opnd& op0, const Opnd& op1, 
                           const Opnd& _op0, const Opnd& _op1)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     // no op.
     if (true) return;
 #endif
@@ -472,7 +472,7 @@
     return getRegNameString(reg);
 }
 
-#if defined(_IA32_)
+#if defined(HYX86)
 static int get_reg_idx(AR ar)
 {
     assert(is_gr(ar) && ar != ar_x);
@@ -541,11 +541,11 @@
     ((ModRM*)buf)->reg = getRegIndex(reg);
 }
 
-#endif // ifdef _IA32_
+#endif // ifdef HYX86
 
 void Encoder::mov_impl(const Opnd& _op0, const Opnd& _op1)
 {
-#if defined(_IA32_)
+#if defined(HYX86)
     //
     // mov_impl() and its calls to add_arg() are the hottest methods on 
     // client startups, especially with the massive ones like Eclipse.
@@ -605,7 +605,7 @@
     assert(_op0.reg() != fp0 && _op1.reg() != fp0);
     assert(is_f(_op0.jt()) == is_f(_op1.jt()));
     
-#ifdef _EM64T_
+#ifdef HYX86_64
     // A special case on EM64T - emulation of 'mov mem64, imm64'
     if (_op0.is_mem() && _op1.is_imm() && 
         (_op1.jt() == i64 || _op1.jt() == jobj)) {
@@ -833,7 +833,7 @@
 {
     EncoderBase::Operands args;
     args.add(devirt(op0));
-#ifdef _EM64T_
+#ifdef HYX86_64
     args.add(EncoderBase::Operand(OpndSize_64, (int_ptr)op1));
 #else
     args.add(EncoderBase::Operand(OpndSize_32, (int_ptr)op1));
diff --git a/drlvm/vm/jitrino/src/jet/enc_ia32.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.h
similarity index 93%
rename from drlvm/vm/jitrino/src/jet/enc_ia32.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.h
index 708f04d..f9e0168 100644
--- a/drlvm/vm/jitrino/src/jet/enc_ia32.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/enc_ia32.h
@@ -23,8 +23,8 @@
  * @brief Encoder definitions specific for IA-32 and Intel 64 platforms.
  */
  
-#if !defined(__ENC_IA32_H_INCLUDED__)
-#define __ENC_IA32_H_INCLUDED__
+#if !defined(__ENCHYX86H_INCLUDED__)
+#define __ENCHYX86H_INCLUDED__
 
 #include "enc.h"
 
@@ -55,4 +55,4 @@
 }
 }; // ~namespace Jitrino::Jet
 
-#endif  // __ENC_IA32_H_INCLUDED__
+#endif  // __ENCHYX86H_INCLUDED__
diff --git a/drlvm/vm/jitrino/src/jet/jdefs.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jdefs.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/jdefs.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jdefs.cpp
diff --git a/drlvm/vm/jitrino/src/jet/jdefs.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jdefs.h
similarity index 97%
rename from drlvm/vm/jitrino/src/jet/jdefs.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jdefs.h
index 633c8f2..e7f2072 100644
--- a/drlvm/vm/jitrino/src/jet/jdefs.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jdefs.h
@@ -86,7 +86,7 @@
 #else
     // stdcall has no meaning on platforms other than Lin32
     #undef stdcall__
-    #if defined(_IA32_) && !defined(stdcall__)
+    #if defined(HYX86) && !defined(stdcall__)
         #define stdcall__    __attribute__ ((__stdcall__))
     #else
     #define stdcall__
@@ -96,19 +96,19 @@
 #endif
 //
 // gcc def on EM64T
-#if defined(__x86_64__) && !defined(_EM64T_)
-    #define _EM64T_  1
-    #undef  _IA32_
+#if defined(__x86_64__) && !defined(HYX86_64)
+    #define HYX86_64  1
+    #undef  HYX86
 #endif
 
-#if defined(__i386__) && !defined(_IA32_)
-    #undef  _EM64T_
-    #define _IA32_ 1
+#if defined(__i386__) && !defined(HYX86)
+    #undef  HYX86_64
+    #define HYX86 1
 #endif
 
-#if !defined(_EM64T_) && !defined(_IPF_) && !defined(_IA32_)
+#if !defined(HYX86_64) && !defined(_IPF_) && !defined(HYX86)
     // presuming we're working on ia-32
-    #define _IA32_ 1
+    #define HYX86 1
 #endif
 
 
@@ -553,7 +553,7 @@
     jtypes_count, 
     /// max number of types
     num_jtypes = jtypes_count,
-#ifdef _EM64T_
+#ifdef HYX86_64
     iplatf=i64,
 #else
     /// platform-native size for integer (fits into general-purpose register)
diff --git a/drlvm/vm/jitrino/src/jet/jet.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jet.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/jet.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jet.cpp
index 1662a97..dc94bb2 100644
--- a/drlvm/vm/jitrino/src/jet/jet.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jet.cpp
@@ -177,7 +177,7 @@
 
 bool supports_compresed_refs(void)
 {
-#if defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86_64) || defined(_IPF_)
     return true;
 #else
     return false;
diff --git a/drlvm/vm/jitrino/src/jet/jet.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jet.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/jet.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jet.h
diff --git a/drlvm/vm/jitrino/src/jet/jframe.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jframe.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/jframe.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jframe.cpp
diff --git a/drlvm/vm/jitrino/src/jet/jframe.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/jframe.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/jframe.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/jframe.h
diff --git a/drlvm/vm/jitrino/src/jet/magics.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/magics.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/magics.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/magics.cpp
diff --git a/drlvm/vm/jitrino/src/jet/mib.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/mib.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/mib.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/mib.cpp
diff --git a/drlvm/vm/jitrino/src/jet/mib.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/mib.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/mib.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/mib.h
diff --git a/drlvm/vm/jitrino/src/jet/rt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/rt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt.cpp
index b176390..949f920 100644
--- a/drlvm/vm/jitrino/src/jet/rt.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt.cpp
@@ -58,7 +58,7 @@
 static const unsigned bp_mask  = 1<<bit_no(bp_idx);
 static const int bp_spill_off = ((StackFrame*)NULL)->spill(bp);
 
-#ifdef _IA32_
+#ifdef HYX86
 //
 static AR ebx = virt(RegName_EBX);
 static const unsigned ebx_idx = ar_idx(ebx);
@@ -78,7 +78,7 @@
 static const unsigned edi_mask  = 1<<bit_no(edi_idx);
 static const int      edi_spill_off = ((StackFrame*)NULL)->spill(edi);
 //
-#endif // _IA32_
+#endif // HYX86
 
 
 /**
@@ -178,7 +178,7 @@
     UNSAFE_REGION_END
 #endif
 
-#if defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86_64) || defined(_IPF_)
     // Common version for all platforms but IA32
     for (unsigned i=0; i<gr_num; i++) {
         AR ar = _gr(i);
@@ -564,7 +564,7 @@
         if (!tst(map, var_num)) {
             return EXE_ERROR_TYPE_MISMATCH;
         }
-#ifdef _EM64T_
+#ifdef HYX86_64
     case VM_DATA_TYPE_STRING:
         var_ptr_to_64 = (uint64*)value_ptr;
         *var_ptr_to_64 = *(uint64*)(ebp + frame.local(var_num));
@@ -601,7 +601,7 @@
     case VM_DATA_TYPE_INT64:
     case VM_DATA_TYPE_UINT64:
     case VM_DATA_TYPE_F8:
-#ifdef _EM64T_
+#ifdef HYX86_64
     case VM_DATA_TYPE_ARRAY:
     case VM_DATA_TYPE_CLASS:
     case VM_DATA_TYPE_STRING:
diff --git a/drlvm/vm/jitrino/src/jet/rt.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/rt.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt.h
diff --git a/drlvm/vm/jitrino/src/jet/rt_ia32.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt_ia32.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/rt_ia32.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt_ia32.cpp
index d00605e..5715eb3 100644
--- a/drlvm/vm/jitrino/src/jet/rt_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/rt_ia32.cpp
@@ -31,7 +31,7 @@
 
 void *** devirt(AR gr, const JitFrameContext * jfc)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (gr==gr_x)   return (void***)&jfc->p_rip;
     if (gr == sp)   return (void***)&jfc->rsp;
     if (gr == bp)   return (void***)&jfc->p_rbp;
diff --git a/drlvm/vm/jitrino/src/jet/sconsts.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/sconsts.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/sconsts.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/sconsts.cpp
diff --git a/drlvm/vm/jitrino/src/jet/sconsts.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/sconsts.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/sconsts.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/sconsts.h
diff --git a/drlvm/vm/jitrino/src/jet/sframe.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/sframe.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/sframe.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/sframe.h
diff --git a/drlvm/vm/jitrino/src/jet/stats.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/stats.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/stats.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/stats.cpp
diff --git a/drlvm/vm/jitrino/src/jet/stats.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/stats.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/stats.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/stats.h
diff --git a/drlvm/vm/jitrino/src/jet/structs.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/structs.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/structs.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/structs.h
diff --git a/drlvm/vm/jitrino/src/jet/trace.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/trace.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/trace.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/trace.cpp
diff --git a/drlvm/vm/jitrino/src/jet/trace.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/trace.h
similarity index 100%
rename from drlvm/vm/jitrino/src/jet/trace.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/trace.h
diff --git a/drlvm/vm/jitrino/src/jet/val.h b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/val.h
similarity index 99%
rename from drlvm/vm/jitrino/src/jet/val.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/jet/val.h
index f116d56..208cbbb 100644
--- a/drlvm/vm/jitrino/src/jet/val.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/jet/val.h
@@ -131,7 +131,7 @@
         m_base = base; m_index = index;
         m_scale = scale; m_disp = disp;
     }
-#ifdef _IA32_
+#ifdef HYX86
     /**
      * Special-purpose ctor, only exists on IA-32.
      * 
diff --git a/drlvm/vm/jitrino/src/main/CompilationContext.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/main/CompilationContext.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/main/CompilationContext.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/CompilationContext.cpp
diff --git a/drlvm/vm/jitrino/src/main/CompilationContext.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/CompilationContext.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/CompilationContext.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/CompilationContext.h
diff --git a/drlvm/vm/jitrino/src/main/JITInstanceContext.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/main/JITInstanceContext.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/main/JITInstanceContext.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/JITInstanceContext.cpp
diff --git a/drlvm/vm/jitrino/src/main/JITInstanceContext.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/JITInstanceContext.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/JITInstanceContext.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/JITInstanceContext.h
diff --git a/drlvm/vm/jitrino/src/main/Jitrino.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/main/Jitrino.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/main/Jitrino.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/Jitrino.cpp
index c196b76..9cd3143 100644
--- a/drlvm/vm/jitrino/src/main/Jitrino.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/main/Jitrino.cpp
@@ -43,11 +43,7 @@
 #include "PMF.h"
 #include "PMFAction.h"
 
-#if defined(_IPF_)
-    #include "IpfRuntimeInterface.h"
-#else
-    #include "ia32/Ia32RuntimeInterface.h"
-#endif
+#include "RuntimeInterface_arch.h"
 
 #include <ostream>
 
diff --git a/drlvm/vm/jitrino/src/main/Jitrino.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/Jitrino.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/Jitrino.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/Jitrino.h
diff --git a/drlvm/vm/jitrino/src/main/Log.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/main/Log.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/main/Log.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/Log.cpp
diff --git a/drlvm/vm/jitrino/src/main/Log.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/Log.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/Log.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/Log.h
diff --git a/drlvm/vm/jitrino/src/main/LogStream.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/LogStream.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/LogStream.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/LogStream.h
diff --git a/drlvm/vm/jitrino/src/main/PMF.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/main/PMF.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/main/PMF.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/PMF.cpp
diff --git a/drlvm/vm/jitrino/src/main/PMF.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/PMF.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/PMF.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/PMF.h
diff --git a/drlvm/vm/jitrino/src/main/PMFAction.h b/drlvm/modules/vm/src/main/native/jitrino/shared/main/PMFAction.h
similarity index 100%
rename from drlvm/vm/jitrino/src/main/PMFAction.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/main/PMFAction.h
diff --git a/drlvm/vm/jitrino/src/optimizer/CSEHash.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CSEHash.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/CSEHash.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CSEHash.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/CSEHash.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CSEHash.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/CSEHash.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CSEHash.h
diff --git a/drlvm/vm/jitrino/src/optimizer/CodeGenerator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeGenerator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/CodeGenerator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeGenerator.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/CodeSelectors.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/optimizer/CodeSelectors.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.cpp
index 39c487a..2362f95 100644
--- a/drlvm/vm/jitrino/src/optimizer/CodeSelectors.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.cpp
@@ -932,7 +932,7 @@
                 if (!genConsts) break;
                 ConstInst* constInst = (ConstInst*)inst;
                 switch (inst->getType()) {
-#ifdef _IA32_
+#ifdef HYX86
         case Type::UIntPtr:
         case Type::IntPtr:
         case Type::UnmanagedPtr:
@@ -940,7 +940,7 @@
         case Type::Int32:
             cgInst = instructionCallback.ldc_i4(constInst->getValue().i4);
             break;
-#ifdef _EM64T_
+#ifdef HYX86_64
         case Type::UIntPtr:
         case Type::IntPtr:
         case Type::UnmanagedPtr:
diff --git a/drlvm/vm/jitrino/src/optimizer/CodeSelectors.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.h
similarity index 97%
rename from drlvm/vm/jitrino/src/optimizer/CodeSelectors.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.h
index 1014587..2af757d 100644
--- a/drlvm/vm/jitrino/src/optimizer/CodeSelectors.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/CodeSelectors.h
@@ -22,12 +22,7 @@
 #ifndef CODESELECTORS_H_
 #define CODESELECTORS_H_
 
-
-#if defined(_IPF_)
-    #include "IpfCodeGenerator.h"
-#else
-    #include "ia32/Ia32CodeGenerator.h"
-#endif
+#include "CodeGenerator_arch.h"
 
 #include "irmanager.h"
 
diff --git a/drlvm/vm/jitrino/src/optimizer/FastArrayFilling.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FastArrayFilling.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/optimizer/FastArrayFilling.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FastArrayFilling.cpp
index 38eebd5..3b0478e 100644
--- a/drlvm/vm/jitrino/src/optimizer/FastArrayFilling.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FastArrayFilling.cpp
@@ -279,7 +279,7 @@
         inEdge = startNode->getInEdges().front();
 
         //get a new constant
-#ifdef _EM64T_
+#ifdef HYX86_64
         int64 val = (int64)((ConstInst*)constValue->getInst())->getValue().i8;
 #else
         I_32 val = (I_32)((ConstInst*)constValue->getInst())->getValue().i4;
@@ -290,7 +290,7 @@
             case Type::UInt8:
                 val |= (val << 8);
                 val |= (val << 16);
-#ifdef _EM64T_
+#ifdef HYX86_64
                 val |= (val << 32);
 #endif
                 break;
@@ -298,19 +298,19 @@
             case Type::UInt16:
             case Type::Char:
                 val |= (val << 16);
-#ifdef _EM64T_
+#ifdef HYX86_64
                 val |= (val << 32);
 #endif
                 break;
             case Type::Int32:
             case Type::UInt32:
-#ifdef _EM64T_
+#ifdef HYX86_64
                 val |= (val << 32);
                 break;
 #endif
             case Type::UIntPtr:
             case Type::IntPtr:
-#ifdef _EM64T_
+#ifdef HYX86_64
             case Type::UInt64:
             case Type::Int64:
 #endif
diff --git a/drlvm/vm/jitrino/src/optimizer/FlowGraph.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FlowGraph.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/FlowGraph.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FlowGraph.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/FlowGraph.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FlowGraph.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/FlowGraph.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/FlowGraph.h
diff --git a/drlvm/vm/jitrino/src/optimizer/HLOAPIMagics.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/HLOAPIMagics.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/HLOAPIMagics.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/HLOAPIMagics.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/HLOAPIMagics.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/HLOAPIMagics.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/HLOAPIMagics.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/HLOAPIMagics.h
diff --git a/drlvm/vm/jitrino/src/optimizer/IRBuilder.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilder.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/IRBuilder.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilder.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/IRBuilder.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilder.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/IRBuilder.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilder.h
diff --git a/drlvm/vm/jitrino/src/optimizer/IRBuilderFlags.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilderFlags.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/IRBuilderFlags.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/IRBuilderFlags.h
diff --git a/drlvm/vm/jitrino/src/optimizer/Inst.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Inst.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Inst.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Inst.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/Inst.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Inst.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Inst.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Inst.h
diff --git a/drlvm/vm/jitrino/src/optimizer/Loop.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Loop.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Loop.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Loop.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/Loop.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Loop.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Loop.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Loop.h
diff --git a/drlvm/vm/jitrino/src/optimizer/LoopUtils.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/LoopUtils.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/LoopUtils.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/LoopUtils.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/LoopUtils.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/LoopUtils.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/LoopUtils.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/LoopUtils.h
diff --git a/drlvm/vm/jitrino/src/optimizer/Opcode.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opcode.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Opcode.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opcode.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/Opcode.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opcode.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Opcode.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opcode.h
diff --git a/drlvm/vm/jitrino/src/optimizer/Opnd.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opnd.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Opnd.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opnd.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/Opnd.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opnd.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/Opnd.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/Opnd.h
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/abcdbounds.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/abcdbounds.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/abcdbounds.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/abcdbounds.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/abcdbounds.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/abcdbounds.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/abcdbounds.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/abcdbounds.h
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd.h
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd_solver.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd_solver.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd_solver.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd_solver.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd_solver.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd_solver.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/classic_abcd_solver.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/classic_abcd_solver.h
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/insertpi.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/insertpi.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/insertpi.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/insertpi.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/abcd/insertpi.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/insertpi.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/abcd/insertpi.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/abcd/insertpi.h
diff --git a/drlvm/vm/jitrino/src/optimizer/aliasanalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/aliasanalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/aliasanalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/aliasanalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/aliasanalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/aliasanalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/aliasanalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/aliasanalyzer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/codelowerer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/codelowerer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/codelowerer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/codelowerer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/codelowerer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/codelowerer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/codelowerer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/codelowerer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/constantfolder.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/constantfolder.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/constantfolder.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/constantfolder.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/constantfolder.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/constantfolder.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/constantfolder.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/constantfolder.h
diff --git a/drlvm/vm/jitrino/src/optimizer/dabce.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dabce.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/dabce.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dabce.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/dabce.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dabce.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/dabce.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dabce.h
diff --git a/drlvm/vm/jitrino/src/optimizer/dataflow.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dataflow.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/dataflow.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/dataflow.h
diff --git a/drlvm/vm/jitrino/src/optimizer/deadcodeeliminator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/deadcodeeliminator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/deadcodeeliminator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/deadcodeeliminator.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/deadcodeeliminator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/deadcodeeliminator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/deadcodeeliminator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/deadcodeeliminator.h
diff --git a/drlvm/vm/jitrino/src/optimizer/devirtualizer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/devirtualizer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/devirtualizer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/devirtualizer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/devirtualizer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/devirtualizer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/devirtualizer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/devirtualizer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/escanalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escanalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/escanalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escanalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/escanalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escanalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/escanalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escanalyzer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/escapeanalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escapeanalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/escapeanalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escapeanalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/escapeanalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escapeanalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/escapeanalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/escapeanalyzer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/gcmanagedpointeranalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/gcmanagedpointeranalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/gcmanagedpointeranalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/gcmanagedpointeranalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/gcmanagedpointeranalyzer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/globalcodemotion.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalcodemotion.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/globalcodemotion.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalcodemotion.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/globalcodemotion.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalcodemotion.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/globalcodemotion.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalcodemotion.h
diff --git a/drlvm/vm/jitrino/src/optimizer/globalopndanalyzer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalopndanalyzer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/globalopndanalyzer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalopndanalyzer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/globalopndanalyzer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalopndanalyzer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/globalopndanalyzer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/globalopndanalyzer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/hashvaluenumberer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/hashvaluenumberer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/hashvaluenumberer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/hashvaluenumberer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/hashvaluenumberer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/hashvaluenumberer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/hashvaluenumberer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/hashvaluenumberer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/helper_inliner.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/helper_inliner.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/helper_inliner.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/helper_inliner.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/inliner.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/inliner.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/optimizer/inliner.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/inliner.cpp
index c3c43a2..3b25124 100644
--- a/drlvm/vm/jitrino/src/optimizer/inliner.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/inliner.cpp
@@ -112,7 +112,7 @@
     _inlineMaxNodeThreshold = irm.getOptimizerFlags().hir_node_threshold * irm.getOptimizerFlags().inline_node_quota / 100;
 
     _inlineSkipExceptionPath = argSource->getBoolArg("skip_exception_path", INLINE_SKIP_EXCEPTION_PATH);
-#if defined  (_EM64T_) || defined (_IPF_)
+#if defined  (HYX86_64) || defined (_IPF_)
     _inlineSkipApiMagicMethods  = false;
 #else
     _inlineSkipApiMagicMethods = argSource->getBoolArg("skip_api_magics", true);
@@ -128,7 +128,7 @@
 #else
             //is_accepted will return 'true' for these methods by skip table-> no inlining will be done
             Method_Table::Decision des = Method_Table::mt_accepted; 
-#ifndef  _EM64T_ // not tested
+#ifndef  HYX86_64 // not tested
             _inlineSkipMethodTable->add_method_record("java/lang/Integer", "numberOfLeadingZeros", "(I)I", des, false);
             _inlineSkipMethodTable->add_method_record("java/lang/Integer", "numberOfTrailingZeros", "(I)I", des, false);
             _inlineSkipMethodTable->add_method_record("java/lang/Long", "numberOfLeadingZeros", "(J)I", des, false);
diff --git a/drlvm/vm/jitrino/src/optimizer/inliner.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/inliner.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/inliner.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/inliner.h
diff --git a/drlvm/vm/jitrino/src/optimizer/irmanager.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/irmanager.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/irmanager.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/irmanager.h
diff --git a/drlvm/vm/jitrino/src/optimizer/lazyexceptionopt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/lazyexceptionopt.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/lazyexceptionopt.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/lazyexceptionopt.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/lazyexceptionopt.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/lazyexceptionopt.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/lazyexceptionopt.h
diff --git a/drlvm/vm/jitrino/src/optimizer/loop_unroll.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/loop_unroll.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/loop_unroll.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/loop_unroll.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/memoryopt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryopt.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/memoryopt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryopt.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/memoryopt.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryopt.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/memoryopt.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryopt.h
diff --git a/drlvm/vm/jitrino/src/optimizer/memoryoptrep.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryoptrep.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/memoryoptrep.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/memoryoptrep.h
diff --git a/drlvm/vm/jitrino/src/optimizer/multiplybyconstant.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/multiplybyconstant.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/multiplybyconstant.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/multiplybyconstant.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/opndmap.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/opndmap.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/opndmap.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/opndmap.h
diff --git a/drlvm/vm/jitrino/src/optimizer/optarithmetic.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optarithmetic.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/optarithmetic.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optarithmetic.h
diff --git a/drlvm/vm/jitrino/src/optimizer/optimizer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optimizer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/optimizer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optimizer.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/optimizer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optimizer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/optimizer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optimizer.h
diff --git a/drlvm/vm/jitrino/src/optimizer/optpass.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optpass.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/optpass.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optpass.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/optpass.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optpass.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/optpass.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/optpass.h
diff --git a/drlvm/vm/jitrino/src/optimizer/osr.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/osr.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/osr.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/osr.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/osr.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/osr.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/osr.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/osr.h
diff --git a/drlvm/vm/jitrino/src/optimizer/pidgenerator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/pidgenerator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/pidgenerator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/pidgenerator.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/pidgenerator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/pidgenerator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/pidgenerator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/pidgenerator.h
diff --git a/drlvm/vm/jitrino/src/optimizer/reassociate.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/reassociate.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/reassociate.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/reassociate.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/reassociate.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/reassociate.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/reassociate.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/reassociate.h
diff --git a/drlvm/vm/jitrino/src/optimizer/simplifier.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifier.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/simplifier.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifier.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/simplifier.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifier.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/simplifier.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifier.h
diff --git a/drlvm/vm/jitrino/src/optimizer/simplifytaus.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifytaus.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/simplifytaus.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifytaus.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/simplifytaus.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifytaus.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/simplifytaus.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/simplifytaus.h
diff --git a/drlvm/vm/jitrino/src/optimizer/ssa/SSA.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/ssa/SSA.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/ssa/SSA.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/ssa/SSA.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/ssa/SSA.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/ssa/SSA.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/ssa/SSA.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/ssa/SSA.h
diff --git a/drlvm/vm/jitrino/src/optimizer/syncopt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/syncopt.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/syncopt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/syncopt.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/syncopt.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/syncopt.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/syncopt.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/syncopt.h
diff --git a/drlvm/vm/jitrino/src/optimizer/tailduplicator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/tailduplicator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/tailduplicator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/tailduplicator.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/tailduplicator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/tailduplicator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/tailduplicator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/tailduplicator.h
diff --git a/drlvm/vm/jitrino/src/optimizer/throwopt.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/throwopt.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/throwopt.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/throwopt.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/walkers.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/walkers.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/walkers.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/walkers.cpp
diff --git a/drlvm/vm/jitrino/src/optimizer/walkers.h b/drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/walkers.h
similarity index 100%
rename from drlvm/vm/jitrino/src/optimizer/walkers.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/optimizer/walkers.h
diff --git a/drlvm/vm/jitrino/src/shared/Algorithms.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Algorithms.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Algorithms.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Algorithms.cpp
diff --git a/drlvm/vm/jitrino/src/shared/Algorithms.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Algorithms.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Algorithms.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Algorithms.h
diff --git a/drlvm/vm/jitrino/src/shared/Arena.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Arena.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Arena.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Arena.cpp
diff --git a/drlvm/vm/jitrino/src/shared/Arena.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Arena.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Arena.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Arena.h
diff --git a/drlvm/vm/jitrino/src/shared/BitSet.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/BitSet.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/BitSet.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/BitSet.cpp
diff --git a/drlvm/vm/jitrino/src/shared/BitSet.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/BitSet.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/BitSet.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/BitSet.h
diff --git a/drlvm/vm/jitrino/src/shared/ControlFlowGraph.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/ControlFlowGraph.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/ControlFlowGraph.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/ControlFlowGraph.cpp
diff --git a/drlvm/vm/jitrino/src/shared/ControlFlowGraph.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/ControlFlowGraph.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/ControlFlowGraph.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/ControlFlowGraph.h
diff --git a/drlvm/vm/jitrino/src/shared/CountWriters.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/CountWriters.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/CountWriters.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/CountWriters.cpp
diff --git a/drlvm/vm/jitrino/src/shared/CountWriters.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/CountWriters.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/CountWriters.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/CountWriters.h
diff --git a/drlvm/vm/jitrino/src/shared/Counter.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Counter.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Counter.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Counter.h
diff --git a/drlvm/vm/jitrino/src/shared/Dlink.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dlink.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Dlink.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dlink.h
diff --git a/drlvm/vm/jitrino/src/shared/Dominator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dominator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Dominator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dominator.cpp
diff --git a/drlvm/vm/jitrino/src/shared/Dominator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dominator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Dominator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Dominator.h
diff --git a/drlvm/vm/jitrino/src/shared/Event.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Event.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Event.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Event.h
diff --git a/drlvm/vm/jitrino/src/shared/FixFileName.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/FixFileName.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/FixFileName.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/FixFileName.cpp
diff --git a/drlvm/vm/jitrino/src/shared/FixFileName.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/FixFileName.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/FixFileName.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/FixFileName.h
diff --git a/drlvm/vm/jitrino/src/shared/HashSet.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/HashSet.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/HashSet.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/HashSet.h
diff --git a/drlvm/vm/jitrino/src/shared/HashTable.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/HashTable.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/HashTable.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/HashTable.h
diff --git a/drlvm/vm/jitrino/src/shared/Interval.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Interval.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Interval.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Interval.cpp
diff --git a/drlvm/vm/jitrino/src/shared/Interval.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Interval.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Interval.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Interval.h
diff --git a/drlvm/vm/jitrino/src/shared/List.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/List.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/List.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/List.h
diff --git a/drlvm/vm/jitrino/src/shared/LoopTree.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/LoopTree.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/LoopTree.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/LoopTree.cpp
diff --git a/drlvm/vm/jitrino/src/shared/LoopTree.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/LoopTree.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/LoopTree.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/LoopTree.h
diff --git a/drlvm/vm/jitrino/src/shared/MapSet.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/MapSet.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/MapSet.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/MapSet.h
diff --git a/drlvm/vm/jitrino/src/shared/MemoryAttribute.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryAttribute.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/MemoryAttribute.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryAttribute.cpp
diff --git a/drlvm/vm/jitrino/src/shared/MemoryAttribute.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryAttribute.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/MemoryAttribute.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryAttribute.h
diff --git a/drlvm/vm/jitrino/src/shared/MemoryManager.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryManager.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/MemoryManager.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryManager.cpp
diff --git a/drlvm/vm/jitrino/src/shared/MemoryManager.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryManager.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/MemoryManager.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/MemoryManager.h
diff --git a/drlvm/vm/jitrino/src/shared/PlatformDependant.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/PlatformDependant.h
similarity index 98%
rename from drlvm/vm/jitrino/src/shared/PlatformDependant.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/PlatformDependant.h
index c309604..34a1e82 100644
--- a/drlvm/vm/jitrino/src/shared/PlatformDependant.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/PlatformDependant.h
@@ -55,7 +55,7 @@
 #endif
     
     #define cdecl_       __attribute__ ((__cdecl__))
-#ifdef _EM64T_
+#ifdef HYX86_64
    #define stdcall__
 #else
     #define stdcall__    __attribute__ ((__stdcall__))
diff --git a/drlvm/vm/jitrino/src/shared/PrintDotFile.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/PrintDotFile.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/PrintDotFile.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/PrintDotFile.cpp
diff --git a/drlvm/vm/jitrino/src/shared/PrintDotFile.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/PrintDotFile.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/PrintDotFile.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/PrintDotFile.h
diff --git a/drlvm/vm/jitrino/src/shared/Queue.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Queue.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Queue.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Queue.h
diff --git a/drlvm/vm/jitrino/src/shared/Stack.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Stack.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Stack.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Stack.h
diff --git a/drlvm/vm/jitrino/src/shared/Stl.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Stl.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Stl.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Stl.h
diff --git a/drlvm/vm/jitrino/src/shared/StlPriorityQueue.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/StlPriorityQueue.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/StlPriorityQueue.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/StlPriorityQueue.h
diff --git a/drlvm/vm/jitrino/src/shared/Tree.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Tree.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Tree.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Tree.h
diff --git a/drlvm/vm/jitrino/src/shared/Type.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Type.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Type.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Type.cpp
diff --git a/drlvm/vm/jitrino/src/shared/Type.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/Type.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/Type.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/Type.h
diff --git a/drlvm/vm/jitrino/src/shared/VMMagic.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/VMMagic.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/VMMagic.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/VMMagic.cpp
diff --git a/drlvm/vm/jitrino/src/shared/VMMagic.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/VMMagic.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/VMMagic.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/VMMagic.h
diff --git a/drlvm/vm/jitrino/src/shared/XTimer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/XTimer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/XTimer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/XTimer.cpp
diff --git a/drlvm/vm/jitrino/src/shared/XTimer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/XTimer.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/XTimer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/XTimer.h
diff --git a/drlvm/vm/jitrino/src/shared/methodtable.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/methodtable.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/methodtable.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/methodtable.cpp
diff --git a/drlvm/vm/jitrino/src/shared/methodtable.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/methodtable.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/methodtable.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/methodtable.h
diff --git a/drlvm/vm/jitrino/src/shared/mkernel.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/shared/mkernel.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.cpp
index 25c50d7..d2d42b0 100644
--- a/drlvm/vm/jitrino/src/shared/mkernel.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.cpp
@@ -193,11 +193,11 @@
 #endif    
 }
 
-#if defined(_EM64T_)
+#if defined(HYX86_64)
 bool CPUID::isSSE2Supported() {
     return true;
 }
-#elif defined(_IA32_) //older IA-32
+#elif defined(HYX86) //older IA-32
 bool CPUID::isSSE2Supported() {
     /*
      * cpuid instruction: 
diff --git a/drlvm/vm/jitrino/src/shared/mkernel.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.h
similarity index 99%
rename from drlvm/vm/jitrino/src/shared/mkernel.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.h
index 5fcca0d..f2bdb35 100644
--- a/drlvm/vm/jitrino/src/shared/mkernel.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/mkernel.h
@@ -602,7 +602,7 @@
 class CPUID {
     CPUID(){}
 public:
-#if defined(_IA32_) || defined(_EM64T_)
+#if defined(HYX86) || defined(HYX86_64)
     /** SSE2 is an extension of the IA-32 architecture, since 2000. */
     static bool isSSE2Supported();
 #endif
diff --git a/drlvm/vm/jitrino/src/shared/unionfind.h b/drlvm/modules/vm/src/main/native/jitrino/shared/shared/unionfind.h
similarity index 100%
rename from drlvm/vm/jitrino/src/shared/unionfind.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/shared/unionfind.h
diff --git a/drlvm/vm/jitrino/src/translator/ByteCodeParser.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/ByteCodeParser.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/ByteCodeParser.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/ByteCodeParser.h
diff --git a/drlvm/vm/jitrino/src/translator/ExceptionInfo.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/ExceptionInfo.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/ExceptionInfo.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/ExceptionInfo.h
diff --git a/drlvm/vm/jitrino/src/translator/TranslatorIntfc.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/TranslatorIntfc.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/TranslatorIntfc.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/TranslatorIntfc.cpp
diff --git a/drlvm/vm/jitrino/src/translator/TranslatorIntfc.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/TranslatorIntfc.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/TranslatorIntfc.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/TranslatorIntfc.h
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaByteCodeParser.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeParser.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaByteCodeParser.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeParser.cpp
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaByteCodeParser.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeParser.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaByteCodeParser.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeParser.h
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeTranslator.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeTranslator.cpp
index 0f317ac..f729117 100644
--- a/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeTranslator.cpp
@@ -67,7 +67,7 @@
         || matchType(name, "org/vmmagic/unboxed/AddressArray") 
         || matchType(name, "org/vmmagic/unboxed/ObjectReferenceArray")) 
     {
-#ifdef _EM64T_
+#ifdef HYX86_64
         return tm.getArrayType(tm.getInt64Type(), false);
 #else 
         return tm.getArrayType(tm.getInt32Type(), false);
@@ -740,7 +740,7 @@
                     case Type::Double:  constVal=irBuilder.genLdConstant(*(double*)fieldAddr);break;
                     case Type::Boolean: constVal=irBuilder.genLdConstant(*(bool*)fieldAddr);break;
                     case Type::UnmanagedPtr:  assert(fieldIsMagic); 
-#ifdef _IA32_
+#ifdef HYX86
                             constVal=irBuilder.genLdConstant(*(I_32*)fieldAddr);
 #else
                             assert(sizeof(void*)==8);
@@ -2757,7 +2757,7 @@
     else if (!strcmp(mname, "nullReference")) { loadConst = true; theConst =  0;}
     if (loadConst) {
         ConstInst::ConstValue v;
-#ifdef _EM64T_
+#ifdef HYX86_64
         v.i8 = theConst;
 #else
         v.i4 = theConst;        
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeTranslator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaByteCodeTranslator.h
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaFlowGraphBuilder.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaFlowGraphBuilder.cpp
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaFlowGraphBuilder.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaFlowGraphBuilder.h
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaLabelPrepass.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaLabelPrepass.cpp
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaLabelPrepass.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaLabelPrepass.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaLabelPrepass.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaLabelPrepass.h
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaTranslator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaTranslator.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaTranslator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaTranslator.cpp
diff --git a/drlvm/vm/jitrino/src/translator/java/JavaTranslator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaTranslator.h
similarity index 100%
rename from drlvm/vm/jitrino/src/translator/java/JavaTranslator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/translator/java/JavaTranslator.h
diff --git a/drlvm/vm/jitrino/src/vm/EMInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/EMInterface.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/vm/EMInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/vm/EMInterface.cpp
diff --git a/drlvm/vm/jitrino/src/vm/EMInterface.h b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/EMInterface.h
similarity index 100%
rename from drlvm/vm/jitrino/src/vm/EMInterface.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/vm/EMInterface.h
diff --git a/drlvm/vm/jitrino/src/vm/JITInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/JITInterface.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/vm/JITInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/vm/JITInterface.cpp
index 4aa43af..45e2e57 100644
--- a/drlvm/vm/jitrino/src/vm/JITInterface.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/JITInterface.cpp
@@ -420,7 +420,7 @@
 JITEXPORT Boolean
 JIT_supports_compressed_references(JIT_Handle jit)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
         return true;
 #else
         return false;
diff --git a/drlvm/vm/jitrino/src/vm/VMInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/VMInterface.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/vm/VMInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/vm/VMInterface.cpp
diff --git a/drlvm/vm/jitrino/src/vm/VMInterface.h b/drlvm/modules/vm/src/main/native/jitrino/shared/vm/VMInterface.h
similarity index 100%
rename from drlvm/vm/jitrino/src/vm/VMInterface.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/vm/VMInterface.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.cpp
index bf7e4bc..69c2eae 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.cpp
@@ -22,7 +22,7 @@
 
 #include <fstream>
 #include "Stl.h"
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "Ia32CodeSelector.h"
 #include "Log.h"
 #include "Ia32IRManager.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.h
similarity index 94%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.h
index 0ee67f8..bf6ff8a 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/CodeGenerator_arch.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_CODE_GENERATOR_
-#define _IA32_CODE_GENERATOR_
+#ifndef HYX86CODE_GENERATOR_
+#define HYX86CODE_GENERATOR_
 
 #include "CodeGenIntfc.h"
 #include "Ia32IRManager.h"
@@ -55,4 +55,4 @@
 
 
 }} // namespace Ia32
-#endif // _IA32_CODE_GENERATOR
+#endif // HYX86CODE_GENERATOR
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32APIMagics.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32APIMagics.cpp
index a41b7e5..227cda6 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32APIMagics.cpp
@@ -113,7 +113,7 @@
 void APIMagicsHandlerSession::runImpl() {
     CompilationContext* cc = getCompilationContext();
     MemoryManager tmpMM("Inline API methods");
-#ifndef _EM64T_
+#ifndef HYX86_64
     bool mathAsMagic = getBoolArg("magic_math", true);
 #endif
     //finding all api magic calls
@@ -137,7 +137,7 @@
                         continue; 
                     };
                     if( ri->getKind() == Opnd::RuntimeInfo::Kind_MethodDirectAddr ){
-#ifndef _EM64T_
+#ifndef HYX86_64
                         MethodDesc * md = (MethodDesc*)ri->getValue(0);
                         const char* className = md->getParentType()->getName();
                         const char* methodName = md->getName();
@@ -362,7 +362,7 @@
 }
 
 void Long_numberOfLeadingZeros_Handler_x_J_x_I::run() {
-#ifdef _EM64T_
+#ifdef HYX86_64
     return;
 #else
 //  bsr r1,hi
@@ -419,7 +419,7 @@
 }
 
 void Long_numberOfTrailingZeros_Handler_x_J_x_I::run() {
-#ifdef _EM64T_
+#ifdef HYX86_64
     return;
 #else
 
@@ -495,7 +495,7 @@
 
     callInst->unlink();
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName counterRegName = RegName_RCX;
     RegName srcAddrRegName = RegName_RSI;
     RegName dstAddrRegName = RegName_RDI;
@@ -587,7 +587,7 @@
     Opnd* valForCounter = getCallSrc(callInst, 6);
     Opnd* res = getCallDst(callInst);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName counterRegName = RegName_RCX;
     RegName thisAddrRegName = RegName_RSI;
     RegName trgtAddrRegName = RegName_RDI;
@@ -681,7 +681,7 @@
     Opnd* valForCounter = getCallSrc(callInst, 4);
     Opnd* res = getCallDst(callInst);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     RegName counterRegName = RegName_RCX;
     RegName thisAddrRegName = RegName_RSI;
     RegName trgtAddrRegName = RegName_RDI;
@@ -752,7 +752,7 @@
     Opnd* start = getCallSrc(callInst, 6);
     Opnd* res = getCallDst(callInst);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     Type*   counterType = irm->getTypeManager().getInt64Type();
     Constraint regConstr(OpndKind_GPReg, OpndSize_64);
 #else
@@ -938,7 +938,7 @@
                                   dstType == irm->getTypeManager().getIntPtrType()));
 
     if(srcType != dstType) {
-#ifdef _EM64T_
+#ifdef HYX86_64
         node->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, dst, src));
 #else
         node->appendInst(irm->newCopyPseudoInst(Mnemonic_MOV, dst, src));
@@ -966,7 +966,7 @@
     }
 
 //    TypeManager& typeManager = typeManager;
-#ifdef _EM64T_
+#ifdef HYX86_64
     Type * offType = typeManager.getInt64Type();
 #else
     Type * offType = typeManager.getInt32Type();
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BBPolling.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BBPolling.cpp
index a4cb2cd..940040a 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BBPolling.cpp
@@ -261,7 +261,7 @@
 
     Type* tlsBaseType = irManager.getTypeManager().getUnmanagedPtrType(irManager.getTypeManager().getIntPtrType());
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     tlsBaseReg = irManager.newOpnd(tlsBaseType, Constraint(OpndKind_GPReg));
 #else
     tlsBaseReg = irManager.newOpnd(tlsBaseType, Constraint(RegName_EAX)|
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BCMap.h
similarity index 97%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BCMap.h
index e1b4b38..1a2ad1a 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BCMap.h
@@ -19,8 +19,8 @@
 * @author Intel, Vitaly N. Chaiko
 */
 
-#ifndef _IA32_BC_MAP_H_
-#define _IA32_BC_MAP_H_
+#ifndef HYX86BC_MAP_H_
+#define HYX86BC_MAP_H_
 
 #include "Stl.h"
 #include "MemoryManager.h"
@@ -105,4 +105,4 @@
 
 }} //namespace
 
-#endif /* _IA32_BC_MAP_H_ */
+#endif /* HYX86BC_MAP_H_ */
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BranchTrans.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BranchTrans.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32BranchTrans.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32BranchTrans.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CFG.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CFG.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CFG.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CFG.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CFG.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CFG.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CFG.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CFG.h
index 1e6ddef..d340c12 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CFG.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CFG.h
@@ -18,8 +18,8 @@
  * @author Intel, Vyacheslav P. Shakin, Mikhail Y. Fursov
  */
 
-#ifndef _IA32_CFG_H_
-#define _IA32_CFG_H_
+#ifndef HYX86CFG_H_
+#define HYX86CFG_H_
 
 #include "ControlFlowGraph.h"
 #include "MemoryManager.h"
@@ -161,4 +161,4 @@
 
 }; //namespace Ia32
 }
-#endif // _IA32_FLOWGRAPH_H
+#endif // HYX86FLOWGRAPH_H
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.cpp
index facf55b..762fbbe 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.cpp
@@ -55,7 +55,7 @@
 // STDCALLCallingConvention
 //========================================================================================
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #ifdef _WIN64
 const RegName fastCallGPRegs[4] = {RegName_RCX, RegName_RDX, RegName_R8, RegName_R9} ;
 const RegName fastCallFPRegs[4] = {RegName_XMM0,RegName_XMM1,RegName_XMM2,RegName_XMM3};
@@ -65,7 +65,7 @@
 #endif
 #endif
 
-#ifdef _IA32_
+#ifdef HYX86
 //______________________________________________________________________________________
 void STDCALLCallingConventionIA32::getOpndInfo(ArgKind kind, U_32 count, OpndInfo * infos) const
 {
@@ -180,7 +180,7 @@
 }
 #endif
 
-#ifdef _IA32_
+#ifdef HYX86
 //______________________________________________________________________________________
 Constraint STDCALLCallingConventionIA32::getCalleeSavedRegs(OpndKind regKind) const
 {
@@ -210,7 +210,7 @@
 
 
 //______________________________________________________________________________________
-#ifdef _IA32_
+#ifdef HYX86
 void ManagedCallingConventionIA32::getOpndInfo(ArgKind kind, U_32 count, OpndInfo * infos) const
 {
     if (kind == ArgKind_RetArg) {
@@ -235,7 +235,7 @@
 #else
 #endif
 
-#ifdef _IA32_
+#ifdef HYX86
 #else
 void MultiArrayCallingConventionEM64T::getOpndInfo(ArgKind kind, U_32 count, OpndInfo * infos) const
 {
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.h
index ae75fbe..c166d45 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CallingConvention.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_CALLING_CONVENTION_H_
-#define _IA32_CALLING_CONVENTION_H_
+#ifndef HYX86CALLING_CONVENTION_H_
+#define HYX86CALLING_CONVENTION_H_
 
 #include "open/types.h"
 #include "Type.h"
@@ -43,7 +43,7 @@
 #define STACK_ALIGN16         (0x00000010)
 
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define STACK_REG RegName_RSP
     #define STACK_ALIGNMENT STACK_ALIGN_HALF16  
 #else
@@ -223,7 +223,7 @@
     virtual void    getOpndInfo(ArgKind kind, U_32 argCount, OpndInfo * infos) const;
 };
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 typedef STDCALLCallingConventionEM64T       STDCALLCallingConvention;
 typedef CDECLCallingConventionEM64T         CDECLCallingConvention;
 typedef ManagedCallingConventionEM64T       ManagedCallingConvention;
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CgUtils.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CgUtils.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CgUtils.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CgUtils.h
index 64cc3ee..4670c40 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CgUtils.h
@@ -18,8 +18,8 @@
  * @author Alexander Astapchuk
  */
 
-#if !defined(__IA32_CGUTILS_INCLUDED__)
-#define __IA32_CGUTILS_INCLUDED__
+#if !defined(_HYX86CGUTILS_INCLUDED__)
+#define _HYX86CGUTILS_INCLUDED__
 
 #include "Ia32IRManager.h"
 
@@ -295,4 +295,4 @@
 
 }}; // ~namespace Jitrino::Ia32
 
-#endif  // ~ifndef __IA32_CGUTILS_INCLUDED__
+#endif  // ~ifndef _HYX86CGUTILS_INCLUDED__
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeEmitter.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeEmitter.cpp
index e5b654b..59ff414 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeEmitter.cpp
@@ -20,7 +20,7 @@
 
 #include "Ia32IRManager.h"
 #include "Log.h"
-#include "Ia32RuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 #include "Ia32Printer.h"
 #include "Ia32RegAllocCheck.h"
 #include "Ia32GCMap.h"
@@ -197,7 +197,7 @@
         Opnd::RuntimeInfo * ri=NULL;
         if (opnd->isPlacedIn(OpndKind_Mem)&&opnd->getMemOpndKind()==MemOpndKind_ConstantArea){
             Opnd * addrOpnd=opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement);
-#ifndef _EM64T_
+#ifndef HYX86_64
             ri=addrOpnd->getRuntimeInfo();
             assert(ri->getKind()==Opnd::RuntimeInfo::Kind_ConstantAreaItem);
 #else
@@ -512,7 +512,7 @@
                     // the last two
                     ip = (U_8*)EncoderBase::nops((char*)ip,2);
                 }
-#ifdef _EM64T_
+#ifdef HYX86_64
                     // these nops are required for call transformation from immediate into register form
                     // nops for MOV r11, callTarget (when !fit32(call_offset) ) <opcode + 8 byte address>
                     ip = (U_8*)EncoderBase::nops((char*)ip, 10);
@@ -641,7 +641,7 @@
                 } else 
                     continue;
                 int64 offset=targetCodeStartAddr-instCodeEndAddr;
-#ifdef _EM64T_
+#ifdef HYX86_64
                 if ( !fit32(offset) ) { // offset is not a signed value that fits into 32 bits
                     // this is for direct calls only
                     assert(inst->hasKind(Inst::Kind_CallInst));
@@ -721,7 +721,7 @@
     // we can not guarantee the (callAddr+1) aligned
     // self-jump is a kind of lock for the time of call patching
     U_32 movSize =
-#ifdef _EM64T_
+#ifdef HYX86_64
                      10;
 #else
                      0; // no additional MOV on ia32
@@ -750,7 +750,7 @@
 
     // The patching itself
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     bool registerCallIsBeingPatched = ( 0xB8 == (0xF8 &(*(movAddr+1))) ); // test opcode (&0xF8 - to skip rd bits)
 
     EncoderBase::Operands args;
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGeneratorFlags.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeGeneratorFlags.h
similarity index 94%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGeneratorFlags.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeGeneratorFlags.h
index e717a7d..88722bd 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeGeneratorFlags.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeGeneratorFlags.h
@@ -18,8 +18,8 @@
 * @author Vyacheslav P. Shakin
 */
 
-#ifndef _IA32_CODE_GENERATORFLAGS_
-#define _IA32_CODE_GENERATORFLAGS_
+#ifndef HYX86CODE_GENERATORFLAGS_
+#define HYX86CODE_GENERATORFLAGS_
 
 namespace Jitrino
 {
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayout.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayout.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayout.h
similarity index 97%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayout.h
index 9113ffc..d97a312 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayout.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayout.h
@@ -18,8 +18,8 @@
  * @author Intel, Mikhail Y. Fursov
  */
 
-#ifndef _IA32_CODE_LAYOUT
-#define _IA32_CODE_LAYOUT
+#ifndef HYX86CODE_LAYOUT
+#define HYX86CODE_LAYOUT
 
 
 #include "Ia32IRManager.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutBottomUp.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutBottomUp.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutBottomUp.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutBottomUp.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutBottomUp.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutBottomUp.h
similarity index 95%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutBottomUp.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutBottomUp.h
index ab68623..8cac7d6 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutBottomUp.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutBottomUp.h
@@ -18,8 +18,8 @@
  * @author Intel, Mikhail Y. Fursov
  */
 
-#ifndef _IA32_CODE_LAYOUT_BOTTOM_UP
-#define _IA32_CODE_LAYOUT_BOTTOM_UP
+#ifndef HYX86CODE_LAYOUT_BOTTOM_UP
+#define HYX86CODE_LAYOUT_BOTTOM_UP
 
 #include "Ia32CodeLayout.h"
 namespace Jitrino
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutTopDown.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutTopDown.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutTopDown.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutTopDown.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutTopDown.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutTopDown.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutTopDown.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutTopDown.h
index a0c0e28..df9014d 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeLayoutTopDown.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeLayoutTopDown.h
@@ -18,8 +18,8 @@
  * @author Intel, Mikhail Y. Fursov
  */
 
-#ifndef _IA32_CODE_LAYOUT_TOP_DOWN
-#define _IA32_CODE_LAYOUT_TOP_DOWN
+#ifndef HYX86CODE_LAYOUT_TOP_DOWN
+#define HYX86CODE_LAYOUT_TOP_DOWN
 
 #include "Ia32CodeLayout.h"
 namespace Jitrino
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.cpp
index d81043c..5299061 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.cpp
@@ -20,7 +20,7 @@
 
 
 #include <stdlib.h>
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "Ia32CodeSelector.h"
 #include "Ia32CFG.h"
 #include "Ia32InstCodeSelector.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.h
index 5cb1cb3..647dafa 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CodeSelector.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_CODE_SELECTOR_H_
-#define _IA32_CODE_SELECTOR_H_
+#ifndef HYX86CODE_SELECTOR_H_
+#define HYX86CODE_SELECTOR_H_
 
 #include "Stl.h"
 #include "CodeGenIntfc.h"
@@ -233,4 +233,4 @@
 }; //namespace Ia32
 }
 
-#endif // _IA32_CODE_SELECTOR_H_
+#endif // HYX86CODE_SELECTOR_H_
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ComplexAddrFormLoader.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ComplexAddrFormLoader.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ComplexAddrFormLoader.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ComplexAddrFormLoader.cpp
index e62ceac..cc64971 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ComplexAddrFormLoader.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ComplexAddrFormLoader.cpp
@@ -19,7 +19,7 @@
  */
 
 
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "Ia32CFG.h"
 #include "Ia32IRManager.h"
 #include "Ia32Inst.h"
@@ -185,7 +185,7 @@
             return;
         } else if(src2->isPlacedIn(OpndKind_Imm)) {
             irManager->resolveRuntimeInfo(src2);
-#ifdef _EM64T_
+#ifdef HYX86_64
             if((src2->getImmValue() > (int64)0x7FFFFFFF) || (src2->getImmValue() < -((int64)0x10000000))) {
                 table.baseOp = table.suspOp;
                 return;
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.cpp
index 7ebf251..e273729 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.cpp
@@ -85,7 +85,7 @@
             case OpndKind_SReg:         return OpndSize_16;
             case OpndKind_FPReg:        return OpndSize_80;
             case OpndKind_XMMReg:       return OpndSize_128;
-#ifdef _EM64T_
+#ifdef HYX86_64
             case OpndKind_GPReg:        return OpndSize_64;
 #else
             case OpndKind_GPReg:        return OpndSize_32;
@@ -114,14 +114,14 @@
     U_32 newKind=kind, newMask=0;
     U_32 newRegKind=newKind & OpndKind_Reg;
     OpndSize maxSubregisterSize =
-#ifdef _EM64T_
+#ifdef HYX86_64
                                     OpndSize_32;
 #else
                                     OpndSize_16;
 #endif
 
     if (newRegKind == OpndKind_GPReg || ( (newRegKind & OpndKind_GPReg) && sz <= maxSubregisterSize) ){
-#ifndef _EM64T_
+#ifndef HYX86_64
         if (sz==OpndSize_8 && (s==OpndSize_16 || s==OpndSize_32))
             newMask=((mask>>4)|mask)&0xf;
         else if (sz==OpndSize_16)
@@ -155,7 +155,7 @@
     OpndKind regKind=getRegKind(regName);
 
     if (regKind==OpndKind_GPReg){
-#ifndef _EM64T_
+#ifndef HYX86_64
         if (sz==OpndSize_8 && (s==OpndSize_16 || s==OpndSize_32)){
             U_32 idx=getRegIndex(regName);
             if (idx>4)
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.h
index 0675289..2281c58 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Constraint.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Constraint.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_CONSTRAINT_H_
-#define _IA32_CONSTRAINT_H_
+#ifndef HYX86CONSTRAINT_H_
+#define HYX86CONSTRAINT_H_
 
 #include "open/types.h"
 #include "Ia32IRConstants.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ConstraintsResolver.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ConstraintsResolver.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ConstraintsResolver.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ConstraintsResolver.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ConstraintsResolver.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ConstraintsResolver.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ConstraintsResolver.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ConstraintsResolver.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CopyExpansion.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CopyExpansion.cpp
index a95c546..9253e9f 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32CopyExpansion.cpp
@@ -411,7 +411,7 @@
                             if (toOpnd->getRegName()==fromOpnd->getRegName())
                                 continue;
                         }else{
-#ifdef _EM64T_
+#ifdef HYX86_64
                             if (!calculatingRegUsage && ((toOpnd->isPlacedIn(OpndKind_Mem) && fromOpnd->isPlacedIn(OpndKind_Mem))||fromOpnd->isPlacedIn(OpndKind_Imm))){
 #else
                             if (!calculatingRegUsage && ((toOpnd->isPlacedIn(OpndKind_Mem) && fromOpnd->isPlacedIn(OpndKind_Mem))||(toOpnd->isPlacedIn(OpndKind_Reg) && fromOpnd->isPlacedIn(OpndKind_Imm)))){
@@ -422,7 +422,7 @@
                         }
                         copySequence = irManager->newCopySequence(Mnemonic_MOV, toOpnd, fromOpnd, gpRegUsageMask, flagsRegUsageMask);
                     }else if (mn==Mnemonic_PUSH||mn==Mnemonic_POP){
-#ifdef _EM64T_
+#ifdef HYX86_64
                         if (!calculatingRegUsage && (inst->getOpnd(0)->isPlacedIn(OpndKind_Mem)||inst->getOpnd(0)->isPlacedIn(OpndKind_Imm))){
 #else
                         if (!calculatingRegUsage && inst->getOpnd(0)->isPlacedIn(OpndKind_Mem)){
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32DCE.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32DCE.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32DCE.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32DCE.cpp
index 1a01bab..1680d6c 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32DCE.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32DCE.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "Ia32IRManager.h"
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 
 namespace Jitrino
 {
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32EarlyPropagation.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32EarlyPropagation.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32EarlyPropagation.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32EarlyPropagation.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.cpp
index dd63a57..c2f82ac 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.cpp
@@ -28,7 +28,7 @@
 namespace Jitrino {
 namespace Ia32 {
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     //FIXME64: for adapter needs
     static bool is_ptr_type(const Type* typ) {
         switch(typ->tag) {
@@ -51,7 +51,7 @@
         }
         return false;
     }
-#endif  // _EM64T_
+#endif  // HYX86_64
 
 static InstPrefix getInstPrefixFromSReg(RegName reg) {
     if (reg == RegName_Null) {
@@ -246,7 +246,7 @@
                 }
                 RegName baseReg = pbase == NULL ? RegName_Null : pbase->getRegName();
                 RegName indexReg = pindex == NULL ? RegName_Null : pindex->getRegName();
-#ifdef _EM64T_
+#ifdef HYX86_64
                 // FIXME64 adapter: all PTR types go as 64 bits
                 // this is a porting quick workaround, should be fixed
                 assert(pdisp == NULL || fit32(disp));
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.h
index b7c8f7e..917ad2b 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Encoder.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Encoder.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_ENCODER_H_
-#define _IA32_ENCODER_H_
+#ifndef HYX86ENCODER_H_
+#define HYX86ENCODER_H_
 
 #include "open/types.h"
 #include "Stl.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32FastArrayFilling.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32FastArrayFilling.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32FastArrayFilling.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32FastArrayFilling.cpp
index 9526fa0..4dfe969 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32FastArrayFilling.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32FastArrayFilling.cpp
@@ -119,7 +119,7 @@
         //insert filling instructions 
         Opnd * memOp1 = irManager->newMemOpndAutoKind(value->getType(), index);
         loopNode->appendInst(irManager->newCopyPseudoInst(Mnemonic_MOV, memOp1, value));
-#ifndef _EM64T_
+#ifndef HYX86_64
         Opnd * memOp2 = irManager->newMemOpndAutoKind(value->getType(), index,irManager->newImmOpnd(int32Type,4));
         loopNode->appendInst(irManager->newCopyPseudoInst(Mnemonic_MOV, memOp2, value));
 #endif
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.cpp
index f56b88b..95e1340 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.cpp
@@ -20,7 +20,7 @@
 
 #include "Ia32GCMap.h"
 #include "Ia32Inst.h"
-#include "Ia32RuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 #include "Ia32StackInfo.h"
 #include "Ia32GCSafePoints.h"
 #include "XTimer.h"
@@ -131,7 +131,7 @@
                 bool res = isUnmanagedFieldPtr(managedOpnd);
                 if (!res) {
                     Log::out()<<"GCMap::checkManaged2UnmanagedConv failure, managedOpnd="<<managedOpnd->getFirstId()<<std::endl;
-#ifdef _IA32_
+#ifdef HYX86
                     // FIXME em64t
 // TODO: Fails with genIdentityHashCode=true
 //                    assert(0);
@@ -188,13 +188,13 @@
         MPtrPair* pair = GCSafePointsInfo::findPairByMPtrOpnd(pairs, opnd);
         I_32 offset = pair == NULL ? 0 : pair->getOffset();
         bool isObject = offset == 0;
-#ifdef _EM64T_
+#ifdef HYX86_64
         bool isCompressed = (opnd->getType()->tag <= Type::CompressedVTablePtr && opnd->getType()->tag >= Type::CompressedSystemObject);
 #endif
         GCSafePointOpnd* gcOpnd;
         RegName reg = opnd->getRegName();
         if (reg != RegName_Null) {
-#ifdef _EM64T_
+#ifdef HYX86_64
             gcOpnd = new (mm) GCSafePointOpnd(isObject, TRUE, U_32(reg), offset, isCompressed);
 #else
             gcOpnd = new (mm) GCSafePointOpnd(isObject, TRUE, U_32(reg), offset);
@@ -460,7 +460,7 @@
 #ifdef ENABLE_GC_RT_CHECKS
             GCMap::checkObject(tm, *(void**)valPtrAddr);
 #endif
-#ifdef _EM64T_
+#ifdef HYX86_64
             if(gcOpnd->isCompressed())
                 gcInterface->enumerateCompressedRootReference((U_32*)valPtrAddr);
             else
@@ -487,7 +487,7 @@
         addr = (POINTER_SIZE_INT)stackPtr;
     } else { 
         assert(gcOpnd->isOnStack());
-#ifdef _EM64T_
+#ifdef HYX86_64
         addr = ctx->rsp + (POINTER_SIZE_INT)gcOpnd->getDistFromInstESP();
 #else
         addr = ctx->esp + gcOpnd->getDistFromInstESP();
@@ -527,7 +527,7 @@
     U_32 stackInfoSize = (U_32)StackInfo::getByteSize(methodDesc);
     U_8* infoBlock = methodDesc->getInfoBlock();
     U_8* gcBlock = infoBlock + stackInfoSize;
-#ifdef _EM64T_
+#ifdef HYX86_64
     const POINTER_SIZE_INT* gcPointImage = GCMap::findGCSafePointStart((POINTER_SIZE_INT*)gcBlock, *context->p_rip);
 #else
     const POINTER_SIZE_INT* gcPointImage = GCMap::findGCSafePointStart((POINTER_SIZE_INT*)gcBlock, *context->p_eip);
@@ -539,7 +539,7 @@
             //this is a performance filter for empty points 
             // and debug filter for hardware exception point that have no stack info assigned.
             StackInfo stackInfo(mm);
-#ifdef _EM64T_
+#ifdef HYX86_64
             stackInfo.read(methodDesc, *context->p_rip, false);
 #else
             stackInfo.read(methodDesc, *context->p_eip, false);
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.h
similarity index 97%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.h
index a7a4c52..2fe9d72 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCMap.h
@@ -18,8 +18,8 @@
  * @author Intel, Mikhail Y. Fursov
  */
 
-#ifndef _IA32_GC_MAP_H_
-#define _IA32_GC_MAP_H_
+#ifndef HYX86GC_MAP_H_
+#define HYX86GC_MAP_H_
 
 #include "Stl.h"
 #include "MemoryManager.h"
@@ -105,7 +105,7 @@
         friend class GCSafePoint;
         static const U_32 OBJ_MASK  = 0x1;
         static const U_32 REG_MASK  = 0x2;
-#ifdef _EM64T_
+#ifdef HYX86_64
         static const U_32 COMPRESSED_MASK  = 0x4;
 #endif
 
@@ -119,7 +119,7 @@
 
     public:
         
-#ifdef _EM64T_
+#ifdef HYX86_64
         GCSafePointOpnd(bool isObject, bool isOnRegister, I_32 _val, I_32 _mptrOffset, bool isCompressed=false) : val(_val), mptrOffset(_mptrOffset) {
             flags = flags | (isCompressed ? COMPRESSED_MASK: 0);
 #else
@@ -138,7 +138,7 @@
         bool isOnRegister() const { return (flags & REG_MASK)!=0;}
         bool isOnStack() const {return !isOnRegister();}
         
-#ifdef _EM64T_
+#ifdef HYX86_64
         bool isCompressed() const { return (flags & COMPRESSED_MASK)!=0;}
 #endif      
         RegName getRegName() const { assert(isOnRegister()); return RegName(val);}
@@ -178,4 +178,4 @@
 
 }} //namespace
 
-#endif /* _IA32_GC_MAP_H_ */
+#endif /* HYX86GC_MAP_H_ */
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.cpp
index bbf7082..a6bf7ad 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.cpp
@@ -328,7 +328,7 @@
 
 static bool isHeapBase(Opnd* immOpnd) {
     assert(immOpnd->isPlacedIn(OpndKind_Imm));
-#ifndef _EM64T_
+#ifndef HYX86_64
     return false;
 #else 
     int64 heapBase = (int64)VMInterface::getHeapBase();
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.h
index faf9df9..6905154 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GCSafePoints.h
@@ -19,8 +19,8 @@
  */
 
 
-#ifndef _IA32_GC_SAFE_POINTS_H_
-#define _IA32_GC_SAFE_POINTS_H_
+#ifndef HYX86GC_SAFE_POINTS_H_
+#define HYX86GC_SAFE_POINTS_H_
 
 #include "Ia32IRManager.h"
 namespace Jitrino
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GlobalPropagation.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GlobalPropagation.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32GlobalPropagation.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32GlobalPropagation.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32I8Lowerer.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32I8Lowerer.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRConstants.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRConstants.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRConstants.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRConstants.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRConstants.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRConstants.h
similarity index 97%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRConstants.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRConstants.h
index d5ff95c..05a700e 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRConstants.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRConstants.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_IR_CONSTANTS_H_
-#define _IA32_IR_CONSTANTS_H_
+#ifndef HYX86IR_CONSTANTS_H_
+#define HYX86IR_CONSTANTS_H_
 
 #include "open/types.h"
 #include "Stl.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.cpp
index 65684ac..d1fdaa1 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.cpp
@@ -24,7 +24,7 @@
 #include "Log.h"
 #include "EMInterface.h"
 #include "Ia32Printer.h"
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "Dominator.h"
 #include <math.h>
 
@@ -167,7 +167,7 @@
 {
     ConstantAreaItem * item=newConstantAreaItem(f);
     Opnd * addr=newImmOpnd(typeManager.getUnmanagedPtrType(typeManager.getSingleType()), Opnd::RuntimeInfo::Kind_ConstantAreaItem, item);
-#ifdef _EM64T_
+#ifdef HYX86_64
     bb->appendInst(newCopyPseudoInst(Mnemonic_MOV, baseOpnd, addr));
     return newMemOpndAutoKind(typeManager.getSingleType(), MemOpndKind_ConstantArea, baseOpnd);
 #else
@@ -180,7 +180,7 @@
 {
     ConstantAreaItem * item=newConstantAreaItem(d);
     Opnd * addr=newImmOpnd(typeManager.getUnmanagedPtrType(typeManager.getDoubleType()), Opnd::RuntimeInfo::Kind_ConstantAreaItem, item);
-#ifdef _EM64T_
+#ifdef HYX86_64
     bb->appendInst(newCopyPseudoInst(Mnemonic_MOV, baseOpnd, addr));
     return newMemOpndAutoKind(typeManager.getDoubleType(), MemOpndKind_ConstantArea, baseOpnd);
 #else
@@ -213,7 +213,7 @@
     // so it allows to replace an Opnd (used in SpillGen) and keep the table 
     // itself intact.
     Opnd * tableAddr=newImmOpnd(typeManager.getIntPtrType(), Opnd::RuntimeInfo::Kind_ConstantAreaItem, item);
-#ifndef _EM64T_
+#ifndef HYX86_64
     Opnd * targetOpnd = newMemOpnd(typeManager.getIntPtrType(), 
         MemOpndKind_ConstantArea, 0, index, newImmOpnd(typeManager.getInt32Type(), sizeof(POINTER_SIZE_INT)), tableAddr);
 #else
@@ -983,7 +983,7 @@
     RegName tmpRegName=RegName_Null, unusedTmpRegName=RegName_Null;
     bool registerSetNotLocked = !isRegisterSetLocked(OpndKind_GPReg);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     for (U_32 reg = RegName_RAX; reg<=RegName_R15/*(U_32)(targetOpnd->getSize()<OpndSize_64?RegName_RBX:RegName_RDI)*/; reg++) {
 #else
     for (U_32 reg = RegName_EAX; reg<=(U_32)(targetOpnd->getSize()<OpndSize_32?RegName_EBX:RegName_EDI); reg++) {
@@ -1053,7 +1053,7 @@
     OpndKind targetKind=(OpndKind)targetConstraint.getKind();
     OpndKind sourceKind=(OpndKind)sourceConstraint.getKind();
 
-#if defined(_DEBUG) || !defined(_EM64T_)
+#if defined(_DEBUG) || !defined(HYX86_64)
     OpndSize targetSize=targetConstraint.getSize();
     assert(targetSize<=sourceSize); // only same size or truncating conversions are allowed
 #endif
@@ -1064,7 +1064,7 @@
             return newInst(Mnemonic_XOR,targetOpnd, targetOpnd);
         }
         else if (targetKind==OpndKind_XMMReg && sourceOpnd->getMemOpndKind()==MemOpndKind_ConstantArea) {
-#ifdef _EM64T_
+#ifdef HYX86_64
             Opnd * addr = NULL;
             Opnd * base = sourceOpnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Base);
             if(base) {
@@ -1109,7 +1109,7 @@
     ){
         if (sourceKind==OpndKind_Mem && targetKind==OpndKind_Mem){
             Inst * instList=NULL;
-#ifndef _EM64T_
+#ifndef HYX86_64
             U_32 targetByteSize=getByteSize(targetSize);
             if (sourceByteSize<=4){
                 instList=newMemMovSequence(targetOpnd, sourceOpnd, regUsageMask);
@@ -1134,7 +1134,7 @@
             assert(instList!=NULL);
             return instList;
         }else{
-#ifdef _EM64T_
+#ifdef HYX86_64
             if((targetOpnd->getMemOpndKind() == MemOpndKind_StackAutoLayout) && (sourceKind==OpndKind_Imm) && (sourceOpnd->getSize() == OpndSize_64)) 
                 return newMemMovSequence(targetOpnd, sourceOpnd, regUsageMask, false);
             else 
@@ -1205,7 +1205,7 @@
 
     Inst * instList=NULL;
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     if ( ((kind==OpndKind_GPReg ||kind==OpndKind_Mem)&& size!=OpndSize_32)||(kind==OpndKind_Imm && size<OpndSize_32)){
             return newInst(mn, opnd);
 #else
@@ -1233,7 +1233,7 @@
     }
     Opnd * espOpnd=getRegOpnd(STACK_REG);
     Opnd * tmp=newMemOpnd(opnd->getType(), MemOpndKind_StackManualLayout, espOpnd, 0); 
-#ifdef _EM64T_
+#ifdef HYX86_64
     Opnd * sizeOpnd=newImmOpnd(typeManager.getInt32Type(), sizeof(POINTER_SIZE_INT));
     if(kind==OpndKind_Imm) {
         assert(mn==Mnemonic_PUSH);
@@ -1309,7 +1309,7 @@
     assert(getRegSize(regName)==Constraint::getDefaultSize(getRegKind(regName))); // are we going to change this?
     U_32 idx=( (getRegKind(regName) & 0x1f) << 4 ) | ( getRegIndex(regName)&0xf );
     if (!regOpnds[idx]){
-#ifdef _EM64T_
+#ifdef HYX86_64
         Type * t = (getRegSize(regName) == OpndSize_64 ? typeManager.getUInt64Type() : typeManager.getUInt32Type());
         regOpnds[idx]=newRegOpnd(t, regName);
 #else
@@ -1326,7 +1326,7 @@
         if (opnd->isPlacedIn(regKind)) {
             RegName reg = opnd->getRegName();
             unsigned mask = getRegMask(reg);
-#if !defined(_EM64T_)
+#if !defined(HYX86_64)
             if ((reg == RegName_AH) || (reg == RegName_CH) || (reg == RegName_DH) || (reg == RegName_BH))
                 mask >>= 4;
 #endif
@@ -1392,7 +1392,7 @@
         case Type::Char:
             size = OpndSize_16;
             break;
-#ifndef _EM64T_
+#ifndef HYX86_64
         case Type::IntPtr:   
         case Type::UIntPtr:   
 #endif
@@ -1400,7 +1400,7 @@
         case Type::UInt32:
             size = OpndSize_32;
             break;
-#ifdef _EM64T_
+#ifdef HYX86_64
         case Type::IntPtr:   
         case Type::UIntPtr:   
 #endif
@@ -1418,7 +1418,7 @@
             size = OpndSize_80;
             break;
         default:
-#ifdef _EM64T_
+#ifdef HYX86_64
             size = (tag>=Type::CompressedSystemObject && tag<=Type::CompressedVTablePtr)?OpndSize_32:OpndSize_64;
 #else
             size = OpndSize_32;
@@ -1559,7 +1559,7 @@
                 {
                     BitSet * exitLs  = node->getLiveAtEntry();
                     EntryPointPseudoInst * entryPointInst = getEntryPointInst();
-#ifdef _EM64T_
+#ifdef HYX86_64
                     Opnd * thisOpnd  = entryPointInst->thisOpnd;
                     //on EM64T 'this' opnd is spilled to stack only after finalizeCallSites call (copy expansion pass)
                     //TODO: do it after code selector and tune early propagation and regalloc to skip this opnd from optimizations.
@@ -1708,7 +1708,7 @@
 
 void IRManager::finalizeCallSites()
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     MethodDesc& md = getMethodDesc();
     if (!md.isStatic() 
             && (md.isSynchronized() || md.isParentClassIsLikelyExceptionType())) {
@@ -1911,7 +1911,7 @@
                     assert(dispatchEdge!=NULL);
                     Node* dispatchNode= dispatchEdge->getTargetNode();
                     if ((dispatchNode!=fg->getUnwindNode()) ||(checkOpnds[opnd] == (POINTER_SIZE_INT)-1
-#ifdef _EM64T_
+#ifdef HYX86_64
                             ||!Type::isCompressedReference(opnd->getType()->tag)
 #endif
                             )){
@@ -1966,7 +1966,7 @@
 
     assert(excType);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     bool lazy = false;
 #else
     bool lazy = true;
@@ -2302,7 +2302,7 @@
                 if (subOpnd!=NULL){
                     Type * type=subOpnd->getType();
                     if (type->isManagedPtr() || type->isObject() || type->isMethodPtr() || type->isVTablePtr() || type->isUnmanagedPtr()
-#ifdef _EM64T_
+#ifdef HYX86_64
                         || subOpnd->getRegName() == RegName_RSP/*SOE handler*/
 #else
                         || subOpnd->getRegName() == RegName_ESP/*SOE handler*/
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.h
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.h
index 1636ebb..1edf4ce 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32IRManager.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_IRMANAGER_H_
-#define _IA32_IRMANAGER_H_
+#ifndef HYX86IRMANAGER_H_
+#define HYX86IRMANAGER_H_
 
 #include "open/types.h"
 #include "Stl.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.cpp
index 997ef19..2123a1b 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.cpp
@@ -905,7 +905,7 @@
 //   class EntryPointPseudoInst
 //=========================================================================================================
 EntryPointPseudoInst::EntryPointPseudoInst(IRManager * irm, int id, const CallingConvention * cc)
-#ifdef _EM64T_
+#ifdef HYX86_64
     : Inst(Mnemonic_NULL, id, Inst::Form_Extended), thisOpnd(0), callingConventionClient(irm->getMemoryManager(), cc)
 #else
     : Inst(Mnemonic_NULL, id, Inst::Form_Extended), callingConventionClient(irm->getMemoryManager(), cc)
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.h
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.h
index cc03739..f051bb2 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Inst.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_INST_H_
-#define _IA32_INST_H_
+#ifndef HYX86INST_H_
+#define HYX86INST_H_
 
 #include "open/types.h"
 #include "Stl.h"
@@ -1306,7 +1306,7 @@
 
     virtual bool hasSideEffect()const { return true; }
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     Opnd * thisOpnd;
 #endif
     //--------------------------------------------------------------------
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.cpp
index aa32e21..6dc54e2 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.cpp
@@ -20,7 +20,7 @@
 
 #include "Log.h"
 #include "Ia32InstCodeSelector.h"
-#include "Ia32CodeGenerator.h"
+#include "CodeGenerator_arch.h"
 #include "Ia32Printer.h"
 #include "EMInterface.h"
 #include "VMInterface.h"
@@ -302,7 +302,7 @@
 void InstCodeSelector::copyOpndTrivialOrTruncatingConversion(Opnd *dst, Opnd *src) 
 { 
     assert(dst->getSize()<=src->getSize());
-#ifndef _EM64T_
+#ifndef HYX86_64
     if (src->getType()->isInteger()&&src->getSize()==OpndSize_64)
         appendInsts(irManager.newI8PseudoInst(Mnemonic_MOV, 1, dst, src));
     else
@@ -353,7 +353,7 @@
     }else{
         if (dstOpnd==NULL)
             dstOpnd=irManager.newOpnd(dstType);
-#ifdef _EM64T_
+#ifdef HYX86_64
             appendInsts(irManager.newInstEx(srcType->isSignedInteger() & !isZeroExtend ? Mnemonic_MOVSX:Mnemonic_MOVZX, 1, dstOpnd, srcOpnd));
 #else
         if (dstSize<OpndSize_64){
@@ -389,7 +389,7 @@
             appendInsts(convInst);
         } else { 
             //use FPU to convert long to float/double on IA32 platform
-#ifdef _EM64T_
+#ifdef HYX86_64
             Opnd* int64Opnd = srcOpnd;
 #else  //32 bit mode - use memory aliasing for 64bit opnd
             //copy i8 to stack first
@@ -491,7 +491,7 @@
         if (srcSize == dstSize) {
             appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, dstOpnd, srcOpnd));
         } else {
-#ifdef _EM64T_
+#ifdef HYX86_64
             if (srcType->isInteger()) {
                 appendInsts(irManager.newInstEx(isZeroExtend?Mnemonic_MOVZX:Mnemonic_MOVSX, 1, dstOpnd, srcOpnd)); 
             }       
@@ -527,7 +527,7 @@
             copyOpndTrivialOrTruncatingConversion(dstOpnd, srcOpnd);
         } else {
             assert(dstSize==OpndSize_64);
-#ifdef _EM64T_
+#ifdef HYX86_64
             appendInsts(irManager.newInstEx(srcType->isSignedInteger()?Mnemonic_MOVSX:Mnemonic_MOVZX, 1, dstOpnd, srcOpnd));
 #else
             appendInsts(irManager.newI8PseudoInst(srcType->isSignedInteger()?Mnemonic_MOVSX:Mnemonic_MOVZX, 1, dstOpnd, srcOpnd));
@@ -602,14 +602,14 @@
             sizeType=isSigned?typeManager.getInt16Type():typeManager.getUInt16Type();
             break;
 
-#ifdef _IA32_
+#ifdef HYX86
         case ConvertToIntOp::I:
 #endif
         case ConvertToIntOp::I4:
             sizeType=isSigned?typeManager.getInt32Type():typeManager.getUInt32Type();
             break;
 
-#ifdef _EM64T_
+#ifdef HYX86_64
         case ConvertToIntOp::I:
 #endif
         case ConvertToIntOp::I8:
@@ -670,7 +670,7 @@
         case Mnemonic_OR:
         case Mnemonic_XOR:
         case Mnemonic_NOT:
-#ifndef _EM64T_
+#ifndef HYX86_64
             appendInsts(irManager.newI8PseudoInst(mn, 1, dst, src1, src2));
 #else
             appendInsts(irManager.newInstEx(mn, 1, dst, src1, src2));
@@ -816,7 +816,7 @@
             srcOpnd1=(Opnd*)convert(src1, dstType);
             srcOpnd2=(Opnd*)convert(src2, dstType);
             swapIfLastIs(srcOpnd1, srcOpnd2);
-#ifndef _EM64T_
+#ifndef HYX86_64
             appendInsts(irManager.newI8PseudoInst(Mnemonic_IMUL,1,dst,srcOpnd1,srcOpnd2));
 #else
             appendInsts(irManager.newInstEx(Mnemonic_IMUL,1,dst,srcOpnd1,srcOpnd2));
@@ -872,7 +872,7 @@
             srcOpnd1=(Opnd*)convert(src1, dstType);
             srcOpnd2=(Opnd*)convert(src2, dstType);
 
-#ifndef _EM64T_
+#ifndef HYX86_64
             //
             // NOTE: as we don't have IREM mnemonic, then generate I8Inst 
             // with IDIV mnemonic. The 4th fake non-zero argument means 
@@ -971,7 +971,7 @@
             Type * dstType=irManager.getTypeFromTag(Type::Int64);
             Opnd * dstMOV = irManager.newOpnd(dstType);
             Opnd * src_null = irManager.newImmOpnd(dstType, 0);
-#ifndef _EM64T_
+#ifndef HYX86_64
             appendInsts(irManager.newI8PseudoInst(Mnemonic_MOV,1,dstMOV,src_null));
 #else
             appendInsts(irManager.newInstEx(Mnemonic_MOV,1,dstMOV,src_null));
@@ -1187,7 +1187,7 @@
         case IntegerOp::I8:
             dstType=irManager.getTypeFromTag(Type::Int64);
             dst=irManager.newOpnd(dstType);
-#ifndef _EM64T_
+#ifndef HYX86_64
             appendInsts(irManager.newI8PseudoInst(mn,1,dst,(Opnd*)convert(value, dstType),(Opnd*)convert(shiftAmount, typeManager.getInt32Type())));
 #else
             appendInsts(irManager.newInstEx(mn,1,dst,(Opnd*)convert(value, dstType),(Opnd*)convert(shiftAmount, typeManager.getInt32Type())));
@@ -1336,7 +1336,7 @@
     bool swapped=false;
     switch(opType){
         case CompareOp::I4:
-#ifndef _EM64T_
+#ifndef HYX86_64
         case CompareOp::I:
         case CompareOp::Ref:
 #endif
@@ -1352,7 +1352,7 @@
             }
             break;
         }
-#ifdef _EM64T_
+#ifdef HYX86_64
         case CompareOp::I:
         case CompareOp::Ref:
 #endif
@@ -1366,7 +1366,7 @@
                 srcOpnd2=(Opnd*)convert(src2, srcType);
             }
             swapped=swapIfLastIs(srcOpnd1, srcOpnd2);
-#ifndef _EM64T_
+#ifndef HYX86_64
             Opnd * dst = irManager.getRegOpnd(RegName_EFLAGS);
             appendInsts(irManager.newI8PseudoInst(Mnemonic_CMP,1,dst,srcOpnd1,srcOpnd2));
 #else
@@ -1380,7 +1380,7 @@
         {
             Type * srcType=irManager.getTypeFromTag(Type::Double);
             Opnd * srcOpnd1=(Opnd*)convert(src1, srcType);
-#ifdef _EM64T_
+#ifdef HYX86_64
             Opnd * baseOpnd = irManager.newOpnd(typeManager.getUnmanagedPtrType(srcType));
             Opnd * srcOpnd2=src2?(Opnd*)convert(src2, srcType):irManager.newFPConstantMemOpnd((double)0.0, baseOpnd, (BasicBlock*)currentBasicBlock);
 #else
@@ -1393,7 +1393,7 @@
         {
             Type * srcType=irManager.getTypeFromTag(Type::Single);
             Opnd * srcOpnd1=(Opnd*)convert(src1, srcType);
-#ifdef _EM64T_
+#ifdef HYX86_64
             Opnd * baseOpnd = irManager.newOpnd(typeManager.getUnmanagedPtrType(srcType));
             Opnd * srcOpnd2=src2?(Opnd*)convert(src2, srcType):irManager.newFPConstantMemOpnd((float)0.0, baseOpnd, (BasicBlock*)currentBasicBlock);
 #else
@@ -1442,7 +1442,7 @@
 
 Opnd*
 InstCodeSelector::heapBaseOpnd(Type* type, POINTER_SIZE_INT heapBase) {
-#ifndef _EM64T_
+#ifndef HYX86_64
     assert(0); // not supposed to be used on ia32
 #endif
     Opnd* heapBaseOpnd = NULL;
@@ -1495,7 +1495,7 @@
 
 void InstCodeSelector::genSwitchDispatch(U_32 numTargets, Opnd *switchSrc)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     Opnd * opnd = irManager.newOpnd(typeManager.getUInt64Type());
     copyOpnd(opnd, switchSrc);
     appendInsts(irManager.newSwitchInst(numTargets, opnd));
@@ -1524,7 +1524,7 @@
 
 void InstCodeSelector::throwSystemException(CompilationInterface::SystemExceptionId id) 
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     bool lazy = false;
 #else
     bool lazy = true;
@@ -1612,7 +1612,7 @@
 
 CG_OpndHandle*    InstCodeSelector::ldc_i8(int64 val) 
 { 
-#ifndef _EM64T_ 
+#ifndef HYX86_64 
     return irManager.newImmOpnd(typeManager.getInt64Type(), val);
 #else
     Opnd * tmp = irManager.newOpnd(typeManager.getInt64Type());
@@ -1626,7 +1626,7 @@
 
 CG_OpndHandle* InstCodeSelector::getVTableAddr(Type *       dstType, ObjectType * base) 
 {
-#ifndef _EM64T_
+#ifndef HYX86_64
     return irManager.newImmOpnd(dstType, Opnd::RuntimeInfo::Kind_VTableConstantAddr, base);
 #else
     Opnd * acc = irManager.newOpnd(dstType);
@@ -1653,7 +1653,7 @@
 
 CG_OpndHandle* InstCodeSelector::ldc_s(float val) 
 {
-#ifndef _EM64T_
+#ifndef HYX86_64
     return irManager.newFPConstantMemOpnd(val);
 #else
     Opnd * baseOpnd = irManager.newOpnd(typeManager.getUnmanagedPtrType(typeManager.getSingleType()));
@@ -1668,7 +1668,7 @@
 
 CG_OpndHandle*    InstCodeSelector::ldc_d(double val) 
 {
-#ifndef _EM64T_
+#ifndef HYX86_64
     return irManager.newFPConstantMemOpnd(val);
 #else
     Opnd * baseOpnd = irManager.newOpnd(typeManager.getUnmanagedPtrType(typeManager.getDoubleType()));
@@ -1929,7 +1929,7 @@
     assert(offsetOpnd->getType()->isInteger());
     assert(fieldRefType->isManagedPtr());
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     return simpleOp_I8(Mnemonic_ADD, fieldRefType, (Opnd*)base, offsetOpnd);
 #else
     return simpleOp_I4(Mnemonic_ADD, fieldRefType, (Opnd*)base, offsetOpnd);
@@ -1953,7 +1953,7 @@
                                                 FieldDesc *    fieldDesc) 
 {
     Opnd * offsetOpnd=(Opnd*)ldFieldOffset(fieldDesc);
-#ifdef _EM64T_
+#ifdef HYX86_64
     return simpleOp_I8(Mnemonic_ADD, fieldRefType, (Opnd*)base, offsetOpnd);
 #else
     return simpleOp_I4(Mnemonic_ADD, fieldRefType, (Opnd*)base, offsetOpnd);
@@ -1965,7 +1965,7 @@
 
 CG_OpndHandle*    InstCodeSelector::ldStaticAddr(Type* fieldRefType, FieldDesc *fieldDesc) 
 {
-#ifndef _EM64T_
+#ifndef HYX86_64
     Opnd * addr=irManager.newImmOpnd(fieldRefType, Opnd::RuntimeInfo::Kind_StaticFieldAddress, fieldDesc);
 #else
     Opnd* immOp = irManager.newImmOpnd(fieldRefType, Opnd::RuntimeInfo::Kind_StaticFieldAddress, fieldDesc);
@@ -1982,7 +1982,7 @@
 {
     ArrayType * arrayType=((Opnd*)array)->getType()->asArrayType();
     Type * elemType=arrayType->getElementType();
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (elemType->isReference()
         && Type::isCompressedReference(elemType->tag, compilationInterface) 
         && !elemType->isCompressedReference()) {
@@ -2011,7 +2011,7 @@
     Type * elemType=arrayType->getElementType();
     Type * dstType=irManager.getManagedPtrType(elemType);
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     Type * indexType = typeManager.getInt64Type();
     Type * offType = typeManager.getInt64Type();
 #else
@@ -2068,7 +2068,7 @@
     U_32 elemSize=getByteSize(irManager.getTypeSize(elemType));
 
     Type * indexType = 
-#ifdef _EM64T_
+#ifdef HYX86_64
         typeManager.getInt64Type();
 #else
         typeManager.getInt32Type();
@@ -2116,7 +2116,7 @@
                                                 Opnd * baseTau,
                                                 Opnd * offsetTau) 
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     if(irManager.refsAreCompressed() && memType > Type::Float && memType!=Type::UnmanagedPtr) {
         Opnd * opnd = irManager.newMemOpndAutoKind(typeManager.getInt32Type(), addr);
         Opnd * dst = irManager.newOpnd(typeManager.getInt64Type());
@@ -2148,7 +2148,7 @@
                                       Opnd * baseTau,
                                       Opnd * offsetAndTypeTau) 
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     // unmanaged pointers are never being compressed
     // Actually, there is only one possible case caused by magics:
     // unmanaged pointer to Int8
@@ -2397,7 +2397,7 @@
     if (codeSelector.getFlags().slowLdString || dstType->isSystemClass() ||
         *((POINTER_SIZE_INT *) compilationInterface.getStringInternAddr(enclosingMethod, refToken)) == 0) {
         NamedType * parentType=enclosingMethod->getParentType();
-    #ifdef _EM64T_
+    #ifdef HYX86_64
         Opnd * tp = irManager.getRegOpnd(RegName_RDI);
         appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, tp,irManager.newImmOpnd(getRuntimeIdType(), Opnd::RuntimeInfo::Kind_TypeRuntimeId, parentType)));
         Opnd * st = irManager.getRegOpnd(RegName_RSI);
@@ -2440,7 +2440,7 @@
                                                  ptr, NULL, NULL, NULL); 
             retOpnd = simpleOp_I8(Mnemonic_ADD, memOpnd->getType(), memOpnd, base);
         } else {
-#ifdef _EM64T_ // in uncompressed mode the ptr can be greater than MAX_INT32 so it can not be an immediate
+#ifdef HYX86_64 // in uncompressed mode the ptr can be greater than MAX_INT32 so it can not be an immediate
             Opnd * tmp = irManager.newImmOpnd(irManager.getTypeFromTag(Type::UInt64),
                                               Opnd::RuntimeInfo::Kind_StringAddress,
                                               enclosingMethod, (void*)(POINTER_SIZE_INT)refToken);
@@ -2558,7 +2558,7 @@
                                                   MethodDesc*      methodDesc,
                                                   CG_OpndHandle *  tauVtableHasDesc) 
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     Opnd * offsetOpnd=irManager.newImmOpnd(typeManager.getIntPtrType(), Opnd::RuntimeInfo::Kind_MethodVtableSlotOffset, methodDesc);
     Opnd * acc = irManager.newOpnd(dstType);
     copyOpnd(acc, (Opnd*)vtableAddr);
@@ -2576,7 +2576,7 @@
                                                      CG_OpndHandle* base,
                                                      CG_OpndHandle *tauBaseNonNull) 
 {
-#ifndef _EM64T_
+#ifndef HYX86_64
     Opnd * vtableAddr=irManager.newOpnd(dstType);
     Opnd * sourceVTableAddr=irManager.newMemOpnd(dstType, (Opnd*)base, 0, 0, 
             irManager.newImmOpnd(typeManager.getInt32Type(), Opnd::RuntimeInfo::Kind_VTableAddrOffset)
@@ -2812,7 +2812,7 @@
         Opnd** opnds = (Opnd**)args;
 
         //deal with constraints       
-#ifdef _EM64T_
+#ifdef HYX86_64
         Type* opnd1Type = opnds[1]->getType();
         assert(irManager.getTypeSize(opnd1Type)==OpndSize_32 || irManager.getTypeSize(opnd1Type)==OpndSize_64);
         assert(irManager.getTypeSize(opnds[1]->getType())==irManager.getTypeSize(opnds[2]->getType()));
@@ -3215,7 +3215,7 @@
                                                  CG_OpndHandle* obj,
                                                  CG_OpndHandle* tauCheckedNull) 
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     Opnd * dst=irManager.newOpnd(typeManager.getInt64Type());
 #else
     Opnd * dst=irManager.newOpnd(typeManager.getInt32Type());
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.h
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.h
index e1196ee..fca3ead 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InstCodeSelector.h
@@ -18,8 +18,8 @@
  * @author Intel, Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_INST_SELECTOR_H
-#define _IA32_INST_SELECTOR_H
+#ifndef HYX86INST_SELECTOR_H
+#define HYX86INST_SELECTOR_H
 
 #include "CodeGenIntfc.h"
 #include "Ia32CodeSelector.h"
@@ -454,4 +454,4 @@
 
 }}; // namespace Ia32
 
-#endif // _IA32_INST_SELECTOR_h
+#endif // HYX86INST_SELECTOR_h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalProfiler.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalProfiler.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalProfiler.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalProfiler.cpp
index dce0647..8ed007a 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalProfiler.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalProfiler.cpp
@@ -651,7 +651,7 @@
             ms->bbStats[node->getId()].bbExecCount= new(mm) int64[1];
             *(ms->bbStats[node->getId()].bbExecCount)   = 0;
             node->prependInst(irManager->newInst(Mnemonic_POPFD));
-#ifndef _EM64T_
+#ifndef HYX86_64
             node->prependInst(irManager->newInst(Mnemonic_ADC, irManager->newMemOpnd(irManager->getTypeFromTag(Type::Int32), MemOpndKind_Heap, NULL, int((U_8*)(ms->bbStats[node->getId()].bbExecCount) + 4)), irManager->newImmOpnd(irManager->getTypeFromTag(Type::Int32),0)));
 
             node->prependInst(irManager->newInst(Mnemonic_ADD, irManager->newMemOpnd(irManager->getTypeFromTag(Type::Int32), MemOpndKind_Heap, NULL, int(ms->bbStats[node->getId()].bbExecCount)), irManager->newImmOpnd(irManager->getTypeFromTag(Type::Int32),1)));
@@ -659,7 +659,7 @@
             node->prependInst(irManager->newInst(Mnemonic_PUSHFD));
         }
     }
-#ifndef _EM64T_
+#ifndef HYX86_64
     ((BasicBlock *)irManager->getFlowGraph()->getEntryNode())->prependInst(irManager->newInst(Mnemonic_ADD, irManager->newMemOpnd(irManager->getTypeFromTag(Type::Int32), MemOpndKind_Heap, NULL, int(ms->bbStats[-1].bbExecCount)), irManager->newImmOpnd(irManager->getTypeFromTag(Type::Int32),1)));
 #endif
 
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.cpp
index abb252b..79de644 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.cpp
@@ -52,7 +52,7 @@
 {
 
     JitFrameContext context;
-#ifdef _EM64T_
+#ifdef HYX86_64
     context.rsp=(POINTER_SIZE_INT)(&methodName+sizeof(POINTER_SIZE_INT)); // must point to the beginning of incoming stack args
 #else
     context.esp=(POINTER_SIZE_INT)(&methodName+sizeof(POINTER_SIZE_INT)); // must point to the beginning of incoming stack args
@@ -72,7 +72,7 @@
         U_8 arg[4*sizeof(U_32)]; 
         for (U_32 j=0; j<info.slotCount; j++){
             if (!info.isReg){
-#ifdef _EM64T_
+#ifdef HYX86_64
                 *(POINTER_SIZE_INT*)(arg+cb)=((POINTER_SIZE_INT*)context.rsp)[info.slots[j]];
 #else
                 *(U_32*)(arg+cb)=((U_32*)context.esp)[info.slots[j]];
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.h
similarity index 95%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.h
index c412b40..8730600 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32InternalTrace.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_INTERNAL_TRACE_H_
-#define _IA32_INTERNAL_TRACE_H_
+#ifndef HYX86INTERNAL_TRACE_H_
+#define HYX86INTERNAL_TRACE_H_
 
 #include "Ia32IRManager.h"
 namespace Jitrino
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32LightJNI.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32LightJNI.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32PeepHole.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32PeepHole.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.cpp
index d01af35..acfaac0 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.cpp
@@ -1413,7 +1413,7 @@
         U_8 arg[4*sizeof(U_32)]; 
         for (U_32 j=0; j<info.slotCount; j++){
             if (!info.isReg){
-#ifdef _EM64T_
+#ifdef HYX86_64
                 *(POINTER_SIZE_INT*)(arg+cb)=((POINTER_SIZE_INT*)context->rsp)[info.slots[j]];
 #else
                 *(U_32*)(arg+cb)=((U_32*)context->esp)[info.slots[j]];
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.h
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.h
index 5f4597f..e1d301f 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Printer.h
@@ -18,8 +18,8 @@
  * @author Vyacheslav P. Shakin
  */
 
-#ifndef _IA32_PRINTER_H_
-#define _IA32_PRINTER_H_
+#ifndef HYX86PRINTER_H_
+#define HYX86PRINTER_H_
 
 #include "open/types.h"
 #include "Stl.h"
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ProfileUtils.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ProfileUtils.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32ProfileUtils.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32ProfileUtils.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RCE.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RCE.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RCE.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RCE.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc0.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc0.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc0.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc0.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc2.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc2.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc2.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc2.cpp
index 487c32c..79ad5a7 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc2.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc2.cpp
@@ -337,7 +337,7 @@
     assert(parameters);
     if (strcmp(parameters, "ALL_GP") == 0)
 
-#ifdef _EM64T_
+#ifdef HYX86_64
         constrs = Constraint(RegName_R8)
                  |Constraint(RegName_RAX)
                  |Constraint(RegName_RDX)
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc3.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc3.cpp
index a68a0ef..2a17449 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAlloc3.cpp
@@ -375,7 +375,7 @@
 {
     if (params == 0 || strcmp(params, "ALL") == 0)
     {
-#ifdef _EM64T_
+#ifdef HYX86_64
         push_back(Constraint(RegName_RAX)
                  |Constraint(RegName_RCX)
                  |Constraint(RegName_RDX)
@@ -1234,7 +1234,7 @@
 }
 
 RegAlloc3::RegMask RegAlloc3::occupiedReg (OpndSize tgtSize, OpndSize adjSize, RegAlloc3::RegMask adjMask) {
-#if !defined(_EM64T_)    
+#if !defined(HYX86_64)    
     if (!((tgtSize != adjSize) && ((tgtSize == OpndSize_8) || (adjSize == OpndSize_8))))
 #endif
         return adjMask;
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAllocCheck.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAllocCheck.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAllocCheck.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAllocCheck.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAllocCheck.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAllocCheck.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RegAllocCheck.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32RegAllocCheck.h
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32SpillGen.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32SpillGen.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32SpillGen.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32SpillGen.cpp
index 65da3f6..5f88b7e 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32SpillGen.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32SpillGen.cpp
@@ -358,7 +358,7 @@
     if (params == 0 || strcmp(params, "ALL") == 0)
     {
 
-#ifdef _EM64T_
+#ifdef HYX86_64
         push_back(Constraint(RegName_R8)
                  |Constraint(RegName_RAX)
                  |Constraint(RegName_RCX)
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.cpp
index 8869ce4..46ed3b9 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.cpp
@@ -21,7 +21,7 @@
 #include "Ia32IRManager.h"
 #include "Stl.h"
 #include "Ia32StackInfo.h"
-#include "Ia32RuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 #include "Ia32InternalTrace.h"
 #include <math.h>
 
@@ -208,7 +208,7 @@
    
 
     POINTER_SIZE_INT offset_step = sizeof(POINTER_SIZE_INT);
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (itraceMethodExitString!=NULL){
         Log::cat_rt()->out()<<"__UNWIND__:"
             <<(itraceMethodExitString!=(const char*)1?itraceMethodExitString:"")
@@ -301,7 +301,7 @@
         //return register offset for previous stack frame. 
         //MUST be called before unwind()
         switch(reg) {
-#ifdef _EM64T_
+#ifdef HYX86_64
             case RegName_R15:
                 return context->p_r15;
             case RegName_R14:
@@ -343,7 +343,7 @@
 
 void StackInfo::fixHandlerContext(JitFrameContext* context)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     if (itraceMethodExitString!=NULL){
         Log::cat_rt()->out()<<"__CATCH_HANDLER__:"
             <<(itraceMethodExitString!=(const char*)1?itraceMethodExitString:"")
@@ -366,7 +366,7 @@
 {
     MethodDesc& md = irm.getMethodDesc();
     if (!md.isStatic()) {
-#ifdef _EM64T_
+#ifdef HYX86_64
         if ((md.isSynchronized() || md.isParentClassIsLikelyExceptionType())) {
             EntryPointPseudoInst * entryPointInst = irm.getEntryPointInst();
             offsetOfThis = (U_32)entryPointInst->thisOpnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement)->getImmValue();
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.h
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.h
index 677b30e..1c490a4 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackInfo.h
@@ -18,8 +18,8 @@
  * @author Intel, Nikolay A. Sidelnikov
  */
 
-#ifndef _IA32_STACK_INFO_H_
-#define _IA32_STACK_INFO_H_
+#ifndef HYX86STACK_INFO_H_
+#define HYX86STACK_INFO_H_
 
 #include "CodeGenIntfc.h"
 #include "MemoryManager.h"
@@ -214,4 +214,4 @@
 };
 
 }}//namespace
-#endif /* _IA32_STACK_INFO_H_ */
+#endif /* HYX86STACK_INFO_H_ */
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackLayout.cpp
similarity index 99%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackLayout.cpp
index e11ca0b..628ca0f 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32StackLayout.cpp
@@ -209,7 +209,7 @@
 #define MAX_STACK_FOR_SOE_HANDLERS 0x2000
 
 static void insertSOECheck(IRManager& irm, U_32 maxStackUsedByMethod) {
-#ifdef _EM64T_
+#ifdef HYX86_64
     //SOE checking is not finished on EM64T
     //TODO: work on stack alignment & SOE checkers
     if (true) return; 
@@ -327,7 +327,7 @@
     Inst * lastPush = NULL;
     
     // Push callee-save registers onto stack.
-#ifdef _EM64T_
+#ifdef HYX86_64
     for (U_32 reg = RegName_R15; reg >= RegName_RAX; reg--) {
 #else
     for (U_32 reg = RegName_EDI; reg >= RegName_EAX; reg--) {
@@ -421,7 +421,7 @@
                 Inst* newIns = irManager->newInst(Mnemonic_ADD, irManager->getRegOpnd(STACK_REG), irManager->newImmOpnd(irManager->getTypeManager().getInt32Type(), localEnd - localBase));
                 newIns->insertBefore(retInst);
             }
-#ifdef _EM64T_
+#ifdef HYX86_64
             for (U_32 reg = RegName_R15; reg >= RegName_RAX ; reg--) {//pop callee-save registers
 #else
             for (U_32 reg = RegName_EDI; reg >= RegName_EAX ; reg--) {//pop callee-save registers
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.cpp
similarity index 98%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.cpp
index 9933e80..1e31528 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.cpp
@@ -48,7 +48,7 @@
 Opnd* createTlsBaseLoadSequence(IRManager& irManager, Node* ctrlNode, Type* tlsBaseType)
 {
     Opnd* tlsBase;
-#if defined(_WIN32) && defined(_EM64T_)
+#if defined(_WIN32) && defined(HYX86_64)
     // Currently do it in a looong way - via the helper, but need to change
     // it to FS:[0x14] - TODO
     tlsBase = createTlsBaseLoadGeneric(irManager, ctrlNode, tlsBaseType);
@@ -104,7 +104,7 @@
 
     int threadOffset = VMInterface::getTLSBaseOffset();
     Opnd* pTib;
-#if defined(_EM64T_)
+#if defined(HYX86_64)
     pTib = irManager.newMemOpnd(tlsBaseType, MemOpndKind_Any, NULL, 0, RegName_FS);
 #else
     pTib = irManager.newMemOpnd(tlsBaseType, MemOpndKind_Any, NULL, 0, RegName_GS);
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.h
similarity index 95%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.h
index c2e43ad..b129175 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32Tls.h
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32Tls.h
@@ -24,8 +24,8 @@
   */
 
 
-#ifndef _IA32_TLS_H_
-#define _IA32_TLS_H_
+#ifndef HYX86TLS_H_
+#define HYX86TLS_H_
 
 #include "Ia32IRManager.h"
 
@@ -54,5 +54,5 @@
 
 }}; // ~Jitrino::Ia32
 
-#endif  // ifdef _IA32_TLS_H_
+#endif  // ifdef HYX86TLS_H_
 
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32WebMaker.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32WebMaker.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32i586InstsExpansion.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32i586InstsExpansion.cpp
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32i586InstsExpansion.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/Ia32i586InstsExpansion.cpp
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/RuntimeInterface_arch.cpp
similarity index 97%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/RuntimeInterface_arch.cpp
index e6e10bb..84823d6 100644
--- a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
+++ b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/RuntimeInterface_arch.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "Ia32IRManager.h"
-#include "Ia32RuntimeInterface.h"
+#include "RuntimeInterface_arch.h"
 #include "Ia32StackInfo.h"
 #include "Ia32GCMap.h"
 #include "Ia32BCMap.h"
@@ -30,7 +30,7 @@
 
 void RuntimeInterface::unwindStack(MethodDesc* methodDesc, JitFrameContext* context, bool isFirst) {
     StackInfo stackInfo;
-#ifdef _EM64T_
+#ifdef HYX86_64
     stackInfo.read(methodDesc, *context->p_rip, isFirst);
 #else
     stackInfo.read(methodDesc, *context->p_eip, isFirst);
@@ -39,7 +39,7 @@
 }
 
 bool RuntimeInterface::isSOEArea(MethodDesc* methodDesc, const ::JitFrameContext* context, bool isFirst) {
-#ifdef _EM64T_
+#ifdef HYX86_64
     POINTER_SIZE_INT eip = *context->p_rip;
 #else
     POINTER_SIZE_INT eip = *context->p_eip;
@@ -60,7 +60,7 @@
     }
     assert(context);
     StackInfo stackInfo;
-#ifdef _EM64T_
+#ifdef HYX86_64
     stackInfo.read(methodDesc, *context->p_rip, isFirst);
     assert(isFirst || (POINTER_SIZE_INT)context->p_rip+8 == context->rsp);
     return (void *)(context->rsp + stackInfo.getStackDepth() + (int)stackInfo.getOffsetOfThis());
@@ -75,7 +75,7 @@
 void  RuntimeInterface::fixHandlerContext(MethodDesc* methodDesc, JitFrameContext* context, bool isFirst)
 {
     StackInfo stackInfo;
-#ifdef _EM64T_
+#ifdef HYX86_64
     stackInfo.read(methodDesc, *context->p_rip, isFirst);
 #else
     stackInfo.read(methodDesc, *context->p_eip, isFirst);
diff --git a/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h b/drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/RuntimeInterface_arch.h
similarity index 100%
rename from drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
rename to drlvm/modules/vm/src/main/native/jitrino/shared/x86/codegenerator/RuntimeInterface_arch.h
diff --git a/drlvm/modules/vm/src/main/native/jitrino/unix/exports.txt b/drlvm/modules/vm/src/main/native/jitrino/unix/exports.txt
new file mode 100644
index 0000000..d137814
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/jitrino/unix/exports.txt
@@ -0,0 +1,37 @@
+JIT_call_returns_a_reference
+JIT_can_enumerate
+JIT_compile_method
+JIT_compile_method_with_params
+JIT_deinit
+JIT_enable_profiling
+JIT_extended_class_callback
+JIT_fix_handler_context
+JIT_gc_end
+JIT_gc_object_died
+JIT_gc_start
+JIT_gen_method_info
+JIT_get_address_of_this
+JIT_get_address_of_var
+JIT_get_break_point_offset
+JIT_get_breakpoints
+JIT_get_exe_capabilities
+JIT_get_inline_depth
+JIT_get_inlined_bc
+JIT_get_inlined_method
+JIT_get_root_set_for_thread_dump
+JIT_get_root_set_from_stack_frame
+JIT_init
+JIT_init_with_data
+JIT_is_soe_area
+JIT_next_command_line_argument
+JIT_num_breakpoints
+JIT_overridden_method_callback
+JIT_profile_notification_callback
+JIT_recompiled_method_callback
+JIT_set_profile_access_interface
+JIT_supports_compressed_references
+JIT_unwind_stack_frame
+get_bc_location_for_native
+get_local_var
+get_native_location_for_bc
+set_local_var
diff --git a/drlvm/modules/vm/src/main/native/jitrino/unix/makefile b/drlvm/modules/vm/src/main/native/jitrino/unix/makefile
new file mode 100644
index 0000000..a3ba242
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/jitrino/unix/makefile
@@ -0,0 +1,121 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'jitrino'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/jitrino/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DPROJECT_JITRINO
+
+ifeq ($(HY_CFG),debug)
+DEFINES += -DJIT_LOGS -DJIT_STATS
+endif
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated -fmessage-length=0 -Wall -Werror -Wno-uninitialized
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)vmcore/include \
+  -I$(VM_HOME)port/include \
+  -I$(SHAREDSUB)main -I$(SHAREDSUB)shared -I$(SHAREDSUB)vm \
+  -I$(SHAREDSUB)codegenerator -I$(SHAREDSUB)$(HY_ARCH_FAMILY)/codegenerator \
+  -I$(SHAREDSUB)optimizer -I$(SHAREDSUB)dynopt \
+  -I$(SHAREDSUB)translator -I$(SHAREDSUB)translator/java \
+  $(INCLUDES)
+
+BUILDFILES := \
+  codegenerator/RuntimeInterface.o \
+  codegenerator/Ia32APIMagics.o codegenerator/Ia32BBPolling.o \
+  codegenerator/Ia32BranchTrans.o codegenerator/Ia32CFG.o \
+  codegenerator/Ia32CallingConvention.o codegenerator/Ia32CgUtils.o \
+  codegenerator/Ia32CodeEmitter.o codegenerator/CodeGenerator_arch.o \
+  codegenerator/Ia32CodeLayout.o codegenerator/Ia32CodeLayoutBottomUp.o \
+  codegenerator/Ia32CodeLayoutTopDown.o codegenerator/Ia32CodeSelector.o \
+  codegenerator/Ia32ComplexAddrFormLoader.o codegenerator/Ia32Constraint.o \
+  codegenerator/Ia32ConstraintsResolver.o codegenerator/Ia32CopyExpansion.o \
+  codegenerator/Ia32DCE.o codegenerator/Ia32EarlyPropagation.o \
+  codegenerator/Ia32Encoder.o codegenerator/Ia32FastArrayFilling.o \
+  codegenerator/Ia32GCMap.o codegenerator/Ia32GCSafePoints.o \
+  codegenerator/Ia32GlobalPropagation.o codegenerator/Ia32I8Lowerer.o \
+  codegenerator/Ia32IRConstants.o codegenerator/Ia32IRManager.o \
+  codegenerator/Ia32Inst.o codegenerator/Ia32InstCodeSelector.o \
+  codegenerator/Ia32InternalProfiler.o codegenerator/Ia32InternalTrace.o \
+  codegenerator/Ia32LightJNI.o codegenerator/Ia32PeepHole.o \
+  codegenerator/Ia32Printer.o codegenerator/Ia32ProfileUtils.o \
+  codegenerator/Ia32RCE.o codegenerator/Ia32RegAlloc0.o \
+  codegenerator/Ia32RegAlloc2.o codegenerator/Ia32RegAlloc3.o \
+  codegenerator/Ia32RegAllocCheck.o codegenerator/RuntimeInterface_arch.o \
+  codegenerator/Ia32SpillGen.o codegenerator/Ia32StackInfo.o \
+  codegenerator/Ia32StackLayout.o codegenerator/Ia32Tls.o \
+  codegenerator/Ia32WebMaker.o codegenerator/Ia32i586InstsExpansion.o \
+  dynopt/EdgeProfiler.o dynopt/StaticProfiler.o dynopt/ValueProfiler.o \
+  main/CompilationContext.o main/JITInstanceContext.o main/Jitrino.o \
+  main/Log.o main/PMF.o \
+  optimizer/CSEHash.o optimizer/CodeGenerator.o optimizer/CodeSelectors.o \
+  optimizer/FastArrayFilling.o optimizer/FlowGraph.o optimizer/HLOAPIMagics.o \
+  optimizer/IRBuilder.o optimizer/Inst.o optimizer/Loop.o \
+  optimizer/LoopUtils.o optimizer/Opcode.o optimizer/Opnd.o \
+  optimizer/abcd/abcdbounds.o optimizer/abcd/classic_abcd.o \
+  optimizer/abcd/classic_abcd_solver.o optimizer/abcd/insertpi.o \
+  optimizer/aliasanalyzer.o optimizer/codelowerer.o \
+  optimizer/constantfolder.o optimizer/dabce.o \
+  optimizer/deadcodeeliminator.o optimizer/devirtualizer.o \
+  optimizer/escanalyzer.o optimizer/escapeanalyzer.o \
+  optimizer/gcmanagedpointeranalyzer.o optimizer/globalcodemotion.o \
+  optimizer/globalopndanalyzer.o optimizer/hashvaluenumberer.o \
+  optimizer/helper_inliner.o optimizer/inliner.o \
+  optimizer/lazyexceptionopt.o optimizer/loop_unroll.o optimizer/memoryopt.o \
+  optimizer/multiplybyconstant.o optimizer/optimizer.o optimizer/optpass.o \
+  optimizer/osr.o optimizer/pidgenerator.o optimizer/reassociate.o \
+  optimizer/simplifier.o optimizer/simplifytaus.o optimizer/ssa/SSA.o \
+  optimizer/syncopt.o optimizer/tailduplicator.o optimizer/throwopt.o \
+  optimizer/walkers.o \
+  shared/Algorithms.o shared/Arena.o shared/BitSet.o shared/ControlFlowGraph.o \
+  shared/CountWriters.o shared/Dominator.o shared/FixFileName.o \
+  shared/Interval.o shared/LoopTree.o shared/MemoryAttribute.o \
+  shared/MemoryManager.o shared/PrintDotFile.o shared/Type.o shared/VMMagic.o \
+  shared/XTimer.o shared/methodtable.o shared/mkernel.o \
+  translator/TranslatorIntfc.o translator/java/JavaByteCodeParser.o \
+  translator/java/JavaByteCodeTranslator.o \
+  translator/java/JavaFlowGraphBuilder.o \
+  translator/java/JavaLabelPrepass.o translator/java/JavaTranslator.o \
+  vm/EMInterface.o vm/JITInterface.o vm/VMInterface.o
+
+ifneq ($(HY_ARCH),ia64)
+BUILDFILES += \
+  jet/arith_rt.o jet/bcproc.o jet/cg.o jet/cg_arith.o jet/cg_br.o \
+  jet/cg_dbg.o jet/cg_fld_arr.o jet/cg_ia32.o jet/cg_instr.o jet/cg_meth.o \
+  jet/cg_obj.o jet/cg_regs.o jet/cg_stk.o jet/compiler.o jet/csig.o \
+  jet/enc.o jet/enc_ia32.o jet/jdefs.o jet/jet.o jet/jframe.o jet/magics.o \
+  jet/mib.o jet/rt.o jet/rt_ia32.o jet/sconsts.o jet/stats.o jet/trace.o
+endif
+
+DLLNAME = $(DLLPATH)default/libjitrino$(HY_SHLIB_SUFFIX)
+EXPNAME = JITRINO_0.1
+
+#OSLIBS += -lm
+MDLLIBFILES += $(LIBPATH)libapr-1.a $(LIBPATH)libport.a
+
+include $(HY_HDK)/build/make/rules.mk
+
+$(HY_BIN)%.o: $(SHAREDSUB)$(HY_ARCH_FAMILY)/%.cpp
+	@mkdir -p $(@D)
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
diff --git a/drlvm/vm/port/src/file_io/filepath_generic.c b/drlvm/modules/vm/src/main/native/port/shared/file_io/filepath_generic.c
similarity index 100%
rename from drlvm/vm/port/src/file_io/filepath_generic.c
rename to drlvm/modules/vm/src/main/native/port/shared/file_io/filepath_generic.c
diff --git a/drlvm/vm/port/src/logger/logger.cpp b/drlvm/modules/vm/src/main/native/port/shared/logger/logger.cpp
similarity index 100%
rename from drlvm/vm/port/src/logger/logger.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/logger/logger.cpp
diff --git a/drlvm/vm/port/src/logger/logparams.cpp b/drlvm/modules/vm/src/main/native/port/shared/logger/logparams.cpp
similarity index 100%
rename from drlvm/vm/port/src/logger/logparams.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/logger/logparams.cpp
diff --git a/drlvm/vm/port/src/malloc/port_malloc.cpp b/drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc.cpp
similarity index 100%
rename from drlvm/vm/port/src/malloc/port_malloc.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc.cpp
diff --git a/drlvm/vm/port/src/malloc/port_malloc_registrar.cpp b/drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc_registrar.cpp
similarity index 100%
rename from drlvm/vm/port/src/malloc/port_malloc_registrar.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc_registrar.cpp
diff --git a/drlvm/vm/port/src/malloc/port_malloc_registrar.h b/drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc_registrar.h
similarity index 100%
rename from drlvm/vm/port/src/malloc/port_malloc_registrar.h
rename to drlvm/modules/vm/src/main/native/port/shared/malloc/port_malloc_registrar.h
diff --git a/drlvm/vm/port/src/time/misc_platform_natives.cpp b/drlvm/modules/vm/src/main/native/port/shared/time/misc_platform_natives.cpp
similarity index 100%
rename from drlvm/vm/port/src/time/misc_platform_natives.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/time/misc_platform_natives.cpp
diff --git a/drlvm/vm/port/src/tl/memory_pool.cpp b/drlvm/modules/vm/src/main/native/port/shared/tl/memory_pool.cpp
similarity index 100%
rename from drlvm/vm/port/src/tl/memory_pool.cpp
rename to drlvm/modules/vm/src/main/native/port/shared/tl/memory_pool.cpp
diff --git a/drlvm/vm/port/src/atomic/linux/port_atomic.c b/drlvm/modules/vm/src/main/native/port/unix/atomic/port_atomic.c
similarity index 100%
rename from drlvm/vm/port/src/atomic/linux/port_atomic.c
rename to drlvm/modules/vm/src/main/native/port/unix/atomic/port_atomic.c
diff --git a/drlvm/vm/port/src/disasm/linux/disasm.c b/drlvm/modules/vm/src/main/native/port/unix/disasm/disasm.c
similarity index 97%
rename from drlvm/vm/port/src/disasm/linux/disasm.c
rename to drlvm/modules/vm/src/main/native/port/unix/disasm/disasm.c
index 1f99650..afd566e 100644
--- a/drlvm/vm/port/src/disasm/linux/disasm.c
+++ b/drlvm/modules/vm/src/main/native/port/unix/disasm/disasm.c
@@ -30,7 +30,7 @@
 #include "port_disasm.h"
 
 // this is mostly imperical data 
-#if defined(_IA32_)
+#if defined(HYX86)
     #define ADDR_SIZE       16
     #define MNEMONIC_SIZE   15
     #define BYTES_PER_LINE  2
@@ -60,7 +60,7 @@
     apr_size_t num_bytes_used;
 };
 
-#if defined(_IA32_)
+#if defined(HYX86)
 
 /*    General printing routines    */
 
@@ -148,12 +148,12 @@
 #endif
     }
 }
-#endif // defined(_IA32_)
+#endif // defined(HYX86)
 
 /*    Public Interface    */
 
 APR_DECLARE(apr_status_t) port_disasm_initialize() {
-#if defined(_IA32_)
+#if defined(HYX86)
     return APR_SUCCESS;
 #else
     return APR_ENOTIMPL;
@@ -162,7 +162,7 @@
 
 APR_DECLARE(apr_status_t) port_disassembler_create(port_disassembler_t ** disassembler,
                                                    apr_pool_t * pool) {
-#if defined(_IA32_)
+#if defined(HYX86)
     apr_status_t status;
     port_disasm_info_t info = {1, 0, 1};
     
@@ -193,7 +193,7 @@
 APR_DECLARE(apr_status_t) port_disasm_set_info(port_disassembler_t * disassembler,
                                                const port_disasm_info_t new_info,
                                                port_disasm_info_t * old_info) {
-#if defined(_IA32_)
+#if defined(HYX86)
     if (old_info != NULL) {
         *old_info = disassembler->port_info;
     }
@@ -218,7 +218,7 @@
                                       const char * code, 
                                       unsigned int len,
                                       char ** disasm_code) {
-#if defined(_IA32_)    
+#if defined(HYX86)    
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         *disasm_code = NULL;
@@ -255,7 +255,7 @@
                                               const char * code,
                                               unsigned int len,
                                               apr_file_t * thefile) {
-#if defined(_IA32_)
+#if defined(HYX86)
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         return APR_SUCCESS;
diff --git a/drlvm/vm/port/src/file_io/linux/canonical.c b/drlvm/modules/vm/src/main/native/port/unix/file_io/canonical.c
similarity index 100%
rename from drlvm/vm/port/src/file_io/linux/canonical.c
rename to drlvm/modules/vm/src/main/native/port/unix/file_io/canonical.c
diff --git a/drlvm/vm/port/src/file_io/linux/filepath.c b/drlvm/modules/vm/src/main/native/port/unix/file_io/filepath.c
similarity index 100%
rename from drlvm/vm/port/src/file_io/linux/filepath.c
rename to drlvm/modules/vm/src/main/native/port/unix/file_io/filepath.c
diff --git a/drlvm/modules/vm/src/main/native/port/unix/makefile b/drlvm/modules/vm/src/main/native/port/unix/makefile
new file mode 100644
index 0000000..fe9e303
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/port/unix/makefile
@@ -0,0 +1,48 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'port'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/port/native/port/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DAPR_DECLARE_EXPORT -DBUILDING_VM
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)port/src/thread/include $(INCLUDES)
+
+BUILDFILES := \
+  thread/thread_os.o thread.o thread/port_thread_tls_find.o \
+  misc/timer.o misc/sysencoding.o misc/timezone.o misc/execname.o \
+  misc/user.o misc/dso.o misc/sysinfo.o \
+  file_io/filepath.o file_io/canonical.o \
+  atomic/port_atomic.o disasm/disasm.o vmem/port_vmem.o tl/memory_pool.o \
+  malloc/port_malloc_registrar.o malloc/port_malloc.o \
+  time/misc_platform_natives.o \
+  file_io/filepath_generic.o \
+  logger/logparams.o logger/logger.o
+
+LIBNAME = $(LIBPATH)libport.a
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/port/src/misc/linux/dso.c b/drlvm/modules/vm/src/main/native/port/unix/misc/dso.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/dso.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/dso.c
diff --git a/drlvm/vm/port/src/misc/linux/execname.c b/drlvm/modules/vm/src/main/native/port/unix/misc/execname.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/execname.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/execname.c
diff --git a/drlvm/vm/port/src/misc/linux/sysencoding.c b/drlvm/modules/vm/src/main/native/port/unix/misc/sysencoding.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/sysencoding.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/sysencoding.c
diff --git a/drlvm/vm/port/src/misc/linux/sysinfo.c b/drlvm/modules/vm/src/main/native/port/unix/misc/sysinfo.c
similarity index 98%
rename from drlvm/vm/port/src/misc/linux/sysinfo.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/sysinfo.c
index 0f58956..272e626 100644
--- a/drlvm/vm/port/src/misc/linux/sysinfo.c
+++ b/drlvm/modules/vm/src/main/native/port/unix/misc/sysinfo.c
@@ -50,7 +50,7 @@
 APR_DECLARE(const char *) port_CPU_architecture(void){
 #if defined(_IPF_)
 	return "ia64";
-#elif defined (_EM64T_)
+#elif defined (HYX86_64)
     return "x86_64";
 #else
     return "x86";
diff --git a/drlvm/vm/port/src/misc/linux/timer.c b/drlvm/modules/vm/src/main/native/port/unix/misc/timer.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/timer.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/timer.c
diff --git a/drlvm/vm/port/src/misc/linux/timezone.c b/drlvm/modules/vm/src/main/native/port/unix/misc/timezone.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/timezone.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/timezone.c
diff --git a/drlvm/vm/port/src/misc/linux/user.c b/drlvm/modules/vm/src/main/native/port/unix/misc/user.c
similarity index 100%
rename from drlvm/vm/port/src/misc/linux/user.c
rename to drlvm/modules/vm/src/main/native/port/unix/misc/user.c
diff --git a/drlvm/vm/port/src/thread/linux/port_thread_tls_find.c b/drlvm/modules/vm/src/main/native/port/unix/thread/port_thread_tls_find.c
similarity index 100%
rename from drlvm/vm/port/src/thread/linux/port_thread_tls_find.c
rename to drlvm/modules/vm/src/main/native/port/unix/thread/port_thread_tls_find.c
diff --git a/drlvm/vm/port/src/thread/linux/thread_os.c b/drlvm/modules/vm/src/main/native/port/unix/thread/thread_os.c
similarity index 100%
rename from drlvm/vm/port/src/thread/linux/thread_os.c
rename to drlvm/modules/vm/src/main/native/port/unix/thread/thread_os.c
diff --git a/drlvm/vm/port/src/vmem/linux/port_vmem.c b/drlvm/modules/vm/src/main/native/port/unix/vmem/port_vmem.c
similarity index 100%
rename from drlvm/vm/port/src/vmem/linux/port_vmem.c
rename to drlvm/modules/vm/src/main/native/port/unix/vmem/port_vmem.c
diff --git a/drlvm/vm/port/src/thread/linux/thread_ia32.c b/drlvm/modules/vm/src/main/native/port/unix/x86/thread.c
similarity index 100%
rename from drlvm/vm/port/src/thread/linux/thread_ia32.c
rename to drlvm/modules/vm/src/main/native/port/unix/x86/thread.c
diff --git a/drlvm/vm/port/src/thread/linux/thread_em64t.c b/drlvm/modules/vm/src/main/native/port/unix/x86_64/thread.c
similarity index 100%
rename from drlvm/vm/port/src/thread/linux/thread_em64t.c
rename to drlvm/modules/vm/src/main/native/port/unix/x86_64/thread.c
diff --git a/drlvm/vm/port/src/crash_handler/native_unwind.cpp b/drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/native_unwind.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/native_unwind.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/native_unwind.cpp
diff --git a/drlvm/vm/port/src/crash_handler/port_crash_handler.cpp b/drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/port_crash_handler.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/port_crash_handler.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/port_crash_handler.cpp
diff --git a/drlvm/vm/port/src/crash_handler/stack_dump.cpp b/drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/stack_dump.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/stack_dump.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/shared/crash_handler/stack_dump.cpp
diff --git a/drlvm/vm/port/src/modules/native_modules.c b/drlvm/modules/vm/src/main/native/port_ch/shared/modules/native_modules.c
similarity index 100%
rename from drlvm/vm/port/src/modules/native_modules.c
rename to drlvm/modules/vm/src/main/native/port_ch/shared/modules/native_modules.c
diff --git a/drlvm/vm/port/src/crash_handler/include/native_unwind.h b/drlvm/modules/vm/src/main/native/port_ch/shared/native_unwind.h
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/include/native_unwind.h
rename to drlvm/modules/vm/src/main/native/port_ch/shared/native_unwind.h
diff --git a/drlvm/vm/port/src/signals/port_signals.cpp b/drlvm/modules/vm/src/main/native/port_ch/shared/signals/port_signals.cpp
similarity index 100%
rename from drlvm/vm/port/src/signals/port_signals.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/shared/signals/port_signals.cpp
diff --git a/drlvm/vm/port/src/signals/include/signals_internal.h b/drlvm/modules/vm/src/main/native/port_ch/shared/signals_internal.h
similarity index 100%
rename from drlvm/vm/port/src/signals/include/signals_internal.h
rename to drlvm/modules/vm/src/main/native/port_ch/shared/signals_internal.h
diff --git a/drlvm/vm/port/src/crash_handler/include/stack_dump.h b/drlvm/modules/vm/src/main/native/port_ch/shared/stack_dump.h
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/include/stack_dump.h
rename to drlvm/modules/vm/src/main/native/port_ch/shared/stack_dump.h
diff --git a/drlvm/vm/port/src/crash_handler/linux/gdb_crash_handler.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/gdb_crash_handler.cpp
similarity index 97%
rename from drlvm/vm/port/src/crash_handler/linux/gdb_crash_handler.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/gdb_crash_handler.cpp
index 352ba0b..75c72e4 100644
--- a/drlvm/vm/port/src/crash_handler/linux/gdb_crash_handler.cpp
+++ b/drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/gdb_crash_handler.cpp
@@ -28,7 +28,7 @@
 #include "port_thread.h"
 #include "port_malloc.h"
 
-#include "../linux/include/gdb_crash_handler.h"
+#include "gdb_crash_handler.h"
 
 static char* g_executable = NULL;// Executable file name
 static sem_t g_sem_started;     // Prevent forking debugger more than once
diff --git a/drlvm/vm/port/src/crash_handler/linux/native_unwind_os.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/native_unwind_os.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/linux/native_unwind_os.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/native_unwind_os.cpp
diff --git a/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/stack_dump_os.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/crash_handler/stack_dump_os.cpp
diff --git a/drlvm/modules/vm/src/main/native/port_ch/unix/exports.txt b/drlvm/modules/vm/src/main/native/port_ch/unix/exports.txt
new file mode 100644
index 0000000..23bcdf2
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/port_ch/unix/exports.txt
@@ -0,0 +1,16 @@
+port_init_crash_handler
+port_shutdown_crash_handler
+port_crash_handler_*
+port_set_breakpoint
+port_clear_breakpoint
+port_is_breakpoint_set
+port_read_memory
+port_write_memory
+port_get_all_modules
+port_dump_modules
+port_clear_modules
+port_find_module
+port_init_unwind_context
+port_clean_unwind_context
+port_unwind_frame
+port_init_shared_data
diff --git a/drlvm/vm/port/src/modules/unix/freebsd/native_modules_procmap.c b/drlvm/modules/vm/src/main/native/port_ch/unix/freebsd/modules/native_modules_procmap.c
similarity index 100%
rename from drlvm/vm/port/src/modules/unix/freebsd/native_modules_procmap.c
rename to drlvm/modules/vm/src/main/native/port_ch/unix/freebsd/modules/native_modules_procmap.c
diff --git a/drlvm/vm/port/src/crash_handler/linux/include/gdb_crash_handler.h b/drlvm/modules/vm/src/main/native/port_ch/unix/gdb_crash_handler.h
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/linux/include/gdb_crash_handler.h
rename to drlvm/modules/vm/src/main/native/port_ch/unix/gdb_crash_handler.h
diff --git a/drlvm/vm/port/src/modules/unix/linux/native_modules_procmap.c b/drlvm/modules/vm/src/main/native/port_ch/unix/linux/modules/native_modules_procmap.c
similarity index 100%
rename from drlvm/vm/port/src/modules/unix/linux/native_modules_procmap.c
rename to drlvm/modules/vm/src/main/native/port_ch/unix/linux/modules/native_modules_procmap.c
diff --git a/drlvm/modules/vm/src/main/native/port_ch/unix/makefile b/drlvm/modules/vm/src/main/native/port_ch/unix/makefile
new file mode 100644
index 0000000..cb117ce
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/port_ch/unix/makefile
@@ -0,0 +1,59 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'port_ch'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/port/native/port_ch/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DAPR_DECLARE_EXPORT -DBUILDING_VM
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)port/src/thread/include $(INCLUDES)
+
+BUILDFILES := \
+  crash_handler/gdb_crash_handler.o crash_handler/native_unwind_arch.o \
+  crash_handler/native_unwind.o crash_handler/native_unwind_os.o \
+  crash_handler/port_crash_handler.o crash_handler/reg_state.o \
+  crash_handler/stack_dump.o crash_handler/stack_dump_os.o \
+  memaccess.o memaccess_asm.o \
+  modules/native_modules_procmap.o modules/native_modules.o \
+  modules/native_modules_os.o \
+  signals/port_signals.o signals/signals_common.o signals/signals.o \
+  signals/signals_asm.o \
+  thread/port_thread_tls_os.o
+
+MDLLIBFILES += $(LIBPATH)libport.a $(LIBPATH)libencoder.a
+
+ifeq ($(HY_OS),linux)
+OSLIBS += -lrt
+endif
+
+DLLNAME = $(DLLPATH)default/libch$(HY_SHLIB_SUFFIX)
+EXPNAME = PORT_0.1
+
+AS := $(CXX)
+ASFLAGS := -Wa,--fatal-warnings -c -x assembler-with-cpp -g
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/port/src/memaccess/linux/memaccess.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/memaccess.cpp
similarity index 100%
rename from drlvm/vm/port/src/memaccess/linux/memaccess.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/memaccess.cpp
diff --git a/drlvm/vm/port/src/modules/unix/native_modules_os.c b/drlvm/modules/vm/src/main/native/port_ch/unix/modules/native_modules_os.c
similarity index 100%
rename from drlvm/vm/port/src/modules/unix/native_modules_os.c
rename to drlvm/modules/vm/src/main/native/port_ch/unix/modules/native_modules_os.c
diff --git a/drlvm/vm/port/src/modules/unix/include/port_modules_unix.h b/drlvm/modules/vm/src/main/native/port_ch/unix/port_modules_unix.h
similarity index 100%
rename from drlvm/vm/port/src/modules/unix/include/port_modules_unix.h
rename to drlvm/modules/vm/src/main/native/port_ch/unix/port_modules_unix.h
diff --git a/drlvm/vm/port/src/signals/linux/signals_common.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/signals/signals_common.cpp
similarity index 99%
rename from drlvm/vm/port/src/signals/linux/signals_common.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/signals/signals_common.cpp
index f78ea8b..41b9a9d 100644
--- a/drlvm/vm/port/src/signals/linux/signals_common.cpp
+++ b/drlvm/modules/vm/src/main/native/port_ch/unix/signals/signals_common.cpp
@@ -25,7 +25,7 @@
 #include "port_crash_handler.h"
 #include "port_malloc.h"
 #include "stack_dump.h"
-#include "../linux/include/gdb_crash_handler.h"
+#include "gdb_crash_handler.h"
 #include "signals_internal.h"
 #include "port_thread_internal.h"
 
diff --git a/drlvm/vm/port/src/thread/linux/port_thread_tls_os.c b/drlvm/modules/vm/src/main/native/port_ch/unix/thread/port_thread_tls_os.c
similarity index 98%
rename from drlvm/vm/port/src/thread/linux/port_thread_tls_os.c
rename to drlvm/modules/vm/src/main/native/port_ch/unix/thread/port_thread_tls_os.c
index e980c37..9c7dc06 100644
--- a/drlvm/vm/port/src/thread/linux/port_thread_tls_os.c
+++ b/drlvm/modules/vm/src/main/native/port_ch/unix/thread/port_thread_tls_os.c
@@ -34,11 +34,11 @@
 static port_shared_data_t* g_port_shared_data = NULL;
 static port_shared_data_t g_port_shared_data_struct;
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #define MEM_PROTECT_SIZE 0x400
 #elif defined (_IPF_)
 #define MEM_PROTECT_SIZE 0
-#else /* _IA32_ */
+#else /* HYX86 */
 #define MEM_PROTECT_SIZE 0x100
 #endif
 
diff --git a/drlvm/vm/port/src/crash_handler/ia32/native_unwind_arch.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86/crash_handler/native_unwind_arch.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/ia32/native_unwind_arch.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86/crash_handler/native_unwind_arch.cpp
diff --git a/drlvm/vm/port/src/crash_handler/ia32/reg_state.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86/crash_handler/reg_state.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/ia32/reg_state.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86/crash_handler/reg_state.cpp
diff --git a/drlvm/vm/port/src/memaccess/linux/memaccess_ia32.s b/drlvm/modules/vm/src/main/native/port_ch/unix/x86/memaccess_asm.s
similarity index 100%
rename from drlvm/vm/port/src/memaccess/linux/memaccess_ia32.s
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86/memaccess_asm.s
diff --git a/drlvm/vm/port/src/signals/linux/signals_ia32.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86/signals/signals.cpp
similarity index 100%
rename from drlvm/vm/port/src/signals/linux/signals_ia32.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86/signals/signals.cpp
diff --git a/drlvm/vm/port/src/signals/linux/signals_asm_ia32.s b/drlvm/modules/vm/src/main/native/port_ch/unix/x86/signals/signals_asm.s
similarity index 100%
rename from drlvm/vm/port/src/signals/linux/signals_asm_ia32.s
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86/signals/signals_asm.s
diff --git a/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/crash_handler/native_unwind_arch.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/crash_handler/native_unwind_arch.cpp
diff --git a/drlvm/vm/port/src/crash_handler/em64t/reg_state.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/crash_handler/reg_state.cpp
similarity index 100%
rename from drlvm/vm/port/src/crash_handler/em64t/reg_state.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/crash_handler/reg_state.cpp
diff --git a/drlvm/vm/port/src/memaccess/linux/memaccess_em64t.s b/drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/memaccess_asm.s
similarity index 100%
rename from drlvm/vm/port/src/memaccess/linux/memaccess_em64t.s
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/memaccess_asm.s
diff --git a/drlvm/vm/port/src/signals/linux/signals_em64t.cpp b/drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/signals/signals.cpp
similarity index 100%
rename from drlvm/vm/port/src/signals/linux/signals_em64t.cpp
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/signals/signals.cpp
diff --git a/drlvm/vm/port/src/signals/linux/signals_asm_em64t.s b/drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/signals/signals_asm.s
similarity index 100%
rename from drlvm/vm/port/src/signals/linux/signals_asm_em64t.s
rename to drlvm/modules/vm/src/main/native/port_ch/unix/x86_64/signals/signals_asm.s
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/context_base.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/base/context_base.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/context_base.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/context_base.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/context_base.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/context_base.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/context_base.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/context_base.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/context_x.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/base/context_x.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/context_x.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/context_x.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/context_x.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/context_x.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/context_x.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/context_x.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/instr_props.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/instr_props.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/instr_props.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/instr_props.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/stackmap.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/stackmap.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/stackmap.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/stackmap.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/stackmap_x.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/stackmap_x.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/stackmap_x.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/stackmap_x.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/tpool.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/base/tpool.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/tpool.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/tpool.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/tpool.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/tpool.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/tpool.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/tpool.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/ver.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/base/ver.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/ver.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/ver.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/ver_utils.h b/drlvm/modules/vm/src/main/native/verifier/shared/base/ver_utils.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/ver_utils.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/ver_utils.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/base/vf_resolve.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/base/vf_resolve.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/base/vf_resolve.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/base/vf_resolve.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java5/context_5.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/java5/context_5.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java5/context_5.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/java5/context_5.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java5/context_5.h b/drlvm/modules/vm/src/main/native/verifier/shared/java5/context_5.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java5/context_5.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/java5/context_5.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java5/instr_props_5.h b/drlvm/modules/vm/src/main/native/verifier/shared/java5/instr_props_5.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java5/instr_props_5.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/java5/instr_props_5.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java5/stackmap_5.h b/drlvm/modules/vm/src/main/native/verifier/shared/java5/stackmap_5.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java5/stackmap_5.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/java5/stackmap_5.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java6/context_6.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/java6/context_6.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java6/context_6.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/java6/context_6.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java6/context_6.h b/drlvm/modules/vm/src/main/native/verifier/shared/java6/context_6.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java6/context_6.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/java6/context_6.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/java6/stackmap_6.h b/drlvm/modules/vm/src/main/native/verifier/shared/java6/stackmap_6.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/java6/stackmap_6.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/java6/stackmap_6.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/recompute.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/recompute.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/recompute.h b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/recompute.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/recompute.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/recompute.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/write_attr.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/write_attr.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_class_interface.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_class_interface.h
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_verifier.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_verifier.cpp
diff --git a/drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h b/drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_verifier.h
similarity index 100%
rename from drlvm/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h
rename to drlvm/modules/vm/src/main/native/verifier/shared/x_verifier/x_verifier.h
diff --git a/drlvm/modules/vm/src/main/native/verifier/unix/makefile b/drlvm/modules/vm/src/main/native/verifier/unix/makefile
new file mode 100644
index 0000000..51420c1
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/verifier/unix/makefile
@@ -0,0 +1,47 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'verifier'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/port/native/verifier/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DBUILDING_VM
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)vmcore/include -I$(VM_HOME)include $(INCLUDES)
+
+BUILDFILES := \
+  base/context_base.o base/context_x.o base/tpool.o \
+  base/ver.o base/vf_resolve.o \
+  java5/context_5.o \
+  java6/context_6.o
+
+ifeq ($(HY_CFG),debug)
+BUILDFILES += \
+  x_verifier/recompute.o x_verifier/write_attr.o x_verifier/x_verifier.o
+endif
+
+LIBNAME = $(LIBPATH)libverifier.a
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/vmcore/src/class_support/Assertion_Registry.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Assertion_Registry.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Assertion_Registry.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Assertion_Registry.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/C_Interface.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/C_Interface.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/C_Interface.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/C_Interface.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Class.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Class.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Class.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Class.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Class_File_Loader.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Class_File_Loader.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Class_File_Loader.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Class_File_Loader.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Environment.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Environment.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/class_support/Environment.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Environment.cpp
index 365ec18..4a36217 100644
--- a/drlvm/vm/vmcore/src/class_support/Environment.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Environment.cpp
@@ -57,7 +57,7 @@
 
     hythread_lib_create(&hythread_lib);
 
-#if defined _IPF_ || defined _EM64T_
+#if defined _IPF_ || defined HYX86_64
     compact_fields = true;
     sort_fields = true;
 #else // !_IPF_
diff --git a/drlvm/vm/vmcore/src/class_support/Initialize.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Initialize.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Initialize.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Initialize.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Prepare.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Prepare.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Prepare.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Prepare.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Resolve.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Resolve.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Resolve.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Resolve.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/String_Pool.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/String_Pool.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/String_Pool.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/String_Pool.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/Verifier_stub.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Verifier_stub.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/Verifier_stub.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/Verifier_stub.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/class_impl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/class_impl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/class_impl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/class_impl.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/classloader.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/classloader.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/classloader.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/classloader.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/inline_info.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/inline_info.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/inline_info.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/inline_info.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/java_type.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/java_type.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/java_type.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/java_type.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/manifest.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/manifest.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/manifest.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/manifest.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/method.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/method.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/method.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/method.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/type.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/type.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/type.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/type.cpp
diff --git a/drlvm/vm/vmcore/src/class_support/type_access.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/class_support/type_access.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/class_support/type_access.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/class_support/type_access.cpp
diff --git a/drlvm/vm/vmstart/src/compmgr/component_manager_impl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/compmgr/component_manager_impl.cpp
similarity index 100%
rename from drlvm/vm/vmstart/src/compmgr/component_manager_impl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/compmgr/component_manager_impl.cpp
diff --git a/drlvm/vm/vmstart/src/compmgr/component_manager_impl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/compmgr/component_manager_impl.h
similarity index 100%
rename from drlvm/vm/vmstart/src/compmgr/component_manager_impl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/compmgr/component_manager_impl.h
diff --git a/drlvm/vm/vmcore/src/exception/exceptions.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/exception/exceptions.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions.cpp
diff --git a/drlvm/vm/vmcore/src/exception/exceptions_impl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_impl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/exception/exceptions_impl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_impl.cpp
diff --git a/drlvm/vm/vmcore/src/exception/exceptions_int.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_int.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/exception/exceptions_int.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_int.cpp
diff --git a/drlvm/vm/vmcore/src/exception/exceptions_jit.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_jit.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/exception/exceptions_jit.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_jit.cpp
index c6f0b4f..bde3196 100644
--- a/drlvm/vm/vmcore/src/exception/exceptions_jit.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/exception/exceptions_jit.cpp
@@ -45,14 +45,7 @@
 #include "cci.h"
 #include "port_threadunsafe.h"
 
-
-#ifdef _IPF_
-#include "../m2n_ipf_internal.h"
-#elif defined _EM64T_
-#include "../m2n_em64t_internal.h"
-#else
-#include "../m2n_ia32_internal.h"
-#endif
+#include "m2n_internal.h"
 
 
 ////////////////////////////////////////////////////////////////////////////
@@ -783,7 +776,7 @@
 
 static void rth_throw_lazy(Method * exn_constr)
 {
-#if defined(_IPF_) || defined(_EM64T_)
+#if defined(_IPF_) || defined(HYX86_64)
     LDIE(61, "Lazy exceptions are not supported on this platform");
 #else
     U_8 *args = (U_8 *) (m2n_get_args(m2n_get_last_frame()) + 1);   // +1 to skip constructor
diff --git a/drlvm/vm/vmcore/src/gc/dll_gc.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/gc/dll_gc.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/gc/dll_gc.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/gc/dll_gc.cpp
diff --git a/drlvm/vm/vmcore/src/gc/root_set_enum_common.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/gc/root_set_enum_common.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/gc/root_set_enum_common.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/gc/root_set_enum_common.cpp
diff --git a/drlvm/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/gc/stop_the_world_root_set_enum.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/gc/stop_the_world_root_set_enum.cpp
diff --git a/drlvm/vm/vmcore/src/lil/ipf/include/lil_code_generator_ipf.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/include/lil_code_generator_arch.h
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/ipf/include/lil_code_generator_ipf.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/include/lil_code_generator_arch.h
diff --git a/drlvm/vm/vmcore/src/lil/ipf/lil_code_generator_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/lil_code_generator_arch.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/lil/ipf/lil_code_generator_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/lil_code_generator_arch.cpp
index 933ccdd..562f09a 100644
--- a/drlvm/vm/vmcore/src/lil/ipf/lil_code_generator_ipf.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/lil_code_generator_arch.cpp
@@ -27,10 +27,10 @@
 
 #include "lil.h"
 #include "lil_code_generator.h"
-#include "lil_code_generator_ipf.h"
+#include "lil_code_generator_arch.h"
 #include "lil_code_generator_utils.h"
 #include "m2n.h"
-#include "m2n_ipf_internal.h"
+#include "m2n_internal.h"
 #include "tl/memory_pool.h"
 #include "vm_ipf.h"
 #include "vm_threads.h"
diff --git a/drlvm/vm/vmcore/src/lil/ipf/m2n_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/m2n.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/ipf/m2n_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/m2n.cpp
diff --git a/drlvm/vm/vmcore/src/lil/ipf/m2n_ipf_internal.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/m2n_internal.h
similarity index 99%
rename from drlvm/vm/vmcore/src/lil/ipf/m2n_ipf_internal.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/m2n_internal.h
index 409f0ba..95eae0b 100644
--- a/drlvm/vm/vmcore/src/lil/ipf/m2n_ipf_internal.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/m2n_internal.h
@@ -153,7 +153,7 @@
 
 #define M2N_EXTRA_SAVES_SPACE 400
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #error Should not be included!
 #endif
 
diff --git a/drlvm/vm/vmcore/src/lil/ipf/stack_iterator_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/stack_iterator.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/ipf/stack_iterator_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/lil/stack_iterator.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_step_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/ncai/ncai_step_arch.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_step_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/ncai/ncai_step_arch.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_utils_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/ncai/ncai_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_utils_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/ncai/ncai_utils.cpp
diff --git a/drlvm/vm/vmcore/src/thread/helpers/thread_helpers_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/thread/thread_helpers.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/helpers/thread_helpers_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/thread/thread_helpers.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/code_emit/Code_Emitter.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/Code_Emitter.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/code_emit/Code_Emitter.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/Code_Emitter.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/code_emit/merced.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/merced.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/code_emit/merced.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/merced.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/code_emit/sched_enums.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/sched_enums.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/code_emit/sched_enums.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/code_emit/sched_enums.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/compile_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/compile.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/compile_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/compile.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/defines.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/defines.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/defines.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/defines.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/exceptions_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/exceptions.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/exceptions_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/exceptions.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/include/Code_Emitter.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/Code_Emitter.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/include/Code_Emitter.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/Code_Emitter.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/include/Emitter_IR.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/Emitter_IR.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/include/Emitter_IR.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/Emitter_IR.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/include/merced.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/merced.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/include/merced.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/merced.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/include/stub_code_utils.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/stub_code_utils.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/include/stub_code_utils.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/stub_code_utils.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/include/vm_ipf.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/vm.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/include/vm_ipf.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/include/vm.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/ini_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/ini.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/ini_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/ini.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/ini_ipf_low_level.asm b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/ini_low_level.asm
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/ini_ipf_low_level.asm
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/ini_low_level.asm
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/invoke_native_stub_ipf.asm b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/invoke_native_stub.asm
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/invoke_native_stub_ipf.asm
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/invoke_native_stub.asm
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/jit_runtime_support.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/jit_runtime_support.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/base_natives/java_lang_thread_ipf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/natives/java_lang_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base_natives/java_lang_thread_ipf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/natives/java_lang_thread.cpp
diff --git a/drlvm/vm/vmcore/src/util/ipf/base_natives/java_lang_thread_ipf.h b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/natives/java_lang_thread.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base_natives/java_lang_thread_ipf.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/natives/java_lang_thread.h
diff --git a/drlvm/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/stub_code_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ia64/util/stub_code_utils.cpp
diff --git a/drlvm/vm/vmcore/src/init/bootclasspath.properties b/drlvm/modules/vm/src/main/native/vmcore/shared/init/bootclasspath.properties
similarity index 100%
rename from drlvm/vm/vmcore/src/init/bootclasspath.properties
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/bootclasspath.properties
diff --git a/drlvm/vm/vmcore/src/init/finalize.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/finalize.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/finalize.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/finalize.cpp
diff --git a/drlvm/vm/vmcore/src/init/finalizer_thread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/finalizer_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/finalizer_thread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/finalizer_thread.cpp
diff --git a/drlvm/vm/vmcore/src/init/harmony.properties b/drlvm/modules/vm/src/main/native/vmcore/shared/init/harmony.properties
similarity index 100%
rename from drlvm/vm/vmcore/src/init/harmony.properties
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/harmony.properties
diff --git a/drlvm/vm/vmcore/src/init/parse_arguments.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/parse_arguments.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/parse_arguments.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/parse_arguments.cpp
diff --git a/drlvm/vm/vmcore/src/init/properties.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/properties.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/properties.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/properties.cpp
diff --git a/drlvm/vm/vmcore/src/init/ref_enqueue_thread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/ref_enqueue_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/ref_enqueue_thread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/ref_enqueue_thread.cpp
diff --git a/drlvm/vm/vmcore/src/init/vm.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/vm.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/vm.cpp
diff --git a/drlvm/vm/vmcore/src/init/vm_init.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/init/vm_init.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp
index 33daf7b..7105f6c 100644
--- a/drlvm/vm/vmcore/src/init/vm_init.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_init.cpp
@@ -370,7 +370,7 @@
     }
     
     apr_dso_handle_sym_t gdba, gdbc, ndb;
-#if defined WIN32 && !defined _EM64T_
+#if defined WIN32 && !defined HYX86_64
 #define GET_DIRECT_BUFFER_ADDRESS "_GetDirectBufferAddress@8"
 #define GET_DIRECT_BUFFER_CAPACITY "_GetDirectBufferCapacity@8"
 #define NEW_DIRECT_BYTE_BUFFER "_NewDirectByteBuffer@16"
diff --git a/drlvm/vm/vmcore/src/init/vm_properties.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_properties.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/vm_properties.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_properties.cpp
diff --git a/drlvm/vm/vmcore/src/init/vm_shutdown.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_shutdown.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/init/vm_shutdown.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/init/vm_shutdown.cpp
diff --git a/drlvm/vm/vmcore/src/interpreter/interp_exports.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/interpreter/interp_exports.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/interpreter/interp_exports.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/interpreter/interp_exports.cpp
diff --git a/drlvm/vm/vmcore/src/interpreter/interp_imports.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/interpreter/interp_imports.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/interpreter/interp_imports.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/interpreter/interp_imports.cpp
diff --git a/drlvm/vm/vmcore/src/jit/bit_vector.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/bit_vector.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/bit_vector.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/bit_vector.cpp
diff --git a/drlvm/vm/vmcore/src/jit/compile.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/compile.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/compile.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/compile.cpp
diff --git a/drlvm/vm/vmcore/src/jit/dll_jit.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/dll_jit.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/dll_jit.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/dll_jit.cpp
diff --git a/drlvm/vm/vmcore/src/jit/dump.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/dump.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/dump.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/dump.cpp
diff --git a/drlvm/vm/vmcore/src/jit/ini.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/ini.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/ini.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/ini.cpp
diff --git a/drlvm/vm/vmcore/src/jit/jit_runtime_support.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/jit_runtime_support.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jit/jit_runtime_support.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/jit_runtime_support.cpp
index ee14b9e..69bf155 100644
--- a/drlvm/vm/vmcore/src/jit/jit_runtime_support.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/jit_runtime_support.cpp
@@ -1642,9 +1642,9 @@
 
 //end of lazy resolution helpers
 //////////////////////////////////////////////////////////////////////////
-#if (defined PLATFORM_POSIX) && (defined _IA32_)
+#if (defined PLATFORM_POSIX) && (defined HYX86)
 ManagedObject* __attribute__ ((__stdcall__)) rth_struct_Class_to_java_lang_Class(Class *clss) {
-#elif defined _IA32_
+#elif defined HYX86
 ManagedObject* __stdcall rth_struct_Class_to_java_lang_Class(Class *clss) {
 #else
 ManagedObject* rth_struct_Class_to_java_lang_Class(Class *clss) {
diff --git a/drlvm/vm/vmcore/src/jit/native_overrides.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/native_overrides.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jit/native_overrides.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/native_overrides.cpp
index 4490ce5..1c1efe7 100644
--- a/drlvm/vm/vmcore/src/jit/native_overrides.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/native_overrides.cpp
@@ -191,7 +191,7 @@
 
 // The following override is only for IA32
 
-#ifdef _IA32_
+#ifdef HYX86
 
 #include "encoder.h"
 
@@ -391,7 +391,7 @@
 // Local NSO table for filling up env-local lookup table
 NSOLocalItem local_NSO_table[] = 
 {
-#ifdef _IA32_
+#ifdef HYX86
     {nso_char_array_copy,
 #else
     {nso_array_copy,
diff --git a/drlvm/vm/vmcore/src/jit/primitives_support.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/primitives_support.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/primitives_support.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/primitives_support.cpp
diff --git a/drlvm/vm/vmcore/src/jit/rt_helper_info.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jit/rt_helper_info.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jit/rt_helper_info.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jit/rt_helper_info.cpp
diff --git a/drlvm/vm/vmcore/src/jni/jni.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jni/jni.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni.cpp
diff --git a/drlvm/vm/vmcore/src/jni/jni_array.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_array.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jni/jni_array.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_array.cpp
diff --git a/drlvm/vm/vmcore/src/jni/jni_field.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_field.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jni/jni_field.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_field.cpp
diff --git a/drlvm/vm/vmcore/src/jni/jni_method.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_method.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jni/jni_method.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_method.cpp
diff --git a/drlvm/vm/vmcore/src/jni/jni_utils.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jni/jni_utils.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jni/jni_utils.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_break.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_break.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_break.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_break.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_break_intf.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_break_intf.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_break_intf.cpp
index c93b236..c2d632e 100644
--- a/drlvm/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_break_intf.cpp
@@ -40,7 +40,7 @@
 #include "port_crash_handler.h"
 #include "open/vm_class_info.h"
 
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
 
 #include "encoder.h"
 // Forward declarations
@@ -549,9 +549,9 @@
 
 static char *gen_push(char *code_addr, POINTER_SIZE_INT value)
 {
-#ifdef _IA32_
+#ifdef HYX86
     return push(code_addr, Imm_Opnd(size_32, value));
-#elif defined _EM64T_
+#elif defined HYX86_64
     I_32 high = (I_32)((U_32)(value >> 32));
     I_32 low = (I_32)((U_32)value);
     code_addr = alu(code_addr, sub_opc, rsp_opnd, Imm_Opnd(size_8, 8));
@@ -565,9 +565,9 @@
 
 static char *gen_jump(char *code_addr, char *target_addr)
 {
-#ifdef _IA32_
+#ifdef HYX86
     return jump(code_addr, target_addr);
-#elif defined _EM64T_
+#elif defined HYX86_64
     code_addr = gen_push(code_addr, (POINTER_SIZE_INT)target_addr);
     return ret(code_addr);
 #else
@@ -594,7 +594,7 @@
 void
 VMBreakPoints::process_native_breakpoint(Registers* regs)
 {
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
     // When we get here we know already that breakpoint occurred in JITted code,
     // JVMTI handles it, and registers context is saved for us in TLS
     VM_thread *vm_thread = p_TLS_vmthread;
@@ -1221,7 +1221,7 @@
 //////////////////////////////////////////////////////////////////////////////
 // Helper functions
 
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
 static inline ConditionCode
 get_condition_code(InstructionDisassembler::CondJumpType jump_type)
 {
@@ -1270,7 +1270,7 @@
 
 static bool set_native_breakpoint(VMBreakPoint* bp)
 {
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
     assert(bp);
     assert(bp->addr);
 
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_capability.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_capability.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_capability.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_capability.cpp
index 2622201..edea5de 100644
--- a/drlvm/vm/vmcore/src/jvmti/jvmti_capability.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_capability.cpp
@@ -67,7 +67,7 @@
     1  // can_generate_object_free_events
 };
 
-#if (defined _EM64T_) || (defined _IPF_)
+#if (defined HYX86_64) || (defined _IPF_)
 
 static const jvmtiCapabilities jvmti_supported_jit_capabilities =
 {
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_class.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_class.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_class.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_class.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_dasm.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_dasm.cpp
similarity index 97%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_dasm.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_dasm.cpp
index d042416..14d152f 100644
--- a/drlvm/vm/vmcore/src/jvmti/jvmti_dasm.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_dasm.cpp
@@ -24,7 +24,7 @@
 
 // FIXME: Highly platform specific, should be renamed to jvmti_dasm_x86.cpp
 //        or go to arch specific directory.
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
 
 #include "jvmti_dasm.h"
 #include "dec_base.h"
@@ -32,7 +32,7 @@
 static InstructionDisassembler::Register convertRegName2Register(RegName reg)
 {
     switch(reg) {
-#ifdef _IA32_
+#ifdef HYX86
     case RegName_Null:  return InstructionDisassembler::DISASM_REG_NONE;
     case RegName_EAX:   return InstructionDisassembler::DISASM_REG_EAX;
     case RegName_EBX:   return InstructionDisassembler::DISASM_REG_EBX;
@@ -42,7 +42,7 @@
     case RegName_EDI:   return InstructionDisassembler::DISASM_REG_EDI;
     case RegName_EBP:   return InstructionDisassembler::DISASM_REG_EBP;
     case RegName_ESP:   return InstructionDisassembler::DISASM_REG_ESP;
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
     case RegName_Null:  return InstructionDisassembler::DISASM_REG_NONE;
     case RegName_RAX:   return InstructionDisassembler::DISASM_REG_RAX;
     case RegName_RBX:   return InstructionDisassembler::DISASM_REG_RBX;
@@ -100,7 +100,7 @@
     return NULL;
 }
 
-#elif defined _EM64T_
+#elif defined HYX86_64
 
 const char* InstructionDisassembler::get_reg_value(
     Register reg,
@@ -129,7 +129,7 @@
     return NULL;
 }
 
-#else // _IA32_
+#else // HYX86
 
 const char* InstructionDisassembler::get_reg_value(
     Register reg,
@@ -150,7 +150,7 @@
     return NULL;
 }
 
-#endif // _IA32_
+#endif // HYX86
 
 void InstructionDisassembler::disasm(const NativeCodePtr addr, 
                                      InstructionDisassembler * pidi)
@@ -235,14 +235,14 @@
         // can't happen for INDIRECT_xxx.
         assert(false);
         return NULL;
-#ifdef _IA32_
+#ifdef HYX86
     case RET:
         {
         const char* sp_value = get_reg_value(DISASM_REG_ESP, pcontext);
         const char* retAddr = *(char**)sp_value;
         return (NativeCodePtr)retAddr;
         }
-#endif // _IA32_
+#endif // HYX86
     default:
         // This method should not be called for non-branch instructions.
         assert(false);
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_enumerate.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_enumerate.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_enumerate.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_enumerate.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_event.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_event.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_event.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_event.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_extension.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_extension.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_extension.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_extension.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_field.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_field.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_field.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_field.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_general.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_general.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_general.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_general.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_heap.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_heap.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_heap.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_heap.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_heap.h b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_heap.h
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_heap.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_heap.h
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_internal.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_internal.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_internal.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_internal.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_jni.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_jni.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_jni.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_jni.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_locals.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_locals.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_locals.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_locals.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_mem.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_mem.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_mem.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_mem.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_method.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_method.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_method.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_method.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_object.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_object.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_object.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_object.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_pop_frame.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_pop_frame.cpp
index 2bc1087..2b6dc0a 100644
--- a/drlvm/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_pop_frame.cpp
@@ -141,7 +141,7 @@
     assert(0);
 }
 
-#else // _IA32_ & _EM64T_
+#else // HYX86 & HYX86_64
 
 // requires stack iterator and buffer to save intermediate information
 static void jvmti_jit_prepare_pop_frame(StackIterator* si, U_32* buf) {
@@ -319,7 +319,7 @@
     CTRACE(("PopFrame transfer control to: %p",  (void*)si_get_ip(si) ));
     si_transfer_control(si);
 }
-#endif // _IA32_
+#endif // HYX86
 
 void jvmti_safe_point()
 {
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_property.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_property.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_property.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_property.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_rawmon.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_rawmon.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_rawmon.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_rawmon.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_roots.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_roots.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_roots.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_roots.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_roots.h b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_roots.h
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_roots.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_roots.h
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_stack.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_stack.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_stack.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_stack.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_step.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_step.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_step.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_step.cpp
index c73088a..7e9bfd9 100644
--- a/drlvm/vm/vmcore/src/jvmti/jvmti_step.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_step.cpp
@@ -59,7 +59,7 @@
 NativeCodePtr static get_ip_for_invoke_call_ip(VM_thread* thread,
     unsigned location, unsigned next_location)
 {
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
     ASSERT_NO_INTERPRETER;
 
     // create stack iterator from native
@@ -497,7 +497,7 @@
 static void jvmti_start_single_step_in_virtual_method(DebugUtilsTI *ti, const VMBreakPoint* bp,
     const POINTER_SIZE_INT data, const unsigned char bytecode)
 {
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
     VM_thread *vm_thread = p_TLS_vmthread;
     assert(vm_thread);
     jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
@@ -795,7 +795,7 @@
     unsigned *count,
     bool invoked_frame)
 {
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
     ASSERT_NO_INTERPRETER;
     VMBreakPoints *vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
 
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_tags.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_tags.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_tags.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_tags.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_tags.h b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_tags.h
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_tags.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_tags.h
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_thread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_thread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_thread.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_thread_group.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_thread_group.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_thread_group.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_timer.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_timer.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_timer.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_timer.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_trace.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_trace.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_trace.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_trace.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_trace.h b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_trace.h
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_trace.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_trace.h
diff --git a/drlvm/vm/vmcore/src/jvmti/jvmti_watch.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_watch.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/jvmti_watch.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/jvmti_watch.cpp
diff --git a/drlvm/vm/vmcore/src/jvmti/ulist.h b/drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/ulist.h
similarity index 100%
rename from drlvm/vm/vmcore/src/jvmti/ulist.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/jvmti/ulist.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_ClassLoader.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_ClassLoader.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_ClassLoader.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_ClassLoader.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_EMThreadSupport.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_EMThreadSupport.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_EMThreadSupport.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_EMThreadSupport.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_EMThreadSupport.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_EMThreadSupport.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_EMThreadSupport.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_EMThreadSupport.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_FinalizerThread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_FinalizerThread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_FinalizerThread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_FinalizerThread.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_FinalizerThread.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_FinalizerThread.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_FinalizerThread.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_FinalizerThread.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess_SubInputStream.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess_SubInputStream.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess_SubInputStream.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess_SubInputStream.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess_SubOutputStream.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess_SubOutputStream.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_Runtime_SubProcess_SubOutputStream.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_Runtime_SubProcess_SubOutputStream.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_System.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_System.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_System.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_System.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_System.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_System.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_System.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_System.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMClassRegistry.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMClassRegistry.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMClassRegistry.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMClassRegistry.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMExecutionEngine.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMExecutionEngine.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMExecutionEngine.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMExecutionEngine.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMMemoryManager.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMMemoryManager.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMMemoryManager.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMMemoryManager.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMMemoryManager.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMMemoryManager.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMMemoryManager.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMMemoryManager.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMThreadManager.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMThreadManager.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMThreadManager.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMThreadManager.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMThreadManager.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMThreadManager.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_VMThreadManager.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_VMThreadManager.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMField.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMField.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMField.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMField.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMReflection.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMReflection.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMReflection.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_lang_reflect_VMReflection.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_security_AccessController.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_security_AccessController.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_security_AccessController.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_security_AccessController.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_util_concurrent_locks_LockSupport.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_util_concurrent_locks_LockSupport.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_util_concurrent_locks_LockSupport.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_util_concurrent_locks_LockSupport.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/java_util_concurrent_locks_LockSupport.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_util_concurrent_locks_LockSupport.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/java_util_concurrent_locks_LockSupport.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/java_util_concurrent_locks_LockSupport.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelper.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelper.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelper.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelper.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelperFastPath.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelperFastPath.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelperFastPath.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelperFastPath.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelperFastPath.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelperFastPath.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelperFastPath.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_drlvm_VMHelperFastPath.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_kernel_vm_VM.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_kernel_vm_VM.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_kernel_vm_VM.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_kernel_vm_VM.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_kernel_vm_VM.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_kernel_vm_VM.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_kernel_vm_VM.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_kernel_vm_VM.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_CompilationMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_CompilationMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThread.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThread.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThread.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThread.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThread.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_RuntimeMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_RuntimeMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_RuntimeMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_RuntimeMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_RuntimeMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_RuntimeMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_RuntimeMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_RuntimeMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ThreadMXBeanImpl.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ThreadMXBeanImpl.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ThreadMXBeanImpl.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ThreadMXBeanImpl.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ThreadMXBeanImpl.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ThreadMXBeanImpl.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_ThreadMXBeanImpl.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_lang_management_ThreadMXBeanImpl.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_util_concurrent_Atomics.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_util_concurrent_Atomics.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_util_concurrent_Atomics.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_util_concurrent_Atomics.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMDebug.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMDebug.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMDebug.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMDebug.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMDebug.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMDebug.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMDebug.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMDebug.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMGenericsAndAnnotations.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMGenericsAndAnnotations.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMGenericsAndAnnotations.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMGenericsAndAnnotations.h
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMStack.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMStack.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.h b/drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMStack.h
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/kernel_classes/org_apache_harmony_vm_VMStack.h
diff --git a/drlvm/vm/vmcore/src/lil/lil.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/lil.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil.cpp
diff --git a/drlvm/vm/vmcore/src/lil/lil_code_generator.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil_code_generator.cpp
similarity index 91%
rename from drlvm/vm/vmcore/src/lil/lil_code_generator.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil_code_generator.cpp
index 38cfc23..e0fc8b2 100644
--- a/drlvm/vm/vmcore/src/lil/lil_code_generator.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil_code_generator.cpp
@@ -21,21 +21,14 @@
 
 #include "lil.h"
 #include "lil_code_generator.h"
-
-#ifdef _IA32_
-#include "lil_code_generator_ia32.h"
-#elif _EM64T_
-#include "lil_code_generator_em64t.h"
-#elif _IPF_
-#include "lil_code_generator_ipf.h"
-#endif
+#include "lil_code_generator_arch.h"
 
 
 LilCodeGenerator* LilCodeGenerator::get_platform()
 {
-#ifdef _IA32_
+#ifdef HYX86
     static LilCodeGeneratorIa32 cg;
-#elif _EM64T_
+#elif HYX86_64
     static LilCodeGeneratorEM64T cg;
 #elif _IPF_
     static LilCodeGeneratorIpf cg;
diff --git a/drlvm/vm/vmcore/src/lil/lil_code_generator_utils.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil_code_generator_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/lil_code_generator_utils.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/lil/lil_code_generator_utils.cpp
diff --git a/drlvm/vm/vmcore/src/lil/stack_iterator/m2n.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/stack_iterator/m2n.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/stack_iterator/m2n.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/lil/stack_iterator/m2n.cpp
diff --git a/drlvm/vm/vmcore/src/lil/stack_iterator/stack_iterator.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/lil/stack_iterator/stack_iterator.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/lil/stack_iterator/stack_iterator.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/lil/stack_iterator/stack_iterator.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/NCAI.html b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/NCAI.html
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/NCAI.html
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/NCAI.html
diff --git a/drlvm/vm/vmcore/src/ncai/README b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/README
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/README
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/README
diff --git a/drlvm/vm/vmcore/src/ncai/ncai.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_break.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_break.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_break.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_break.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_event.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_event.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_event.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_event.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_memory.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_memory.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_memory.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_memory.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_methods.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_methods.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_methods.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_methods.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_modules.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_modules.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_modules.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_modules.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_registers.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_registers.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_registers.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_registers.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_signals.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_signals.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_signals.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_signals.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_stack.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_stack.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_stack.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_stack.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_step.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_step.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_step.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_step.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/ncai_thread.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/ncai_thread.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/ncai/ncai_thread.cpp
diff --git a/drlvm/vm/vmcore/src/object/object_handles.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/object/object_handles.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/object/object_handles.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/object/object_handles.cpp
diff --git a/drlvm/vm/vmcore/src/object/vm_arrays.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/object/vm_arrays.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/object/vm_arrays.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/object/vm_arrays.cpp
diff --git a/drlvm/vm/vmcore/src/reflection/annotations.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/reflection/annotations.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/reflection/annotations.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/reflection/annotations.cpp
diff --git a/drlvm/vm/vmcore/src/reflection/reflection.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/reflection/reflection.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/reflection/reflection.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/reflection/reflection.cpp
diff --git a/drlvm/vm/vmcore/src/stack/native_stack.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/stack/native_stack.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/stack/native_stack.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/stack/native_stack.cpp
index 620d34f..55c729f 100644
--- a/drlvm/vm/vmcore/src/stack/native_stack.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/stack/native_stack.cpp
@@ -94,7 +94,7 @@
 
 #if defined(_IPF_)
     // Nothing
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
     frame->ip = (void*)regs->rip;
     frame->frame = (void*)regs->rbp;
     frame->stack = (void*)regs->rsp;
@@ -109,7 +109,7 @@
 {
 #if defined(_IPF_)
     // Nothing
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
     regs->rsp = jfc->rsp;
     regs->rip = *jfc->p_rip;
     regs->rbp = (jfc->p_rbp) ? *jfc->p_rbp : regs->rbp;
diff --git a/drlvm/vm/vmcore/src/stack/stack_trace.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/stack/stack_trace.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/stack/stack_trace.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/stack/stack_trace.cpp
diff --git a/drlvm/vm/vmcore/src/thread/atomics_common.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/atomics_common.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/atomics_common.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/atomics_common.cpp
diff --git a/drlvm/vm/vmcore/src/thread/lock_manager.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/lock_manager.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/lock_manager.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/lock_manager.cpp
diff --git a/drlvm/vm/vmcore/src/thread/mon_enter_exit.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/mon_enter_exit.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/mon_enter_exit.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/mon_enter_exit.cpp
diff --git a/drlvm/vm/vmcore/src/thread/object_generic.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/object_generic.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/object_generic.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/object_generic.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_dump.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_dump.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_dump.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_dump.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_generic.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_generic.cpp
similarity index 96%
rename from drlvm/vm/vmcore/src/thread/thread_generic.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_generic.cpp
index acddc88..686e1d6 100644
--- a/drlvm/vm/vmcore/src/thread/thread_generic.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_generic.cpp
@@ -63,16 +63,8 @@
 #include "jni_direct.h"
 #include "port_malloc.h"
 
-#ifdef _IPF_
-#include "java_lang_thread_ipf.h"
-#include "../m2n_ipf_internal.h"
-#elif defined _EM64T_
-#include "java_lang_thread_em64t.h"
-#include "../m2n_em64t_internal.h"
-#else
-#include "java_lang_thread_ia32.h"
-#include "../m2n_ia32_internal.h"
-#endif
+#include "java_lang_thread.h"
+#include "m2n_internal.h"
 
 #define IS_FAT_LOCK(lockword) (lockword >> 31)
 
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_attrs.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_attrs.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_attrs.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_attrs.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_basic.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_basic.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_basic.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_basic.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_interrupt.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_interrupt.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_interrupt.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_interrupt.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_iterator.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_iterator.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_iterator.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_iterator.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_monitors.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_monitors.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_monitors.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_monitors.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_park.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_park.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_park.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_park.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_java_suspend.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_suspend.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_java_suspend.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_java_suspend.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_manager.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_manager.cpp
similarity index 97%
rename from drlvm/vm/vmcore/src/thread/thread_manager.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_manager.cpp
index e98e0d8..053bb2a 100644
--- a/drlvm/vm/vmcore/src/thread/thread_manager.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_manager.cpp
@@ -47,15 +47,7 @@
 #include "interpreter.h"
 #include "exceptions_int.h"
 
-#ifdef _IPF_
-#include "java_lang_thread_ipf.h"
-#elif defined _EM64T_
-//#include "java_lang_thread_em64t.h"
-#else
-#include "java_lang_thread_ia32.h"
-#endif
-
-
+#include "java_lang_thread.h"
 
 jint jthread_allocate_vm_thread_pool(JavaVM *java_vm,
                                      vm_thread_t vm_thread)
diff --git a/drlvm/vm/vmcore/src/thread/thread_ti_instr.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_instr.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_ti_instr.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_instr.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_ti_monitors.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_monitors.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_ti_monitors.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_monitors.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_ti_others.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_others.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_ti_others.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_others.cpp
diff --git a/drlvm/vm/vmcore/src/thread/thread_ti_timing.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_timing.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/thread_ti_timing.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/thread_ti_timing.cpp
diff --git a/drlvm/vm/vmcore/src/thread/verify_stack_enumeration.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/thread/verify_stack_enumeration.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/verify_stack_enumeration.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/thread/verify_stack_enumeration.cpp
diff --git a/drlvm/vm/vmcore/src/util/bytereader.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/bytereader.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/bytereader.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/bytereader.cpp
diff --git a/drlvm/vm/vmcore/src/util/crash_dump.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/crash_dump.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/crash_dump.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/crash_dump.cpp
diff --git a/drlvm/vm/vmcore/src/util/jarfile_support.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/jarfile_support.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/jarfile_support.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/jarfile_support.cpp
diff --git a/drlvm/vm/vmcore/src/util/mem_alloc.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/mem_alloc.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/mem_alloc.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/mem_alloc.cpp
diff --git a/drlvm/vm/vmcore/src/util/natives_support.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/natives_support.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/natives_support.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/natives_support.cpp
diff --git a/drlvm/vm/vmcore/src/util/signals.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/signals.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/util/signals.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/signals.cpp
index 56033d0..4307287 100644
--- a/drlvm/vm/vmcore/src/util/signals.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/util/signals.cpp
@@ -29,9 +29,9 @@
 
 #ifdef PLATFORM_POSIX
 
-#if defined(_EM64T_)
+#if defined(HYX86_64)
 #define RESTORE_STACK_SIZE 0x0400
-#elif defined (_IA32_)
+#elif defined (HYX86)
 #define RESTORE_STACK_SIZE 0x0100
 #else // IPF
 #define RESTORE_STACK_SIZE 0x0200
diff --git a/drlvm/vm/vmcore/src/util/vm_stats.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/vm_stats.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/vm_stats.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/vm_stats.cpp
diff --git a/drlvm/vm/vmcore/src/util/vm_strings.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/util/vm_strings.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/vm_strings.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/util/vm_strings.cpp
diff --git a/drlvm/vm/vmcore/src/lil/ia32/include/lil_code_generator_ia32.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/include/lil_code_generator_arch.h
similarity index 90%
rename from drlvm/vm/vmcore/src/lil/ia32/include/lil_code_generator_ia32.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/include/lil_code_generator_arch.h
index 54c7347..96fcce3 100644
--- a/drlvm/vm/vmcore/src/lil/ia32/include/lil_code_generator_ia32.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/include/lil_code_generator_arch.h
@@ -19,8 +19,8 @@
  */  
 
 
-#ifndef _LIL_CODE_GENERATOR_IA32_
-#define _LIL_CODE_GENERATOR_IA32_
+#ifndef _LIL_CODE_GENERATORHYX86
+#define _LIL_CODE_GENERATORHYX86
 
 #include "lil.h"
 #include "lil_code_generator.h"
@@ -34,4 +34,4 @@
     NativeCodePtr compile_main(LilCodeStub* , size_t*, PoolManager*);
 };
 
-#endif // _LIL_CODE_GENERATOR_IA32_
+#endif // _LIL_CODE_GENERATORHYX86
diff --git a/drlvm/vm/vmcore/src/lil/ia32/lil_code_generator_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/lil_code_generator_arch.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/ia32/lil_code_generator_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/lil_code_generator_arch.cpp
index 0398724..5437de1 100644
--- a/drlvm/vm/vmcore/src/lil/ia32/lil_code_generator_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/lil_code_generator_arch.cpp
@@ -19,10 +19,10 @@
 
 #include "lil.h"
 #include "lil_code_generator.h"
-#include "lil_code_generator_ia32.h"
+#include "lil_code_generator_arch.h"
 #include "lil_code_generator_utils.h"
 #include "m2n.h"
-#include "m2n_ia32_internal.h"
+#include "m2n_internal.h"
 #include "vm_threads.h"
 #include "encoder.h"
 #include "jit_runtime_support_common.h"
diff --git a/drlvm/vm/vmcore/src/lil/ia32/m2n_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/ia32/m2n_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n.cpp
index 6983b77..ca2ee95 100644
--- a/drlvm/vm/vmcore/src/lil/ia32/m2n_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n.cpp
@@ -19,7 +19,7 @@
 #include "thread_helpers.h"
 
 #include "m2n.h"
-#include "m2n_ia32_internal.h"
+#include "m2n_internal.h"
 #include "port_malloc.h"
 #include "object_handles.h"
 #include "vm_threads.h"
diff --git a/drlvm/vm/vmcore/src/lil/ia32/m2n_ia32_internal.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n_internal.h
similarity index 97%
rename from drlvm/vm/vmcore/src/lil/ia32/m2n_ia32_internal.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n_internal.h
index 6b79586..e1ebdf8 100644
--- a/drlvm/vm/vmcore/src/lil/ia32/m2n_ia32_internal.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/m2n_internal.h
@@ -19,8 +19,8 @@
  */  
 
 
-#ifndef _M2N_IA32_INTERNAL_H_
-#define _M2N_IA32_INTERNAL_H_
+#ifndef _M2NHYX86INTERNAL_H_
+#define _M2NHYX86INTERNAL_H_
 
 // This file describes the internal IPF interface of m2n frames.
 // It can be used by stubs to generate code to push and pop m2n frames, to update object handles fields, and 
@@ -85,7 +85,7 @@
 //   p_lm2nf==1
 //   regs is present
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #error Wrong header file.
 #endif
 
@@ -104,4 +104,4 @@
     Registers*           regs; // This is only for M2nFrames for suspended managed code (as against ones that call stubs and prepare jvmtiPopFrame)
 };
 
-#endif //!_M2N_IA32_INTERNAL_H_
+#endif //!_M2NHYX86INTERNAL_H_
diff --git a/drlvm/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/stack_iterator.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/stack_iterator.cpp
index a380525..70dae61 100644
--- a/drlvm/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/lil/stack_iterator.cpp
@@ -23,7 +23,7 @@
 #include "environment.h"
 #include "jit_intf_cpp.h"
 #include "m2n.h"
-#include "m2n_ia32_internal.h"
+#include "m2n_internal.h"
 #include "nogc.h"
 #include "stack_iterator.h"
 #include "vm_stats.h"
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_step_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/ncai/ncai_step_arch.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_step_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/ncai/ncai_step_arch.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/ncai/ncai_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_utils_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/ncai/ncai_utils.cpp
diff --git a/drlvm/vm/vmcore/src/thread/helpers/thread_helpers_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/thread/thread_helpers.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/helpers/thread_helpers_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/thread/thread_helpers.cpp
diff --git a/drlvm/vm/vmcore/src/util/ia32/base/compile_IA32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/compile.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/compile.cpp
index e50c973..708f4e5 100644
--- a/drlvm/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/compile.cpp
@@ -28,7 +28,7 @@
 #include "environment.h"
 #include "stack_iterator.h"
 #include "m2n.h"
-#include "../m2n_ia32_internal.h"
+#include "m2n_internal.h"
 #include "exceptions.h"
 #include "exceptions_jit.h"
 #include "jit_intf.h"
diff --git a/drlvm/vm/vmcore/src/util/ia32/base/ini_iA32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/ini.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ia32/base/ini_iA32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/ini.cpp
diff --git a/drlvm/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_lock_rt_support.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_lock_rt_support.cpp
index c1e8177..af79ce8 100644
--- a/drlvm/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_lock_rt_support.cpp
@@ -30,7 +30,7 @@
 #include "exceptions_jit.h"
 #include "lil.h"
 #include "lil_code_generator.h"
-#include "../m2n_ia32_internal.h"
+#include "m2n_internal.h"
 #include "object_handles.h"
 #include "Class.h"
 #include "jit_runtime_support.h"
diff --git a/drlvm/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_runtime_support.cpp
similarity index 99%
rename from drlvm/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_runtime_support.cpp
index 5b5f122..34d1248 100644
--- a/drlvm/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/jit_runtime_support.cpp
@@ -48,7 +48,7 @@
 #include "jit_runtime_support.h"
 #include "internal_jit_intf.h"
 #include "m2n.h"
-#include "../m2n_ia32_internal.h"
+#include "m2n_internal.h"
 
 #include "dump.h"
 #include "vm_stats.h"
diff --git a/drlvm/vm/vmcore/src/util/ia32/base_natives/java_lang_thread_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/natives/java_lang_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ia32/base_natives/java_lang_thread_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/natives/java_lang_thread.cpp
diff --git a/drlvm/vm/vmcore/src/util/ia32/base_natives/java_lang_thread_ia32.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/natives/java_lang_thread.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ia32/base_natives/java_lang_thread_ia32.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/natives/java_lang_thread.h
diff --git a/drlvm/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/optimize.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86/util/optimize.cpp
diff --git a/drlvm/vm/vmcore/src/lil/em64t/include/lil_code_generator_em64t.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/include/lil_code_generator_arch.h
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/em64t/include/lil_code_generator_em64t.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/include/lil_code_generator_arch.h
index 5ab18fe..0b6db20 100644
--- a/drlvm/vm/vmcore/src/lil/em64t/include/lil_code_generator_em64t.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/include/lil_code_generator_arch.h
@@ -48,8 +48,8 @@
  *    r10-r11 are used for lil standard places (sp0-sp1)
  */
 
-#ifndef _LIL_CODE_GENERATOR_EM64T_
-#define _LIL_CODE_GENERATOR_EM64T_
+#ifndef _LIL_CODE_GENERATORHYX86_64
+#define _LIL_CODE_GENERATORHYX86_64
 
 #include "lil.h"
 #include "lil_code_generator.h"
@@ -738,4 +738,4 @@
     NativeCodePtr compile_main(LilCodeStub* , size_t*, PoolManager*);
 };
 
-#endif // _LIL_CODE_GENERATOR_EM64T_
+#endif // _LIL_CODE_GENERATORHYX86_64
diff --git a/drlvm/vm/vmcore/src/lil/em64t/lil_code_generator_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/lil_code_generator_arch.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/em64t/lil_code_generator_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/lil_code_generator_arch.cpp
index 6e4ed35..b866165 100644
--- a/drlvm/vm/vmcore/src/lil/em64t/lil_code_generator_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/lil_code_generator_arch.cpp
@@ -33,10 +33,10 @@
 
 #include "lil.h"
 #include "lil_code_generator.h"
-#include "lil_code_generator_em64t.h"
+#include "lil_code_generator_arch.h"
 #include "lil_code_generator_utils.h"
 #include "m2n.h"
-#include "m2n_em64t_internal.h"
+#include "m2n_internal.h"
 
 #ifndef NDEBUG
 #include "dump.h"
diff --git a/drlvm/vm/vmcore/src/lil/em64t/m2n_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/em64t/m2n_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n.cpp
index 5e525fd..1f24409 100644
--- a/drlvm/vm/vmcore/src/lil/em64t/m2n_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n.cpp
@@ -30,8 +30,8 @@
 
 #include "m2n.h"
 #include "encoder.h"
-#include "m2n_em64t_internal.h"
-#include "lil_code_generator_em64t.h"
+#include "m2n_internal.h"
+#include "lil_code_generator_arch.h"
 
 /*    Generic Interface    */
 
diff --git a/drlvm/vm/vmcore/src/lil/em64t/m2n_em64t_internal.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n_internal.h
similarity index 97%
rename from drlvm/vm/vmcore/src/lil/em64t/m2n_em64t_internal.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n_internal.h
index 6010a79..4300530 100644
--- a/drlvm/vm/vmcore/src/lil/em64t/m2n_em64t_internal.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/m2n_internal.h
@@ -19,8 +19,8 @@
  * @author Evgueni Brevnov
  */  
 
-#ifndef _M2N_EM64T_INTERNAL_H_
-#define _M2N_EM64T_INTERNAL_H_
+#ifndef _M2NHYX86_64INTERNAL_H_
+#define _M2NHYX86_64INTERNAL_H_
 
 // This file describes the internal EM64T interface of m2n frames.
 // It can be used by stubs to generate code to push and pop m2n frames, to update object handles fields, and 
@@ -129,4 +129,4 @@
 // returns top of the specified frame on the stack (it should point to return ip)
 void * m2n_get_frame_base(M2nFrame *);
 
-#endif // _M2N_EM64T_INTERNAL_H_
+#endif // _M2NHYX86_64INTERNAL_H_
diff --git a/drlvm/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/stack_iterator.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/stack_iterator.cpp
index 4cbdc49..322cf52 100644
--- a/drlvm/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/lil/stack_iterator.cpp
@@ -27,7 +27,7 @@
 #include "jit_intf_cpp.h"
 #include "encoder.h"
 #include "m2n.h"
-#include "m2n_em64t_internal.h"
+#include "m2n_internal.h"
 #include "nogc.h"
 #include "interpreter.h" // for ASSERT_NO_INTERPRETER
 #include "cci.h"
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/ncai/ncai_step_arch.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/ncai/ncai_step_arch.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_utils_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/ncai/ncai_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_utils_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/ncai/ncai_utils.cpp
diff --git a/drlvm/vm/vmcore/src/thread/helpers/thread_helpers_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/thread/thread_helpers.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/thread/helpers/thread_helpers_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/thread/thread_helpers.cpp
diff --git a/drlvm/vm/vmcore/src/util/em64t/base/compile_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/compile.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/util/em64t/base/compile_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/compile.cpp
index 2152fbf..4e0556a 100644
--- a/drlvm/vm/vmcore/src/util/em64t/base/compile_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/compile.cpp
@@ -33,7 +33,7 @@
 
 #include "nogc.h"
 #include "m2n.h"
-#include "../m2n_em64t_internal.h"
+#include "m2n_internal.h"
 #include "exceptions.h"
 #include "exceptions_jit.h"
 
diff --git a/drlvm/vm/vmcore/src/util/em64t/base/ini_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/ini.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/em64t/base/ini_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/ini.cpp
diff --git a/drlvm/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_lock_rt_support.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_lock_rt_support.cpp
index dc1544b..b567696 100644
--- a/drlvm/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_lock_rt_support.cpp
@@ -34,7 +34,7 @@
 #include "exceptions_jit.h"
 #include "lil.h"
 #include "lil_code_generator.h"
-#include "../m2n_em64t_internal.h"
+#include "m2n_internal.h"
 #include "object_handles.h"
 #include "Class.h"
 #include "jit_runtime_support.h"
diff --git a/drlvm/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_runtime_support.cpp
similarity index 98%
rename from drlvm/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_runtime_support.cpp
index 7210ca0..6317f92 100644
--- a/drlvm/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp
+++ b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/jit_runtime_support.cpp
@@ -33,7 +33,7 @@
 #include "lil_code_generator.h"
 #include "jit_runtime_support.h"
 #include "m2n.h"
-#include "../m2n_em64t_internal.h"
+#include "m2n_internal.h"
 
 #include "vm_stats.h"
 #include "dump.h"
diff --git a/drlvm/vm/vmcore/src/util/em64t/base_natives/java_lang_thread_em64t.cpp b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/natives/java_lang_thread.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/em64t/base_natives/java_lang_thread_em64t.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/natives/java_lang_thread.cpp
diff --git a/drlvm/vm/vmcore/src/util/em64t/base_natives/java_lang_thread_em64t.h b/drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/natives/java_lang_thread.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/em64t/base_natives/java_lang_thread_em64t.h
rename to drlvm/modules/vm/src/main/native/vmcore/shared/x86_64/util/natives/java_lang_thread.h
diff --git a/drlvm/modules/vm/src/main/native/vmcore/unix/exports.txt b/drlvm/modules/vm/src/main/native/vmcore/unix/exports.txt
new file mode 100644
index 0000000..bd34f9c
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/vmcore/unix/exports.txt
@@ -0,0 +1,684 @@
+advance_arg_iterator
+allocation_handle_get_class
+array_copy_jni
+array_first_element_offset_unboxed
+class_alloc_via_classloader
+class_element_size
+class_find_class_from_loader
+class_get_alignment
+class_get_alignment_unboxed
+class_get_allocation_handle
+class_get_array_element_class
+class_get_array_element_size
+class_get_array_of_class
+class_get_object_size
+class_get_class_loader
+class_get_class_of_primitive_type
+class_initialize
+class_cp_get_const_addr
+class_cp_get_const_string
+class_get_const_string_intern_addr
+class_cp_get_const_type
+class_cp_get_entry_signature
+class_cp_get_field_type
+class_get_declaring_class
+class_get_depth
+class_get_element_type_info
+class_is_support_fast_instanceof
+class_get_field
+class_get_field_by_name
+class_get_flags
+class_get_implements
+class_get_inner_class
+class_get_instance_field
+class_get_instance_field_recursive
+class_get_method
+class_get_method_by_name
+class_get_name
+class_cp_get_num_array_dimensions
+class_get_number_methods
+class_get_package_name
+class_get_primitive_type_of_class
+class_get_referent_offset
+class_get_source_file_name
+class_get_super_class
+class_get_super_offset
+class_get_vtable
+class_is_throwable
+class_is_array
+class_cp_is_entry_resolved
+class_is_enum
+class_is_finalizable
+class_is_initialized
+class_is_inner_class_public
+class_is_instanceof
+class_is_non_ref_array
+class_is_primitive
+class_is_reference
+class_is_valuetype
+class_load_class_by_descriptor
+vm_load_class_with_bootstrap
+vm_lookup_class_with_bootstrap
+class_lookup_method_recursively
+class_number_fields
+class_number_implements
+class_number_inner_classes
+class_num_instance_fields
+class_num_instance_fields_recursive
+class_is_abstract
+class_is_final
+class_is_interface
+vm_compiled_method_load
+compress_reference
+class_cp_get_class_name
+class_cp_get_entry_name
+class_cp_get_entry_descriptor
+class_cp_get_entry_class_name
+curr_arg
+vm_properties_destroy_keys
+vm_properties_destroy_value
+field_get_address
+field_get_class
+field_get_class_of_field_type
+field_get_descriptor
+field_get_flags
+field_get_name
+field_get_offset
+field_get_track_access_flag
+field_get_track_modification_flag
+field_get_type
+field_get_type_info
+field_is_final
+field_is_injected
+field_is_literal
+field_is_magic
+field_is_private
+field_is_public
+field_is_reference
+field_is_static
+field_is_unmanaged_static
+field_is_volatile
+gc_force_gc
+gc_free_memory
+gc_heap_base_address
+gc_heap_ceiling_address
+gc_max_memory
+gc_time_since_last_gc
+gc_total_memory
+vm_property_get_boolean
+get_curr_arg_class
+get_file_and_line
+vm_property_get_integer
+get_jvalue_arg_array
+get_method_entry_flag_address
+get_method_exit_flag_address
+vm_properties_get_keys
+vm_properties_get_keys_starting_with
+vm_properties_get_value
+vm_property_get_size
+vm_get_system_class_class
+vm_get_system_object_class
+vm_get_system_string_class
+class_loader_lookup_class
+class_loader_load_class
+class_loader_set_verifier_data_ptr
+class_loader_get_verifier_data_ptr
+class_loader_lock
+class_loader_unlock
+get_thread_ptr
+vm_get_interface
+initialize_arg_list_iterator
+log_exit
+log_abort
+log_printf
+log_header
+log_is_warn_enabled
+log_is_info_enabled
+log_is_trace_enabled
+log_cache
+is_it_finalize_thread
+vm_property_is_set
+Java_java_lang_ClassLoader_defineClass0
+Java_java_lang_ClassLoader_findLoadedClass
+Java_java_lang_ClassLoader_registerInitiatedClass
+Java_java_lang_EMThreadSupport_getTimeout
+Java_java_lang_EMThreadSupport_needProfilerThreadSupport
+Java_java_lang_EMThreadSupport_onTimeout
+Java_java_lang_FinalizerThread_doFinalization
+Java_java_lang_FinalizerThread_fillFinalizationQueueOnExit
+Java_java_lang_FinalizerThread_finalizerShutDown
+Java_java_lang_FinalizerThread_getFinalizersQuantity
+Java_java_lang_FinalizerThread_getNativeFinalizerThreadFlagFromVM
+Java_java_lang_FinalizerThread_getProcessorsQuantity
+Java_java_lang_FinalizerThread_isNativePartEnabled
+Java_java_lang_FinalizerThread_runFinalizationInNativeFinalizerThreads
+Java_java_lang_reflect_VMField_getBoolean
+Java_java_lang_reflect_VMField_getByte
+Java_java_lang_reflect_VMField_getChar
+Java_java_lang_reflect_VMField_getDouble
+Java_java_lang_reflect_VMField_getFloat
+Java_java_lang_reflect_VMField_getInt
+Java_java_lang_reflect_VMField_getLong
+Java_java_lang_reflect_VMField_getObject
+Java_java_lang_reflect_VMField_getShort
+Java_java_lang_reflect_VMField_setBoolean
+Java_java_lang_reflect_VMField_setByte
+Java_java_lang_reflect_VMField_setChar
+Java_java_lang_reflect_VMField_setDouble
+Java_java_lang_reflect_VMField_setFloat
+Java_java_lang_reflect_VMField_setInt
+Java_java_lang_reflect_VMField_setLong
+Java_java_lang_reflect_VMField_setObject
+Java_java_lang_reflect_VMField_setShort
+Java_java_lang_reflect_VMReflection_getExceptionTypes
+Java_java_lang_reflect_VMReflection_getFieldType
+Java_java_lang_reflect_VMReflection_getMethodReturnType
+Java_java_lang_reflect_VMReflection_getParameterTypes
+Java_java_lang_reflect_VMReflection_invokeMethod
+Java_java_lang_reflect_VMReflection_newArrayInstance
+Java_java_lang_reflect_VMReflection_newClassInstance
+Java_java_lang_Runtime_00024SubProcess_00024SubInputStream_available0
+Java_java_lang_Runtime_00024SubProcess_00024SubInputStream_close0
+Java_java_lang_Runtime_00024SubProcess_00024SubInputStream_readInputByte0
+Java_java_lang_Runtime_00024SubProcess_00024SubOutputStream_close0
+Java_java_lang_Runtime_00024SubProcess_00024SubOutputStream_flush0
+Java_java_lang_Runtime_00024SubProcess_00024SubOutputStream_writeOutputByte0
+Java_java_lang_Runtime_00024SubProcess_00024SubOutputStream_writeOutputBytes0
+Java_java_lang_Runtime_00024SubProcess_close0
+Java_java_lang_Runtime_00024SubProcess_createProcess0
+Java_java_lang_Runtime_00024SubProcess_destroy0
+Java_java_lang_Runtime_00024SubProcess_getState0
+Java_java_lang_System_rethrow
+Java_java_lang_System_setErrUnsecure
+Java_java_lang_System_setInUnsecure
+Java_java_lang_System_setOutUnsecure
+Java_java_lang_VMClassRegistry_getClassNative
+Java_java_lang_VMClassRegistry_getClassLoader0
+Java_java_lang_VMClassRegistry_getComponentType
+Java_java_lang_VMClassRegistry_getDeclaredClasses
+Java_java_lang_VMClassRegistry_getDeclaredConstructors
+Java_java_lang_VMClassRegistry_getDeclaredFields
+Java_java_lang_VMClassRegistry_getDeclaredMethods
+Java_java_lang_VMClassRegistry_getDeclaringClass
+Java_java_lang_VMClassRegistry_getEnclosingClass
+Java_java_lang_VMClassRegistry_getEnclosingMember
+Java_java_lang_VMClassRegistry_getInterfaces
+Java_java_lang_VMClassRegistry_getModifiers
+Java_java_lang_VMClassRegistry_getName
+Java_java_lang_VMClassRegistry_getSimpleName
+Java_java_lang_VMClassRegistry_getSuperclass
+Java_java_lang_VMClassRegistry_getSystemPackages
+Java_java_lang_VMClassRegistry_initializeClass
+Java_java_lang_VMClassRegistry_isArray
+Java_java_lang_VMClassRegistry_isAssignableFrom
+Java_java_lang_VMClassRegistry_isInstance
+Java_java_lang_VMClassRegistry_isPrimitive
+Java_java_lang_VMClassRegistry_linkClass
+Java_java_lang_VMClassRegistry_loadArray
+Java_java_lang_VMClassRegistry_loadBootstrapClass
+Java_java_lang_VMClassRegistry_loadLibrary
+Java_java_lang_VMExecutionEngine_currentTimeMillis
+Java_java_lang_VMExecutionEngine_exit
+Java_java_lang_VMExecutionEngine_getAssertionStatus
+Java_java_lang_VMExecutionEngine_getAvailableProcessors
+Java_java_lang_VMExecutionEngine_getProperties
+Java_java_lang_VMExecutionEngine_mapLibraryName
+Java_java_lang_VMExecutionEngine_nanoTime
+Java_java_lang_VMExecutionEngine_traceInstructions
+Java_java_lang_VMExecutionEngine_traceMethodCalls
+Java_java_lang_VMMemoryManager_arrayCopy
+Java_java_lang_VMMemoryManager_clone
+Java_java_lang_VMMemoryManager_getFreeMemory
+Java_java_lang_VMMemoryManager_getIdentityHashCode
+Java_java_lang_VMMemoryManager_getMaxMemory
+Java_java_lang_VMMemoryManager_getTotalMemory
+Java_java_lang_VMMemoryManager_runGC
+Java_java_lang_VMThreadManager_currentThreadNative
+Java_java_lang_VMThreadManager_getState
+Java_java_lang_VMThreadManager_holdsLock
+Java_java_lang_VMThreadManager_init
+Java_java_lang_VMThreadManager_interrupt
+Java_java_lang_VMThreadManager_isAlive
+Java_java_lang_VMThreadManager_isInterrupted__
+Java_java_lang_VMThreadManager_isInterrupted__Ljava_lang_Thread_2
+Java_java_lang_VMThreadManager_join
+Java_java_lang_VMThreadManager_notify
+Java_java_lang_VMThreadManager_notifyAll
+Java_java_lang_VMThreadManager_resume
+Java_java_lang_VMThreadManager_setPriority
+Java_java_lang_VMThreadManager_sleep
+Java_java_lang_VMThreadManager_start
+Java_java_lang_VMThreadManager_stop
+Java_java_lang_VMThreadManager_suspend
+Java_java_lang_VMThreadManager_wait
+Java_java_lang_VMThreadManager_yield
+Java_java_security_AccessController_getStackDomains
+Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8
+Java_java_util_concurrent_locks_LockSupport_park
+Java_java_util_concurrent_locks_LockSupport_parkNanos
+Java_java_util_concurrent_locks_LockSupport_parkUntil
+Java_java_util_concurrent_locks_LockSupport_unpark
+Java_org_apache_harmony_drlvm_thread_ThreadHelper_getThreadIdOffset
+Java_org_apache_harmony_drlvm_thread_ThreadHelper_getLockWordOffset
+Java_org_apache_harmony_drlvm_thread_ThreadHelper_getThreadJavaObjectOffset
+Java_org_apache_harmony_drlvm_VMHelperFastPath_getVtableIntfTableOffset
+Java_org_apache_harmony_drlvm_VMHelperFastPath_getVtableIntfTypeOffset
+Java_org_apache_harmony_drlvm_VMHelperFastPath_getVtableSuperclassesOffset
+Java_org_apache_harmony_drlvm_VMHelper_getCompressedModeObjectBaseOffset
+Java_org_apache_harmony_drlvm_VMHelper_getCompressedModeVTableBaseOffset
+Java_org_apache_harmony_drlvm_VMHelper_getPointerTypeSize
+Java_org_apache_harmony_drlvm_VMHelper_isCompressedRefsMode
+Java_org_apache_harmony_drlvm_VMHelper_isCompressedVTableMode
+Java_org_apache_harmony_drlvm_VMHelper_getObjectVtableOffset
+Java_org_apache_harmony_drlvm_VMHelper_getVtableClassOffset
+Java_org_apache_harmony_drlvm_VMHelper_getClassJLCHanldeOffset
+Java_org_apache_harmony_kernel_vm_VM_getClassLoader
+Java_org_apache_harmony_lang_management_ClassLoadingMXBeanImpl_getLoadedClassCountImpl
+Java_org_apache_harmony_lang_management_ClassLoadingMXBeanImpl_getTotalLoadedClassCountImpl
+Java_org_apache_harmony_lang_management_ClassLoadingMXBeanImpl_getUnloadedClassCountImpl
+Java_org_apache_harmony_lang_management_ClassLoadingMXBeanImpl_isVerboseImpl
+Java_org_apache_harmony_lang_management_ClassLoadingMXBeanImpl_setVerboseImpl
+Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_getTotalCompilationTimeImpl
+Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_isCompilationTimeMonitoringSupportedImpl
+Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_isJITEnabled
+Java_org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl_getCollectionCountImpl
+Java_org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl_getCollectionTimeImpl
+Java_org_apache_harmony_lang_management_MemoryManagerMXBeanImpl_createMemoryPools
+Java_org_apache_harmony_lang_management_MemoryManagerMXBeanImpl_isValidImpl
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_createMemoryManagers
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_getHeapMemoryUsageImpl
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_getNonHeapMemoryUsageImpl
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_getObjectPendingFinalizationCountImpl
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_isVerboseImpl
+Java_org_apache_harmony_lang_management_MemoryMXBeanImpl_setVerboseImpl
+Java_org_apache_harmony_lang_management_MemoryNotificationThread_processNotificationLoop
+Java_org_apache_harmony_lang_management_MemoryNotificationThreadShutdown_sendShutdownNotification
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getCollectionUsageImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getCollectionUsageThresholdCountImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getCollectionUsageThresholdImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getPeakUsageImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getUsageImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getUsageThresholdCountImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_getUsageThresholdImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_isCollectionUsageThresholdExceededImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_isCollectionUsageThresholdSupportedImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_isUsageThresholdExceededImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_isUsageThresholdSupportedImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_isValidImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_resetPeakUsageImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_setCollectionUsageThresholdImpl
+Java_org_apache_harmony_lang_management_MemoryPoolMXBeanImpl_setUsageThresholdImpl
+Java_org_apache_harmony_lang_management_RuntimeMXBeanImpl_getNameImpl
+Java_org_apache_harmony_lang_management_RuntimeMXBeanImpl_getStartTimeImpl
+Java_org_apache_harmony_lang_management_RuntimeMXBeanImpl_getUptimeImpl
+Java_org_apache_harmony_lang_management_RuntimeMXBeanImpl_isBootClassPathSupportedImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_createThreadInfoImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_findMonitorDeadlockedThreadsImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getAllThreadIdsImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getDaemonThreadCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getObjectThreadIsBlockedOnImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getPeakThreadCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadBlockedCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadBlockedTimeImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadByIdImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadCpuTimeImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadOwningObjectImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadUserTimeImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadWaitedCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getThreadWaitedTimeImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_getTotalStartedThreadCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isCurrentThreadCpuTimeSupportedImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isSuspendedImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isThreadContentionMonitoringEnabledImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isThreadContentionMonitoringSupportedImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isThreadCpuTimeEnabledImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_isThreadCpuTimeSupportedImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_resetPeakThreadCountImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_setThreadContentionMonitoringEnabledImpl
+Java_org_apache_harmony_lang_management_ThreadMXBeanImpl_setThreadCpuTimeEnabledImpl
+Java_org_apache_harmony_util_concurrent_Atomics_arrayBaseOffset
+Java_org_apache_harmony_util_concurrent_Atomics_arrayIndexScale
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean___3ZIZZ
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean__Ljava_lang_Object_2JZZ
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt___3IIII
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt__Ljava_lang_Object_2JII
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong___3JIJJ
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong__Ljava_lang_Object_2JJJ
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject___3Ljava_lang_Object_2ILjava_lang_Object_2Ljava_lang_Object_2
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject__Ljava_lang_Object_2JLjava_lang_Object_2Ljava_lang_Object_2
+Java_org_apache_harmony_util_concurrent_Atomics_getFieldOffset
+Java_org_apache_harmony_util_concurrent_Atomics_getIntVolatile__Ljava_lang_Object_2J
+Java_org_apache_harmony_util_concurrent_Atomics_getLongVolatile__Ljava_lang_Object_2J
+Java_org_apache_harmony_util_concurrent_Atomics_getObjectVolatile__Ljava_lang_Object_2J
+Java_org_apache_harmony_util_concurrent_Atomics_setIntVolatile__Ljava_lang_Object_2JI
+Java_org_apache_harmony_util_concurrent_Atomics_setLongVolatile__Ljava_lang_Object_2JJ
+Java_org_apache_harmony_util_concurrent_Atomics_setObjectVolatile__Ljava_lang_Object_2JLjava_lang_Object_2
+Java_org_apache_harmony_vm_VMDebug_print
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getDeclaredAnnotations__J
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getDeclaredAnnotations__Ljava_lang_Class_2
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getDefaultValue
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getParameterAnnotations
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getSignature__J
+Java_org_apache_harmony_vm_VMGenericsAndAnnotations_getSignature__Ljava_lang_Class_2
+Java_org_apache_harmony_vm_VMStack_getCallerClass
+Java_org_apache_harmony_vm_VMStack_getClasses
+Java_org_apache_harmony_vm_VMStack_getStackClasses
+Java_org_apache_harmony_vm_VMStack_getStackState
+Java_org_apache_harmony_vm_VMStack_getStackTrace
+Java_org_apache_harmony_vm_VMStack_getThreadStackTrace
+JIT_execute_method_default
+jit_get_comp_handle
+jit_may_inline_object_synchronization
+jni_class_from_handle
+jni_class_loader_from_handle
+JNI_CreateJavaVM
+jni_get_class_handle
+JNI_GetCreatedJavaVMs
+JNI_GetDefaultJavaVMInitArgs
+jthread_attach
+jthread_cancel_all
+jthread_clear_interrupted
+jthread_create
+jthread_create_with_function
+jthread_detach
+jthread_exception_stop
+jthread_get_all_threads
+jthread_get_blocked_count
+jthread_get_contended_monitor
+jthread_get_deadlocked_threads
+jthread_get_id
+jthread_get_java_thread
+jthread_get_JNI_env
+jthread_get_jvmti_local_storage
+jthread_get_jvmti_state
+jthread_get_lock_owner
+jthread_get_lock_recursion
+jthread_get_native_thread
+jthread_get_owned_monitors
+jthread_get_peak_thread_count
+jthread_get_priority
+jthread_get_thread
+jthread_get_thread_blocked_time
+jthread_get_thread_blocked_times_count
+jthread_get_thread_count
+jthread_get_thread_cpu_time
+jthread_get_thread_cpu_timer_info
+jthread_get_thread_user_cpu_time
+jthread_get_thread_waited_time
+jthread_get_thread_waited_times_count
+jthread_get_tm_data
+jthread_get_total_started_thread_count
+jthread_get_vm_thread_ptr_safe
+jthread_get_waited_count
+jthread_get_wait_monitor
+jthread_holds_lock
+jthread_interrupt
+jthread_is_current_thread_cpu_time_supported
+jthread_is_interrupted
+jthread_is_thread_contention_monitoring_enabled
+jthread_is_thread_contention_monitoring_supported
+jthread_is_thread_cpu_time_enabled
+jthread_is_thread_cpu_time_supported
+jthread_iterator_create
+jthread_iterator_next
+jthread_iterator_release
+jthread_iterator_reset
+jthread_iterator_size
+jthread_java_detach
+jthread_monitor_enter
+jthread_monitor_exit
+jthread_monitor_init
+jthread_monitor_notify
+jthread_monitor_notify_all
+jthread_monitor_timed_wait
+jthread_monitor_try_enter
+jthread_monitor_wait
+jthread_park
+jthread_park_until
+jthread_raw_monitor_create
+jthread_raw_monitor_destroy
+jthread_raw_monitor_enter
+jthread_raw_monitor_exit
+jthread_raw_monitor_notify
+jthread_raw_monitor_notify_all
+jthread_raw_monitor_try_enter
+jthread_raw_monitor_wait
+jthread_reset_peak_thread_count
+jthread_resume
+jthread_resume_all
+jthread_self
+jthread_set_priority
+jthread_set_thread_contention_monitoring_enabled
+jthread_set_thread_cpu_time_enabled
+jthread_set_tm_data
+jthread_sleep
+jthread_stop
+jthread_suspend
+jthread_suspend_all
+jthread_thread_init
+jthread_timed_park
+jthread_unpark
+jthread_vm_detach
+jthread_wait_for_all_nondaemon_threads
+jthread_yield
+jvmti_process_native_method_bind_event
+jvmti_send_contended_enter_or_entered_monitor_event
+jvmti_send_thread_start_end_event
+jvmti_send_waited_monitor_event
+jvmti_send_wait_monitor_event
+method_allocate_code_block
+method_allocate_data_block
+method_allocate_info_block
+method_allocate_jit_data_block
+method_args_get_number
+method_args_get_type_info
+method_get_overriding_method
+method_get_argument_list
+method_get_bytecode
+method_get_bytecode_length
+method_get_class
+method_get_code_block_jit
+method_get_code_block_size_jit
+method_get_code_block_addr_jit_new
+method_get_code_block_size_jit_new
+method_get_descriptor
+method_get_exc_handler_info
+method_get_indirect_address
+method_get_info_block_jit
+method_get_info_block_size_jit
+method_get_JIT_id
+method_get_max_locals
+method_get_max_stack
+method_get_name
+method_get_native_func_addr
+method_get_exc_handler_number
+method_get_vtable_offset
+method_get_return_type
+method_get_side_effects
+method_get_signature
+method_has_annotation
+method_is_abstract
+method_is_final
+method_is_java
+method_is_native
+method_is_no_inlining
+method_is_overridden
+method_is_private
+method_is_require_security_object
+method_is_static
+method_is_strict
+method_is_synchronized
+method_lock
+method_ret_type_get_type_info
+method_set_inline_assumption
+method_set_num_target_handlers
+method_set_side_effects
+method_set_target_handler_info
+method_unlock
+method_uses_fastcall
+object_get_vtable_offset
+port_atomic_cas64
+port_vmem_page_sizes
+port_CPUs_number
+resolve_class
+resolve_class_new
+resolve_field
+resolve_interface_method
+class_resolve_method
+resolve_nonstatic_field
+resolve_special_method
+resolve_static_field
+resolve_static_method
+resolve_virtual_method
+set_native_finalizer_thread_flag
+set_native_ref_enqueue_thread_flag
+vm_properties_set_value
+st_alloc_frames
+type_info_create_from_java_descriptor
+type_info_get_class
+type_info_get_class_no_exn
+type_info_get_method_sig
+type_info_get_num_array_dimensions
+type_info_get_type
+type_info_get_type_info
+type_info_get_type_name
+type_info_is_general_array
+type_info_is_method_pointer
+type_info_is_primitive
+type_info_is_reference
+type_info_is_resolved
+type_info_is_unboxed
+type_info_is_unmanaged_pointer
+type_info_is_vector
+type_info_is_void
+uncompress_compressed_reference
+vector_first_element_offset
+vector_first_element_offset_class_handle
+vector_first_element_offset_unboxed
+vector_first_element_offset_vtable_handle
+vector_get_element_address_ref
+vector_get_length
+vector_length_offset
+verify_object_header
+vm_attach
+vm_check_if_monitor
+vm_compile_method
+vm_create_helper_for_function
+vm_detach
+vm_enqueue_reference
+vm_enumerate_compressed_root_reference
+vm_enumerate_root_interior_pointer
+vm_enumerate_root_reference
+vm_enumerate_root_set_all_threads
+vm_enumerate_weak_root_reference
+vm_finalize_object
+vm_gc_lock_enum
+vm_gc_lock_init
+vm_gc_unlock_enum
+vm_get_gc_thread_local
+vm_helper_get_addr
+vm_helper_get_addr_optimized
+vm_get_vtable_base_address
+vm_get_vtable_ptr_size
+vm_get_heap_base_address
+vm_get_heap_ceiling_address
+vm_heavy_finalizer_block_mutator
+vm_helper_get_by_name
+vm_helper_get_calling_convention
+vm_helper_get_interruptibility_kind
+vm_helper_get_magic_helper
+vm_helper_get_name
+vm_helper_get_numargs
+vm_helper_register_magic_helper
+vm_hint_finalize
+vm_instanceof_class
+vm_iterate_object
+vm_load_jit
+vm_managed_calling_convention
+vm_max_fast_instanceof_depth
+vm_notify_obj_alive
+vm_number_of_gc_bytes_in_thread_local
+vm_number_of_gc_bytes_in_vtable
+vm_objects_are_equal
+vm_patch_code_block
+vm_reclaim_native_objs
+vm_recompile_method
+vm_is_heap_compressed
+vm_register_jit_extended_class_callback
+vm_register_jit_overridden_method_callback
+vm_register_jit_recompiled_method_callback
+vm_resolve_class
+vm_resolve_class_new
+vm_resume_threads_after
+vm_vector_size
+vm_is_vtable_compressed
+vtable_get_class
+vtable_get_super_array_offset
+# Workaround for LogParams::release C++ function used by EM
+*LogParams*
+# Workaround for EncoderBase used by JIT
+*EncoderBase*
+# Workaround for encoder API used by JIT
+*getOpndKindString*
+*getOpndSize*
+*getRegName*
+*getOpndKind*
+# Workaround for VM_Global_State used by GC_GEN
+*VM_Global_State*
+# Workaround for apr API used by GC_GEN
+apr_atomic_dec32
+apr_atomic_inc32
+apr_atomic_cas32
+apr_atomic_add32
+apr_atomic_set32
+apr_sleep
+apr_time_now
+apr_atomic_casptr
+port_rw_barrier
+# Workaround for API used by GC_CC
+apr_atomic_xchg32
+*MemoryPool*
+# Workaround for ManagedObject::_tag_pointer used in interpreter
+*ManagedObject*
+# Workaround for C++ functions unspecified in interface used by interpreter
+*class_alloc_new_object*
+*oh_allocate_local_handle*
+*vm_instantiate_cp_string_resolved*
+*vm_new_vector_primitive*
+*vm_new_vector*
+*m2n_get_last_frame*
+*get_current_thread_exception*
+*class_name_get_java_name*
+*exn_create*
+*exn_raised*
+*vm_instanceof*
+*vm_new_vector*
+*exn_raise_object*
+*m2n_set_last_frame*
+*get_jni_native_intf*
+*oh_enumerate_handles*
+*m2n_get_local_handles*
+*m2n_set_local_handles*
+*m2n_get_previous_frame*
+*classloader_find_native*
+*class_name_get_java_name*
+*get_available_stack_size*
+*free_local_object_handles*
+*vm_ti_enumerate_stack_root*
+*class_lookup_method_recursive*
+*jvmti_process_frame_pop_event*
+*check_current_thread_exception*
+*clear_current_thread_exception*
+*jvmti_process_method_exit_event*
+*jvmti_process_single_step_event*
+*jvmti_process_method_entry_event*
+*jvmti_process_field_modification_event*
+*class_throw_linking_error_for_interpreter*
+*jvmti_process_interpreter_breakpoint_event*
+*jvmti_interpreter_exception_event_callback_call*
+*vm_enumerate_root_set_single_thread_not_on_stack*
+*jvmti_interpreter_exception_catch_event_callback_call*
+*NativeObjectHandles*
+*interpreter_table*
+_tag_pointer
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/Runtime_lnx.cpp b/drlvm/modules/vm/src/main/native/vmcore/unix/kernel_classes/Runtime.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/Runtime_lnx.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/unix/kernel_classes/Runtime.cpp
diff --git a/drlvm/modules/vm/src/main/native/vmcore/unix/makefile b/drlvm/modules/vm/src/main/native/vmcore/unix/makefile
new file mode 100644
index 0000000..fc02c22
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/vmcore/unix/makefile
@@ -0,0 +1,165 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'vmcore'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/vmcore/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE \
+  -DAPR_DECLARE_EXPORT -DBUILDING_VM
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+WARNFLAGS := # TOFIX
+
+HDKINCLUDES := \
+  $(HY_HDK)/include/platform_lowlevel.h \
+  $(HY_HDK)/include/m2n_internal.h
+
+INCLUDES := \
+  -Iutil/include \
+  -I$(SHAREDSUB)$(HY_ARCH)/lil/include \
+  -I$(SHAREDSUB)$(HY_ARCH)/lil \
+  -I$(SHAREDSUB)$(HY_ARCH)/util/natives \
+  -I$(SHAREDSUB)kernel_classes \
+  -I$(VM_HOME)include -I$(VM_HOME)port/include \
+  -I$(VM_HOME)vmcore/include $(INCLUDES)
+
+BUILDFILES := \
+  class_support/Assertion_Registry.o class_support/C_Interface.o \
+  class_support/Class_File_Loader.o class_support/class_impl.o \
+  class_support/classloader.o class_support/Class.o \
+  class_support/Environment.o class_support/Initialize.o \
+  class_support/inline_info.o class_support/java_type.o \
+  class_support/manifest.o class_support/method.o \
+  class_support/Prepare.o class_support/Resolve.o \
+  class_support/String_Pool.o class_support/type_access.o \
+  class_support/type.o class_support/Verifier_stub.o \
+  compmgr/component_manager_impl.o \
+  exception/exceptions_impl.o exception/exceptions_int.o \
+  exception/exceptions_jit.o exception/exceptions.o \
+  gc/dll_gc.o gc/root_set_enum_common.o gc/stop_the_world_root_set_enum.o \
+  init/finalize.o init/finalizer_thread.o init/parse_arguments.o \
+  init/properties.o init/ref_enqueue_thread.o init/vm_init.o init/vm.o \
+  init/vm_properties.o init/vm_shutdown.o \
+  interpreter/interp_exports.o interpreter/interp_imports.o \
+  jit/bit_vector.o jit/compile.o jit/dll_jit.o jit/dump.o jit/ini.o \
+  jit/jit_runtime_support.o jit/native_overrides.o jit/primitives_support.o \
+  jit/rt_helper_info.o \
+  jni/jni_array.o jni/jni_field.o jni/jni_method.o jni/jni.o jni/jni_utils.o \
+  jvmti/jvmti_break_intf.o jvmti/jvmti_break.o jvmti/jvmti_capability.o \
+  jvmti/jvmti_class.o jvmti/jvmti_dasm.o jvmti/jvmti_enumerate.o \
+  jvmti/jvmti_event.o jvmti/jvmti_extension.o jvmti/jvmti_field.o \
+  jvmti/jvmti_general.o jvmti/jvmti_heap.o jvmti/jvmti_internal.o \
+  jvmti/jvmti_jni.o jvmti/jvmti_locals.o jvmti/jvmti_mem.o \
+  jvmti/jvmti_method.o jvmti/jvmti.o jvmti/jvmti_object.o \
+  jvmti/jvmti_pop_frame.o jvmti/jvmti_property.o jvmti/jvmti_rawmon.o \
+  jvmti/jvmti_roots.o jvmti/jvmti_stack.o jvmti/jvmti_step.o \
+  jvmti/jvmti_tags.o jvmti/jvmti_thread_group.o jvmti/jvmti_thread.o \
+  jvmti/jvmti_timer.o jvmti/jvmti_trace.o jvmti/jvmti_watch.o \
+  kernel_classes/java_lang_EMThreadSupport.o \
+  kernel_classes/java_lang_FinalizerThread.o \
+  kernel_classes/java_lang_reflect_VMField.o \
+  kernel_classes/java_lang_reflect_VMReflection.o \
+  kernel_classes/java_lang_System.o \
+  kernel_classes/java_lang_VMClassRegistry.o \
+  kernel_classes/java_lang_VMExecutionEngine.o \
+  kernel_classes/java_lang_VMMemoryManager.o \
+  kernel_classes/java_lang_VMThreadManager.o \
+  kernel_classes/java_util_concurrent_locks_LockSupport.o \
+  kernel_classes/org_apache_harmony_drlvm_VMHelperFastPath.o \
+  kernel_classes/org_apache_harmony_drlvm_VMHelper.o \
+  kernel_classes/org_apache_harmony_kernel_vm_VM.o \
+  kernel_classes/org_apache_harmony_lang_management_ClassLoadingMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_CompilationMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_GarbageCollectorMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_MemoryManagerMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_MemoryMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThread.o \
+  kernel_classes/org_apache_harmony_lang_management_MemoryNotificationThreadShutdown.o \
+  kernel_classes/org_apache_harmony_lang_management_MemoryPoolMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_RuntimeMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_lang_management_ThreadMXBeanImpl.o \
+  kernel_classes/org_apache_harmony_util_concurrent_Atomics.o \
+  kernel_classes/org_apache_harmony_vm_VMDebug.o \
+  kernel_classes/org_apache_harmony_vm_VMGenericsAndAnnotations.o \
+  kernel_classes/org_apache_harmony_vm_VMStack.o \
+  kernel_classes/Runtime.o \
+  lil/lil_code_generator.o lil/lil_code_generator_arch.o \
+  lil/lil_code_generator_utils.o lil/lil.o \
+  lil/m2n.o lil/stack_iterator/m2n.o lil/stack_iterator.o \
+  lil/stack_iterator/stack_iterator.o ncai/ncai_break.o ncai/ncai_event.o \
+  ncai/ncai_memory.o ncai/ncai_methods.o ncai/ncai_modules.o \
+  ncai/ncai_modules_os.o ncai/ncai.o ncai/ncai_registers.o \
+  ncai/ncai_signals.o ncai/ncai_stack.o ncai/ncai_step_arch.o \
+  ncai/ncai_step.o ncai/ncai_thread.o ncai/ncai_utils.o \
+  ncai/ncai_utils_os.o \
+  object/object_handles.o object/vm_arrays.o \
+  reflection/annotations.o reflection/reflection.o \
+  stack/native_stack.o stack/stack_trace.o \
+  thread/atomics_common.o thread/lock_manager.o thread/mon_enter_exit.o \
+  thread/object_generic.o thread/thread_dump.o thread/thread_generic.o \
+  thread/thread_helpers.o thread/thread_java_attrs.o \
+  thread/thread_java_basic.o thread/thread_java_interrupt.o \
+  thread/thread_java_iterator.o thread/thread_java_monitors.o \
+  thread/thread_java_park.o thread/thread_java_suspend.o \
+  thread/thread_manager.o thread/thread_ti_instr.o \
+  thread/thread_ti_monitors.o thread/thread_ti_others.o \
+  thread/thread_ti_timing.o thread/verify_stack_enumeration.o \
+  util/bytereader.o util/compile.o util/crash_dump.o \
+  util/crash_dump_os.o util/ini.o util/jarfile_support.o \
+  util/jit_lock_rt_support.o util/jit_runtime_support.o \
+  util/mem_alloc.o util/natives/java_lang_thread.o util/natives_support.o \
+  util/os_wrapper.o util/signals.o util/vm_stats.o \
+  util/vm_strings.o
+
+ifeq ($(HY_ARCH),x86)
+BUILDFILES += util/optimize.o
+endif
+
+MDLLIBFILES += $(LIBPATH)libport.a $(LIBPATH)libencoder.a \
+  $(LIBPATH)libapr-1.a $(LIBPATH)libverifier.a \
+  $(DLLPATH)default/libch$(HY_LINKLIB_SUFFIX) \
+  $(DLLPATH)default/libicuuc$(HY_LINKLIB_SUFFIX)
+
+OSLIBS += $(STDCLIBS)
+
+ifeq ($(HY_LOCAL_ZLIB),true)
+OSLIBS += -lz
+else
+MDLLIBFILES +=   $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX)
+endif
+
+DLLNAME = $(DLLPATH)default/libharmonyvm$(HY_SHLIB_SUFFIX)
+EXPNAME = VMCORE_0.1
+
+AS := $(CXX)
+ASFLAGS := -Wa,--fatal-warnings -c -x assembler-with-cpp -g
+
+include $(HY_HDK)/build/make/rules.mk
+
+$(HY_HDK)/include/%.h: util/include/%.h
+	mkdir -p $(HY_HDK)/include
+	cp -p $< $@
+
+$(HY_HDK)/include/%.h: $(SHAREDSUB)$(HY_ARCH)/lil/%.h
+	mkdir -p $(HY_HDK)/include
+	cp -p $< $@
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp b/drlvm/modules/vm/src/main/native/vmcore/unix/ncai/ncai_modules_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/unix/ncai/ncai_modules_os.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_utils_linux.cpp b/drlvm/modules/vm/src/main/native/vmcore/unix/ncai/ncai_utils_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_utils_linux.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/unix/ncai/ncai_utils_os.cpp
diff --git a/drlvm/vm/vmcore/src/util/linux/crash_dump_os.cpp b/drlvm/modules/vm/src/main/native/vmcore/unix/util/crash_dump_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/linux/crash_dump_os.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/unix/util/crash_dump_os.cpp
diff --git a/drlvm/vm/vmcore/src/util/linux/include/platform_lowlevel.h b/drlvm/modules/vm/src/main/native/vmcore/unix/util/include/platform_lowlevel.h
similarity index 96%
rename from drlvm/vm/vmcore/src/util/linux/include/platform_lowlevel.h
rename to drlvm/modules/vm/src/main/native/vmcore/unix/util/include/platform_lowlevel.h
index 9aa1ff9..65a1f5e 100644
--- a/drlvm/vm/vmcore/src/util/linux/include/platform_lowlevel.h
+++ b/drlvm/modules/vm/src/main/native/vmcore/unix/util/include/platform_lowlevel.h
@@ -29,7 +29,7 @@
 #endif
 
 #define __fastcall
-#if defined(_IPF_) || defined(_EM64T_)
+#if defined(_IPF_) || defined(HYX86_64)
 #define __stdcall
 #else
 #define __stdcall  __attribute__ ((__stdcall__))
diff --git a/drlvm/vm/vmcore/src/util/linux/include/vm_process.h b/drlvm/modules/vm/src/main/native/vmcore/unix/util/include/vm_process.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/linux/include/vm_process.h
rename to drlvm/modules/vm/src/main/native/vmcore/unix/util/include/vm_process.h
diff --git a/drlvm/vm/vmcore/src/util/linux/os_wrapper.cpp b/drlvm/modules/vm/src/main/native/vmcore/unix/util/os_wrapper.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/linux/os_wrapper.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/unix/util/os_wrapper.cpp
diff --git a/drlvm/vm/vmcore/src/kernel_classes/native/Runtime_win.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/kernel_classes/Runtime.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/kernel_classes/native/Runtime_win.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/kernel_classes/Runtime.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/ncai/ncai_modules_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/ncai/ncai_modules_os.cpp
diff --git a/drlvm/vm/vmcore/src/ncai/utils/ncai_utils_win.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/ncai/ncai_utils_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/ncai/utils/ncai_utils_win.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/ncai/ncai_utils_os.cpp
diff --git a/drlvm/vm/vmcore/src/util/win/crash_dump_os.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/util/crash_dump_os.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/win/crash_dump_os.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/util/crash_dump_os.cpp
diff --git a/drlvm/vm/vmcore/src/util/win/include/platform_lowlevel.h b/drlvm/modules/vm/src/main/native/vmcore/windows/util/include/platform_lowlevel.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/win/include/platform_lowlevel.h
rename to drlvm/modules/vm/src/main/native/vmcore/windows/util/include/platform_lowlevel.h
diff --git a/drlvm/vm/vmcore/src/util/win/include/vm_process.h b/drlvm/modules/vm/src/main/native/vmcore/windows/util/include/vm_process.h
similarity index 100%
rename from drlvm/vm/vmcore/src/util/win/include/vm_process.h
rename to drlvm/modules/vm/src/main/native/vmcore/windows/util/include/vm_process.h
diff --git a/drlvm/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/util/ipf/nt_exception_filter.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/util/ipf/nt_exception_filter.cpp
diff --git a/drlvm/vm/vmcore/src/util/win/nt_platform_utils.cpp b/drlvm/modules/vm/src/main/native/vmcore/windows/util/nt_platform_utils.cpp
similarity index 100%
rename from drlvm/vm/vmcore/src/util/win/nt_platform_utils.cpp
rename to drlvm/modules/vm/src/main/native/vmcore/windows/util/nt_platform_utils.cpp
diff --git a/drlvm/vm/vmi/src/j9vmls.cpp b/drlvm/modules/vm/src/main/native/vmi/shared/j9vmls.cpp
similarity index 100%
rename from drlvm/vm/vmi/src/j9vmls.cpp
rename to drlvm/modules/vm/src/main/native/vmi/shared/j9vmls.cpp
diff --git a/drlvm/vm/vmi/src/vmi.cpp b/drlvm/modules/vm/src/main/native/vmi/shared/vmi.cpp
similarity index 100%
rename from drlvm/vm/vmi/src/vmi.cpp
rename to drlvm/modules/vm/src/main/native/vmi/shared/vmi.cpp
diff --git a/drlvm/modules/vm/src/main/native/vmi/unix/exports.txt b/drlvm/modules/vm/src/main/native/vmi/unix/exports.txt
new file mode 100644
index 0000000..375950d
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/vmi/unix/exports.txt
@@ -0,0 +1,2 @@
+VMI_GetVMIFromJavaVM
+VMI_GetVMIFromJNIEnv
diff --git a/drlvm/modules/vm/src/main/native/vmi/unix/makefile b/drlvm/modules/vm/src/main/native/vmi/unix/makefile
new file mode 100644
index 0000000..e87a7b4
--- /dev/null
+++ b/drlvm/modules/vm/src/main/native/vmi/unix/makefile
@@ -0,0 +1,38 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Makefile for module 'vmi'
+#
+
+HY_BIN=$(HY_TARGET)/build/drlvm/vm/native/vmi/
+include $(HY_TARGET)/hdk/build/make/defines.mk
+VM_HOME=../../../../../../../vm/
+
+DEFINES += \
+  -DREFS_USE_UNCOMPRESSED -DPLATFORM_POSIX \
+  -D__SMP__ -DLINUX_TLS_OPT -D_LARGEFILE64_SOURCE
+
+OPT += -fexceptions
+CXXFLAGS += -Wno-deprecated
+
+INCLUDES := -I$(VM_HOME)include -I$(VM_HOME)port/include \
+            -I$(VM_HOME)vmcore/include $(INCLUDES)
+
+BUILDFILES := j9vmls.o vmi.o
+DLLNAME = $(DLLPATH)default/libvmi$(HY_SHLIB_SUFFIX)
+EXPNAME = VMI_0.1
+
+include $(HY_HDK)/build/make/rules.mk
diff --git a/drlvm/vm/include/open/hycomp.h b/drlvm/vm/include/open/hycomp.h
index 3487e07..efd5981 100644
--- a/drlvm/vm/include/open/hycomp.h
+++ b/drlvm/vm/include/open/hycomp.h
@@ -78,7 +78,7 @@
  * </ul>
  */
 #if defined(LINUX) || defined(FREEBSD)
-#if defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86_64) || defined(_IPF_)
 typedef long int I_64;
 typedef unsigned long int U_64;
 #else
diff --git a/drlvm/vm/include/open/hythread.h b/drlvm/vm/include/open/hythread.h
index 9f25b6d..e0a306f 100644
--- a/drlvm/vm/include/open/hythread.h
+++ b/drlvm/vm/include/open/hythread.h
@@ -479,7 +479,7 @@
 
 #if defined (_WIN32)
 #   define HYTHREAD_FAST_TLS_ATTRIBUTE
-#   if defined(_IA32_)
+#   if defined(HYX86)
 #       define HYTHREAD_FAST_TLS (1)
         // FIXME suggested to drop FS14_TLS_USE in favor of common HYTHREAD_FAST_TLS
 #       define FS14_TLS_USE
@@ -489,7 +489,7 @@
 #elif defined(__linux__)
     // some kind of nix - the threads internals are known for IA32/Intel64
     // kernels, will use slow way on other HWs (TODO: add IPF support)
-#   if defined(_IA32_) || defined(_EM64T_)
+#   if defined(HYX86) || defined(HYX86_64)
 #       define HYTHREAD_FAST_TLS (1)
 #       define HYTHREAD_FAST_TLS_ATTRIBUTE __attribute__((tls_model("initial-exec")))
 #   endif
diff --git a/drlvm/vm/include/open/platform_types.h b/drlvm/vm/include/open/platform_types.h
index c603b75..88959ea 100644
--- a/drlvm/vm/include/open/platform_types.h
+++ b/drlvm/vm/include/open/platform_types.h
@@ -164,7 +164,7 @@
 
 #else  // !_IPF_
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 
 struct Registers {
     uint64 rsp;
@@ -198,7 +198,7 @@
 #endif
 }; //Registers
 
-#else // ! _EM64T_
+#else // ! HYX86_64
 
 struct Registers {
     U_32 eax;
@@ -221,7 +221,7 @@
 #endif
 }; //Registers
 
-#endif // _EM64T_
+#endif // HYX86_64
 
 #endif //!_IPF_
 
diff --git a/drlvm/vm/include/open/rt_types.h b/drlvm/vm/include/open/rt_types.h
index a57670f..c008762 100644
--- a/drlvm/vm/include/open/rt_types.h
+++ b/drlvm/vm/include/open/rt_types.h
@@ -172,7 +172,7 @@
         uint64 ar_lc;
     } JitFrameContext; //JitFrameContext
 
-#elif defined _EM64T_
+#elif defined HYX86_64
 
     typedef
     struct JitFrameContext {
@@ -204,7 +204,7 @@
         Boolean is_ip_past;
     } JitFrameContext;
 
-#else // "_IA32_"
+#else // "HYX86"
 
     typedef
     struct JitFrameContext {
@@ -228,7 +228,7 @@
         Boolean is_ip_past;
     } JitFrameContext;
 
-#endif // "_IA32_"
+#endif // "HYX86"
 
     // end Frame Contexts for JITs
     ///////////////////////////////////////////////////////
diff --git a/drlvm/vm/port/include/port_atomic.h b/drlvm/vm/port/include/port_atomic.h
index e82eaad..e528d18 100644
--- a/drlvm/vm/port/include/port_atomic.h
+++ b/drlvm/vm/port/include/port_atomic.h
@@ -146,7 +146,7 @@
     return InterlockedCompareExchangePointer((volatile PVOID *) data, value, (PVOID) comp);
 }
 
-#elif defined(_EM64T_) && defined (_WIN64)
+#elif defined(HYX86_64) && defined (_WIN64)
 
 #pragma intrinsic(_InterlockedCompareExchange16)
 #pragma intrinsic(_InterlockedCompareExchange64)
@@ -173,7 +173,7 @@
 #elif defined (PLATFORM_POSIX)  
 
 PORT_INLINE U_8 port_atomic_cas8(volatile U_8 * data , U_8 value, U_8 comp) {
-#if defined(_IA32_) || defined(_EM64T_)
+#if defined(HYX86) || defined(HYX86_64)
     __asm__ __volatile__(
         "lock cmpxchgb %1, (%2)"
         :"=a"(comp)
@@ -187,7 +187,7 @@
 
 PORT_INLINE uint16 port_atomic_cas16(volatile uint16 * data , uint16 value, uint16 comp) {
     uint16 ret;
-#if defined(_IA32_) || defined(_EM64T_)
+#if defined(HYX86) || defined(HYX86_64)
     __asm__ __volatile__(
         "lock cmpxchgw %w1, %2"
         :"=a"(ret)
@@ -201,7 +201,7 @@
 }
 
 PORT_INLINE uint64 port_atomic_cas64(volatile uint64 * data , uint64 value, uint64 comp) {
-#if defined(_IA32_)
+#if defined(HYX86)
     __asm__ __volatile__(
         "push %%ebx;\n\t"
         "lea %0, %%esi;\n\t"
@@ -221,7 +221,7 @@
         :"%eax", "%ecx", "%edx", "%esi", "memory" /* clobbers */
     );
     return comp;
-#elif defined(_EM64T_) // defined(_IA32_)
+#elif defined(HYX86_64) // defined(HYX86)
     __asm__ __volatile__(
         "lock cmpxchgq %1, (%2)"
         :"=a"(comp) /* outputs */
@@ -234,7 +234,7 @@
 }
 
 PORT_INLINE void * port_atomic_casptr(volatile void ** data, void * value, const void * comp) {
-#if defined(_IA32_)
+#if defined(HYX86)
     U_32 Exchange = (U_32)value;
     U_32 Comperand = (U_32)comp;
     __asm__ __volatile__(
@@ -244,7 +244,7 @@
         );
     return (void*)Comperand;
 
-#elif defined(_EM64T_) // defined(_IA32_)
+#elif defined(HYX86_64) // defined(HYX86)
     uint64 Exchange = (uint64)value;
     uint64 Comperand = (uint64)comp;
     __asm__(
@@ -254,7 +254,7 @@
         );
     return (void *)Comperand;
 
-#else // defined(_EM64T_)
+#else // defined(HYX86_64)
     ABORT("Not supported");
 #endif
 }
diff --git a/drlvm/vm/port/include/port_barriers.h b/drlvm/vm/port/include/port_barriers.h
index 3da5201..fcb4d2e 100644
--- a/drlvm/vm/port/include/port_barriers.h
+++ b/drlvm/vm/port/include/port_barriers.h
@@ -59,7 +59,7 @@
 #if !defined(_IPF_)
 PORT_INLINE void port_rw_barrier(void)
 {
-#if defined(_EM64T_)
+#if defined(HYX86_64)
     asm volatile ("mfence" : : : "memory");
 #else /* General x86 case */
     /*
@@ -113,7 +113,7 @@
 
 PORT_INLINE void port_rw_barrier(void)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     /* if x86_64/x64/EM64T, then use an mfence to flush memory caches */
     _mm_mfence();
 #else
diff --git a/drlvm/vm/port/include/port_general.h b/drlvm/vm/port/include/port_general.h
index 1fbac3c..da8d6bb 100644
--- a/drlvm/vm/port/include/port_general.h
+++ b/drlvm/vm/port/include/port_general.h
@@ -57,15 +57,15 @@
 
 #endif /* __cplusplus */
 
-#ifdef _IA32_
+#ifdef HYX86
 #ifdef WIN32
 #define PORT_CDECL __cdecl
 #else /* !WIN32 */
 #define PORT_CDECL __attribute__ ((cdecl))
 #endif /* WIN32 */
-#else /* _IA32_ */
+#else /* HYX86 */
 #define PORT_CDECL
-#endif /* _IA32_ */
+#endif /* HYX86 */
 
 
 #endif /* _PORT_GENERAL_H_ */
diff --git a/drlvm/vm/port/src/disasm/linux/disasm.c_notused b/drlvm/vm/port/src/disasm/linux/disasm.c_notused
index 5724f5c..b63f832 100644
--- a/drlvm/vm/port/src/disasm/linux/disasm.c_notused
+++ b/drlvm/vm/port/src/disasm/linux/disasm.c_notused
@@ -31,14 +31,14 @@
 #include <apr_portable.h>
 
 // this is mostly imperical data 
-#if defined(_IA32_)
+#if defined(HYX86)
     #define ADDR_SIZE       16
     #define MNEMONIC_SIZE   15
     #define BYTES_PER_LINE  2
     #define BYTES_TOTAL     100
     //BYTES_SIZE = BYTES_PER_LINE * 3
     #define BYTES_SIZE      6
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
     #define ADDR_SIZE       24
     #define MNEMONIC_SIZE   20
     #define BYTES_PER_LINE  2
@@ -82,7 +82,7 @@
 static init_disassemble_info_t bfd_init_info = NULL;
 static disassemble_init_for_target_t bfd_init_target = NULL;
 
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
 
 /*    Memory reading routines    */
 
@@ -90,9 +90,9 @@
                               bfd_byte * buffer,
                               unsigned int n,
                               struct disassemble_info * info) {
-#if defined(_IA32_)
+#if defined(HYX86)
     memcpy(buffer, (void *)(apr_uint32_t)src, n);
-#elif defined(_EM64T_) || defined(_IPF_)
+#elif defined(HYX86_64) || defined(_IPF_)
     memcpy(buffer, (void *)src, n);
 #endif
     return 0;
@@ -101,9 +101,9 @@
 /*    Address printing routines    */
 
 static void disasm_print_adress_default(bfd_vma memaddr, struct disassemble_info * info) {
-#if defined(_IA32_)
+#if defined(HYX86)
     info->fprintf_func(info->stream, "0x%08X", (apr_int32_t)memaddr);
-#elif defined(_EM64T_) || defined(_IPF_)
+#elif defined(HYX86_64) || defined(_IPF_)
     apr_uint64_t addr = (apr_uint64_t)memaddr;
     apr_uint32_t hi = (apr_uint32_t)((addr >> 32) & UINT_MAX);
     apr_uint32_t lo = (apr_uint32_t)(addr & UINT_MAX);
@@ -171,7 +171,7 @@
     // iterate over the code buffer
     while (len > 0) {
         int bytes_read = 1;
-#if defined(_IA32_)
+#if defined(HYX86)
         // print instruction address
         if (disassembler->port_info.print_addr) {
             disassembler->bfd_info.print_address_func((bfd_vma)(apr_uint32_t)code,
@@ -182,7 +182,7 @@
         if (disassembler->port_info.print_mnemonic) {
             bytes_read = bfd_decoder((bfd_vma)(apr_uint32_t)code, &disassembler->bfd_info);
         }
-#elif defined(_EM64T_) || defined(_IPF_)
+#elif defined(HYX86_64) || defined(_IPF_)
         // print instruction address
         if (disassembler->port_info.print_addr) {
             disassembler->bfd_info.print_address_func((bfd_vma)code,
@@ -215,18 +215,18 @@
     }
 }
 
-#endif // defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#endif // defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
 
 /*    Public Interface    */
 
 APR_DECLARE(apr_status_t) port_disasm_initialize() {
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
     static apr_status_t stat = APR_EINIT;
     const char * BFD_LIB_NAME = "libbfd.so";
     const char * OPCODES_LIB_NAME = "libopcodes.so";
     const char * BFD_INIT_INFO_NAME = "init_disassemble_info";
     const char * BFD_INIT_TARGET_NAME = "disassemble_init_for_target";
-#if defined (_IA32_) || defined(_EM64T_)
+#if defined (HYX86) || defined(HYX86_64)
     const char * BFD_PRINT_INSN_NAME = "print_insn_i386_intel";
 #elif defined(_IPF_)
     const char * BFD_PRINT_INSN_NAME = "print_insn_ia64";
@@ -306,7 +306,7 @@
 
 APR_DECLARE(apr_status_t) port_disassembler_create(port_disassembler_t ** disassembler,
                                                    apr_pool_t * pool) {
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
     apr_status_t status;
     
     if ((status = port_disasm_initialize()) != APR_SUCCESS) {
@@ -326,10 +326,10 @@
     (*disassembler)->bfd_info.read_memory_func = disasm_read_memory;
     (*disassembler)->bfd_info.print_address_func = disasm_print_adress_default;
 
-#if defined(_IA32_)
+#if defined(HYX86)
     (*disassembler)->bfd_info.arch = bfd_arch_i386;
     (*disassembler)->bfd_info.mach = bfd_mach_i386_i386_intel_syntax;
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
     (*disassembler)->bfd_info.arch = bfd_arch_i386;
     (*disassembler)->bfd_info.mach = bfd_mach_x86_64_intel_syntax;
 #elif defined(_IPF_)
@@ -357,7 +357,7 @@
 APR_DECLARE(apr_status_t) port_disasm_set_info(port_disassembler_t * disassembler,
                                                const port_disasm_info_t new_info,
                                                port_disasm_info_t * old_info) {
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
     if (old_info != NULL) {
         *old_info = disassembler->port_info;
     }
@@ -382,7 +382,7 @@
                                       const char * code, 
                                       unsigned int len,
                                       char ** disasm_code) {
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)    
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)    
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         *disasm_code = NULL;
@@ -419,7 +419,7 @@
                                               const char * code,
                                               unsigned int len,
                                               apr_file_t * thefile) {
-#if defined(_IA32_) || defined(_EM64T_) || defined(_IPF_)
+#if defined(HYX86) || defined(HYX86_64) || defined(_IPF_)
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         return APR_SUCCESS;
diff --git a/drlvm/vm/port/src/disasm/win/disasm.c b/drlvm/vm/port/src/disasm/win/disasm.c
index 1f99650..afd566e 100644
--- a/drlvm/vm/port/src/disasm/win/disasm.c
+++ b/drlvm/vm/port/src/disasm/win/disasm.c
@@ -30,7 +30,7 @@
 #include "port_disasm.h"
 
 // this is mostly imperical data 
-#if defined(_IA32_)
+#if defined(HYX86)
     #define ADDR_SIZE       16
     #define MNEMONIC_SIZE   15
     #define BYTES_PER_LINE  2
@@ -60,7 +60,7 @@
     apr_size_t num_bytes_used;
 };
 
-#if defined(_IA32_)
+#if defined(HYX86)
 
 /*    General printing routines    */
 
@@ -148,12 +148,12 @@
 #endif
     }
 }
-#endif // defined(_IA32_)
+#endif // defined(HYX86)
 
 /*    Public Interface    */
 
 APR_DECLARE(apr_status_t) port_disasm_initialize() {
-#if defined(_IA32_)
+#if defined(HYX86)
     return APR_SUCCESS;
 #else
     return APR_ENOTIMPL;
@@ -162,7 +162,7 @@
 
 APR_DECLARE(apr_status_t) port_disassembler_create(port_disassembler_t ** disassembler,
                                                    apr_pool_t * pool) {
-#if defined(_IA32_)
+#if defined(HYX86)
     apr_status_t status;
     port_disasm_info_t info = {1, 0, 1};
     
@@ -193,7 +193,7 @@
 APR_DECLARE(apr_status_t) port_disasm_set_info(port_disassembler_t * disassembler,
                                                const port_disasm_info_t new_info,
                                                port_disasm_info_t * old_info) {
-#if defined(_IA32_)
+#if defined(HYX86)
     if (old_info != NULL) {
         *old_info = disassembler->port_info;
     }
@@ -218,7 +218,7 @@
                                       const char * code, 
                                       unsigned int len,
                                       char ** disasm_code) {
-#if defined(_IA32_)    
+#if defined(HYX86)    
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         *disasm_code = NULL;
@@ -255,7 +255,7 @@
                                               const char * code,
                                               unsigned int len,
                                               apr_file_t * thefile) {
-#if defined(_IA32_)
+#if defined(HYX86)
     // check if nothing should be printed
     if (disassembler->line_size == 0) {
         return APR_SUCCESS;
diff --git a/drlvm/vm/port/src/misc/win/sysinfo.c b/drlvm/vm/port/src/misc/win/sysinfo.c
index 7d2fdc3..9afcbba 100644
--- a/drlvm/vm/port/src/misc/win/sysinfo.c
+++ b/drlvm/vm/port/src/misc/win/sysinfo.c
@@ -99,7 +99,7 @@
 APR_DECLARE(const char *) port_CPU_architecture(void){
 #if defined(_IPF_)
 	return "ia64";
-#elif defined (_EM64T_)
+#elif defined (HYX86_64)
     return "x86_64";
 #else
     return "x86";
diff --git a/drlvm/vm/port/src/thread/win/port_thread_tls_os.c b/drlvm/vm/port/src/thread/win/port_thread_tls_os.c
index 2cb7f0a..5f889ed 100644
--- a/drlvm/vm/port/src/thread/win/port_thread_tls_os.c
+++ b/drlvm/vm/port/src/thread/win/port_thread_tls_os.c
@@ -30,7 +30,7 @@
 
 #define MEM_PROTECT_SIZE 0x100
 
-#ifdef _EM64T_
+#ifdef HYX86_64
 #define GUARD_STACK_SIZE (64*1024)
 #else /* IA-32 */
 #define GUARD_STACK_SIZE (find_guard_page_size())
diff --git a/drlvm/vm/port/src/thread/win/thread_os.c b/drlvm/vm/port/src/thread/win/thread_os.c
index 0129204..e332fc6 100644
--- a/drlvm/vm/port/src/thread/win/thread_os.c
+++ b/drlvm/vm/port/src/thread/win/thread_os.c
@@ -145,7 +145,7 @@
         (!set && !tlsdata->guard_page_set))
         return 0; // Already in needed state
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /* Windows x86_64 protects both guard page and guard stack area
        specified by SetThreadStackGuarantee() with PAGE_GUARD flag */
     guard_addr = tlsdata->guard_stack_addr;
@@ -230,14 +230,14 @@
 
 static int setup_stack(port_tls_data_t* tlsdata)
 {
-#ifdef _EM64T_
+#ifdef HYX86_64
     ULONG guard_stack_size_param;
 #endif
 
     if (!port_shared_data)
         return -1;
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     /* this code in future should be used on both platforms x86-32 and x86-64 */
     guard_stack_size_param = (ULONG)PSD->guard_stack_size;
 
diff --git a/drlvm/vm/vmcore/include/jit_runtime_support_common.h b/drlvm/vm/vmcore/include/jit_runtime_support_common.h
index a01dd4a..8e7180f 100644
--- a/drlvm/vm/vmcore/include/jit_runtime_support_common.h
+++ b/drlvm/vm/vmcore/include/jit_runtime_support_common.h
@@ -45,7 +45,7 @@
 #define STACK_ALIGN16         (0x00000010)
 
 
-#ifdef _EM64T_
+#ifdef HYX86_64
     #define MANAGED_STACK_ALIGNMENT STACK_ALIGN_HALF16
 #else
     // Use 16-byte stack pointer alignment to avoid perf penalty on SSE usage in JITted code. 
diff --git a/drlvm/vm/vmcore/include/jvmti_dasm.h b/drlvm/vm/vmcore/include/jvmti_dasm.h
index a7f6f5a..636afdf 100644
--- a/drlvm/vm/vmcore/include/jvmti_dasm.h
+++ b/drlvm/vm/vmcore/include/jvmti_dasm.h
@@ -50,10 +50,10 @@
      */
     enum Register {
         DISASM_REG_NONE,
-#ifdef _IA32_
+#ifdef HYX86
         DISASM_REG_EAX, DISASM_REG_EBX, DISASM_REG_ECX, DISASM_REG_EDX,
         DISASM_REG_ESI, DISASM_REG_EDI, DISASM_REG_EBP, DISASM_REG_ESP
-#elif defined _EM64T_
+#elif defined HYX86_64
         DISASM_REG_RAX, DISASM_REG_RBX, DISASM_REG_RCX, DISASM_REG_RDX,
         DISASM_REG_RSI, DISASM_REG_RDI, DISASM_REG_RSP, DISASM_REG_RBP,
         DISASM_REG_R8 , DISASM_REG_R9 , DISASM_REG_R10, DISASM_REG_R11,
diff --git a/drlvm/vm/vmcore/include/thread_helpers.h b/drlvm/vm/vmcore/include/thread_helpers.h
index 61e6144..42ac0c0 100644
--- a/drlvm/vm/vmcore/include/thread_helpers.h
+++ b/drlvm/vm/vmcore/include/thread_helpers.h
@@ -36,7 +36,7 @@
 #endif /* __cplusplus */
 fast_tls_func* get_tls_helper(hythread_tls_key_t key);
 
-#if (defined _IA32_) || (defined _EM64T_)
+#if (defined HYX86) || (defined HYX86_64)
 
 #include "encoder.h"
 
@@ -53,6 +53,6 @@
 }
 #endif
 
-#endif /* (defined _IA32_) || (defined _EM64T_) */
+#endif /* (defined HYX86) || (defined HYX86_64) */
 
 #endif  /* OPEN_THREAD_NATIVE_H */
diff --git a/drlvm/vm/vmcore/include/version.h b/drlvm/vm/vmcore/include/version.h
index 819f601..f994aff 100644
--- a/drlvm/vm/vmcore/include/version.h
+++ b/drlvm/vm/vmcore/include/version.h
@@ -49,7 +49,7 @@
 
 #if defined(_IPF_)
 #define VERSION_ARCH "ipf"
-#elif defined(_EM64T_)
+#elif defined(HYX86_64)
 #define VERSION_ARCH "em64t"
 #else
 #define VERSION_ARCH "ia32"
diff --git a/jdktools/build.xml b/jdktools/build.xml
index 66626f6..652eec5 100644
--- a/jdktools/build.xml
+++ b/jdktools/build.xml
@@ -67,10 +67,22 @@
 
     <property file="${user.home}/.harmony-jdktools.properties" />
     <property name="common.resources" location="../common_resources" />
-    <import file="make/properties.xml" />
+    <property name="hy.target" location="target" />
+    <property name="hy.component" value="jdktools" />
+    <property name="hy.module" value="toplevel" />
+    <fail message="Property 'hy.target' is not defined">
+        <condition>
+            <not><isset property="hy.target" /></not>
+        </condition>
+    </fail>
+    <fail message="Property 'common.resources' is not defined">
+        <condition>
+            <not><isset property="common.resources" /></not>
+        </condition>
+    </fail>
 
     <!-- import properties for snapshot targets -->
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <!-- ================================
 	 target : rebuild
diff --git a/jdktools/make/properties.xml b/jdktools/make/properties.xml
deleted file mode 100644
index 9c6d3fa..0000000
--- a/jdktools/make/properties.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-  implied.  See the License for the specific language governing
-  permissions and limitations under the License.
-
- -->
-
-<project name="Top-Level jdktools property definitions">
-    <description>
-        Ant file of common properties to be imported by other ant files
-    </description>
-    
-    <fail message="Property 'hy.hdk' is not defined">
-        <condition>
-            <not><isset property="hy.hdk" /></not>
-        </condition>
-    </fail>
-
-    <fail message="Property 'common.resources' is not defined">
-        <condition>
-            <not><isset property="common.resources" /></not>
-        </condition>
-    </fail>
-
-    <fail message="Property 'hy.hdk' doesn't seem to point to an hdk?">
-        <condition>
-            <not><available file="${hy.hdk}/build/ant/properties.xml" /></not>
-        </condition>
-    </fail>
-
-    <fail message="Property 'common.resources' is not defined">
-        <condition>
-            <not>
-                <available file="${common.resources}/make/depends.properties" />
-            </not>
-        </condition>
-    </fail>
-
-</project>
diff --git a/jdktools/modules/jdktools/build.xml b/jdktools/modules/jdktools/build.xml
index 1afd499..2f6c425 100644
--- a/jdktools/modules/jdktools/build.xml
+++ b/jdktools/modules/jdktools/build.xml
@@ -19,11 +19,10 @@
 <project name="JDK Tools Build" default="build" basedir=".">
     <description>Build for JDK Tools component</description>
 
+    <property name="hy.component" value="jdktools" />
     <property name="hy.module" value="jdktools" />
-    <property name="hy.hdk" location="../../deploy" />
-    <import file="../../make/properties.xml" />
-    <property name="depends.dir" location="${common.resources}/depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
     <property file="../../make/depends.properties" />
     <property file="${common.resources}/make/depends.properties" />
@@ -81,22 +80,23 @@
         <echo message="Cleaning ${hy.module} classes" />
         <delete file="${hy.jdk}/lib/tools.jar" />
         <delete file="${hy.jdk}/lib/tools-src.jar" />
-        <delete dir="bin/main" includeemptydirs="true" failonerror="false" />
+        <delete dir="${hy.build.mod}/java" includeemptydirs="true"
+                failonerror="false" />
     </target>
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin/test"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
         <echo message="Compiling ${hy.module} classes" />
         <ensure-javac/>
-        <mkdir dir="bin/main" />
+        <mkdir dir="${hy.build.mod}/java" />
 
         <hy.javac sourcepath=""
                   srcdir="src/main/java"
-                  destdir="bin/main">
+                  destdir="${hy.build.mod}/java">
 
             <compilerarg line="${build.compilerarg}" />
 
@@ -140,7 +140,7 @@
 
         <hy.jar.bin destfile="${hy.jdk}/lib/tools.jar"
                     manifest="META-INF/MANIFEST.MF">
-            <fileset dir="bin/main" />
+            <fileset dir="${hy.build.mod}/java" />
             <fileset dir="src/main/java">
                 <exclude name="**/*.java" />
             </fileset>
@@ -176,7 +176,7 @@
        
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/jdktools/modules/jdktools/make/run-test.xml b/jdktools/modules/jdktools/make/run-test.xml
index aa3e2f4..598986e 100644
--- a/jdktools/modules/jdktools/make/run-test.xml
+++ b/jdktools/modules/jdktools/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="jdktools" />
+    <property name="hy.module" value="jdktools" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/jdktools/modules/jpda/build.xml b/jdktools/modules/jpda/build.xml
index acbdd73..28c6c87 100644
--- a/jdktools/modules/jpda/build.xml
+++ b/jdktools/modules/jpda/build.xml
@@ -19,11 +19,10 @@
 <project name="JPDA Build" default="build" basedir=".">
     <description>Build for JPDA component</description>
 
+    <property name="hy.component" value="jdktools" />
     <property name="hy.module" value="jpda" />
-    <property name="hy.hdk" location="../../deploy" />
-    <import file="../../make/properties.xml" />
-    <property name="depends.dir" location="${common.resources}/depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
     <property file="../../make/depends.properties" />
     <property file="${common.resources}/make/depends.properties" />
@@ -75,8 +74,8 @@
         <delete file="${hy.jdk}/lib/jdtstub-src.jar" />
 
         <delete includeemptydirs="true" failonerror="false">
-            <fileset dir="bin/main" />
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/main" />
+            <fileset dir="${hy.build.mod}/test" />
         </delete>
     </target>
 
@@ -112,17 +111,17 @@
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin/test"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
         <echo message="Compiling ${hy.module} classes" />
         <ensure-javac/>
-        <mkdir dir="bin/main" />
+        <mkdir dir="${hy.build.mod}/java" />
 
         <hy.javac sourcepath=""
                srcdir="src/main/java"
-               destdir="bin/main">
+               destdir="${hy.build.mod}/java">
 
             <!-- HDK class library -->
             <classpath>
@@ -146,7 +145,7 @@
 
         <hy.jar.bin destfile="${hy.jdk}/lib/jdtstub.jar"
                     manifest="META-INF/MANIFEST.MF">
-            <fileset dir="bin/main" />
+            <fileset dir="${hy.build.mod}/java" />
         </hy.jar.bin>
 
         <hy.jar.src destfile="${hy.jdk}/lib/jdtstub-src.jar">
@@ -205,7 +204,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
  
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/jdktools/modules/jpda/make/run-test.xml b/jdktools/modules/jpda/make/run-test.xml
index c8ed348..9a5b731 100644
--- a/jdktools/modules/jpda/make/run-test.xml
+++ b/jdktools/modules/jpda/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="jdktools" />
+    <property name="hy.module" value="jpda" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/jdktools/modules/jpda/src/main/native/jdwp/unix/agent/makefile b/jdktools/modules/jpda/src/main/native/jdwp/unix/agent/makefile
index 0ddd14d..a51962c 100644
--- a/jdktools/modules/jpda/src/main/native/jdwp/unix/agent/makefile
+++ b/jdktools/modules/jpda/src/main/native/jdwp/unix/agent/makefile
@@ -17,7 +17,8 @@
 # Makefile for module jdwp
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/jdktools/jpda/native/agent/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 COMMON=../../common/
 CMNAGENT=$(COMMON)agent/
@@ -30,34 +31,30 @@
 
 LDFLAGS += $(STDCLIBS)
 
-BUILDFILES = \
-    $(CMNAGENT)commands/ArrayReference.o \
-    $(CMNAGENT)commands/ArrayType.o \
-    $(CMNAGENT)commands/ClassLoaderReference.o \
-    $(CMNAGENT)commands/ClassObjectReference.o \
-    $(CMNAGENT)commands/ClassType.o \
-    $(CMNAGENT)commands/EventRequest.o \
-    $(CMNAGENT)commands/Method.o \
-    $(CMNAGENT)commands/ObjectReference.o \
-    $(CMNAGENT)commands/ReferenceType.o \
-    $(CMNAGENT)commands/StackFrame.o \
-    $(CMNAGENT)commands/StringReference.o \
-    $(CMNAGENT)commands/ThreadGroupReference.o \
-    $(CMNAGENT)commands/ThreadReference.o \
-    $(CMNAGENT)commands/VirtualMachine.o \
-    $(CMNAGENT)core/Agent.o $(CMNAGENT)core/AgentEventRequest.o \
-    $(CMNAGENT)core/AgentMonitor.o $(CMNAGENT)core/ClassManager.o \
-    $(CMNAGENT)core/CommandDispatcher.o $(CMNAGENT)core/CommandHandler.o \
-    $(CMNAGENT)core/EventDispatcher.o $(CMNAGENT)core/LogManager.o \
-    $(CMNAGENT)core/MemoryManager.o $(CMNAGENT)core/ObjectManager.o \
-    $(CMNAGENT)core/OptionParser.o $(CMNAGENT)core/PacketDispatcher.o \
-    $(CMNAGENT)core/PacketParser.o $(CMNAGENT)core/RequestManager.o \
-    $(CMNAGENT)core/RequestModifier.o $(CMNAGENT)core/ThreadManager.o \
-    $(CMNAGENT)core/TransportManager.o $(CMNAGENT)core/AgentManager.o \
-    core/TransportManager_pd.o
+BUILDFILES = ArrayReference.o ArrayType.o ClassLoaderReference.o \
+  ClassObjectReference.o ClassType.o EventRequest.o Method.o \
+  ObjectReference.o ReferenceType.o StackFrame.o StringReference.o \
+  ThreadGroupReference.o ThreadReference.o VirtualMachine.o \
+  Agent.o AgentEventRequest.o AgentMonitor.o ClassManager.o \
+  CommandDispatcher.o CommandHandler.o EventDispatcher.o LogManager.o \
+  MemoryManager.o ObjectManager.o OptionParser.o PacketDispatcher.o \
+  PacketParser.o RequestManager.o RequestModifier.o ThreadManager.o \
+  TransportManager.o AgentManager.o TransportManager_pd.o
 
 MDLLIBFILES = 
 
 DLLNAME = $(TOOLSDLLPATH)libjdwp.so
 
 include $(HY_HDK)/build/make/rules.mk
+
+$(HY_BIN)%.o: core/%.cpp
+	@mkdir -p ${@D}
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(CMNAGENT)core/%.cpp
+	@mkdir -p ${@D}
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(CMNAGENT)commands/%.cpp
+	@mkdir -p ${@D}
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
diff --git a/jdktools/modules/jpda/src/main/native/jdwp/unix/transport/dt_socket/makefile b/jdktools/modules/jpda/src/main/native/jdwp/unix/transport/dt_socket/makefile
index dbf6544..53e3edb 100644
--- a/jdktools/modules/jpda/src/main/native/jdwp/unix/transport/dt_socket/makefile
+++ b/jdktools/modules/jpda/src/main/native/jdwp/unix/transport/dt_socket/makefile
@@ -21,7 +21,8 @@
 
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/jdktools/jpda/native/dt_socket/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
 COMMON=../../../common/
 CMNTRANS=$(COMMON)transport/
@@ -35,12 +36,18 @@
 
 LDFLAGS += $(STDCLIBS)
 
-BUILDFILES = \
-    $(CMNTRANS)common/LastTransportError.o \
-    $(CMNTRANS)dt_socket/SocketTransport.o
+BUILDFILES = LastTransportError.o SocketTransport.o
 
 MDLLIBFILES = 
 
 DLLNAME = $(TOOLSDLLPATH)libdt_socket.so
 
 include $(HY_HDK)/build/make/rules.mk
+
+$(HY_BIN)%.o: $(CMNTRANS)common/%.cpp
+	@mkdir -p ${@D}
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(HY_BIN)%.o: $(CMNTRANS)dt_socket/%.cpp
+	@mkdir -p ${@D}
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
diff --git a/jdktools/modules/jretools/build.xml b/jdktools/modules/jretools/build.xml
index d6b1515..0b3d328 100644
--- a/jdktools/modules/jretools/build.xml
+++ b/jdktools/modules/jretools/build.xml
@@ -19,11 +19,10 @@
 <project name="JRE Tools Build" default="build" basedir=".">
     <description>Build for JRE Tools component</description>
 
+    <property name="hy.component" value="jdktools" />
     <property name="hy.module" value="jretools" />
-    <property name="hy.hdk" location="../../deploy" />
-    <import file="../../make/properties.xml" />
-    <property name="depends.dir" location="${common.resources}/depends" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
     <import file="${hy.hdk}/build/ant/depends.xml" />
     <property file="../../make/depends.properties" />
     <property file="${common.resources}/make/depends.properties" />
@@ -60,22 +59,22 @@
     <target name="-clean-java" unless="skip.java.build">
         <delete file="${hy.jre}/lib/tools.jar" />
         <delete file="${hy.jre}/lib/tools-src.jar" />
-        <delete dir="bin/main" includeemptydirs="true" failonerror="false" />
+        <delete dir="${hy.build.mod}/java" includeemptydirs="true" failonerror="false" />
     </target>
 
     <target name="-clean-test" unless="skip.test.build">
         <delete dir="${tests.hdk.dir}" failonerror="false" />
-        <delete failonerror="false" dir="bin/test"/>
+        <delete failonerror="false" dir="${hy.build.mod}/test"/>
     </target>
 
     <target name="-compile-java" unless="skip.java.build">
         <echo message="Compiling ${hy.module} classes" />
         <ensure-javac/>
-        <mkdir dir="bin/main" />
+        <mkdir dir="${hy.build.mod}/java" />
 
         <hy.javac sourcepath=""
                srcdir="src/main/java"
-               destdir="bin/main">
+               destdir="${hy.build.mod}/java">
 
             <compilerarg line="${build.compilerarg}" />
 
@@ -107,7 +106,7 @@
 
         <hy.jar.bin destfile="${hy.jre}/lib/tools.jar"
              manifest="META-INF/MANIFEST.MF">
-            <fileset dir="bin/main" />
+            <fileset dir="${hy.build.mod}/java" />
             <fileset dir="src/main/java">
                 <exclude name="**/*.java" />
             </fileset>
@@ -125,7 +124,7 @@
         <copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
 
         <hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
-            <fileset dir="bin/test" />
+            <fileset dir="${hy.build.mod}/test/api" />
         </hy.jar.bin>
 
         <mkdir dir="${tests.excludes.hdk.dir}"/>
diff --git a/jdktools/modules/jretools/make/run-test.xml b/jdktools/modules/jretools/make/run-test.xml
index b2f4847..643368e 100644
--- a/jdktools/modules/jretools/make/run-test.xml
+++ b/jdktools/modules/jretools/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="jdktools" />
+    <property name="hy.module" value="jretools" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/jdktools/modules/samsa/build.xml b/jdktools/modules/samsa/build.xml
index 13c5b6d..8f1a2fb 100644
--- a/jdktools/modules/samsa/build.xml
+++ b/jdktools/modules/samsa/build.xml
@@ -19,10 +19,10 @@
 <project name="Samsa Build" default="build" basedir=".">
     <description>Build for samsa program</description>
 
+    <property name="hy.component" value="jdktools" />
     <property name="hy.module" value="samsa" />
-    <property name="hy.hdk" location="../../deploy" />
-    <import file="../../make/properties.xml" />
-    <import file="${hy.hdk}/build/ant/properties.xml" />
+    <property name="hy.target" location="${basedir}/../../target" />
+    <import file="${hy.target}/hdk/build/ant/properties.xml" />
 
     <target name="build" depends="build-native,-test-jar"
             unless="skip.native.build"/>
diff --git a/jdktools/modules/samsa/make/run-test.xml b/jdktools/modules/samsa/make/run-test.xml
index 7fb7313..84ef43a 100644
--- a/jdktools/modules/samsa/make/run-test.xml
+++ b/jdktools/modules/samsa/make/run-test.xml
@@ -23,7 +23,9 @@
     <property file="../test.properties" />
 
     <property name="work.dir" value=".." />
-    <property name="target.dir" value=".." />
+    <property name="hy.target" value=".." />
+    <property name="hy.component" value="jdktools" />
+    <property name="hy.module" value="samsa" />
     <property name="tests.output" location="../report" />
     <property name="junit.jar" location="../junit.jar" />
 
diff --git a/jdktools/modules/samsa/src/main/native/samsa/unix/makefile b/jdktools/modules/samsa/src/main/native/samsa/unix/makefile
index ed7ca41..6f2f694 100644
--- a/jdktools/modules/samsa/src/main/native/samsa/unix/makefile
+++ b/jdktools/modules/samsa/src/main/native/samsa/unix/makefile
@@ -17,9 +17,10 @@
 # Makefile for 'samsa'
 #
 
-include $(HY_HDK)/build/make/defines.mk
+HY_BIN=$(HY_TARGET)/build/jdktools/samsa/native/samsa/
+include $(HY_TARGET)/hdk/build/make/defines.mk
 
-BUILDFILES = ../samsa.o
+BUILDFILES = samsa.o
 
 EXENAME = $(LIBPATH)samsa
 
@@ -30,3 +31,7 @@
 endif
 
 include $(HY_HDK)/build/make/rules.mk
+
+$(HY_BIN)%.o: ../%.c
+	@mkdir -p ${@D}
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<