harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r454390 [1/2] - in /incubator/harmony/enhanced/drlvm/trunk: build/make/ build/make/components/ build/make/components/vm/ vm/gc/ vm/gc_cc/ vm/gc_cc/build/ vm/gc_cc/src/ vm/gc_gen/ vm/gc_gen/src/ vm/gc_gen/src/common/ vm/gc_gen/src/gen/ vm/gc...
Date Mon, 09 Oct 2006 14:18:31 GMT
Author: wjwashburn
Date: Mon Oct  9 07:18:29 2006
New Revision: 454390

URL: http://svn.apache.org/viewvc?view=rev&rev=454390
Log:
HARMONY-1428
This is the initial commit of GCV5 plus rearranged GC directory structure plus build XML modifications
the gc/ directory was renamed to gc_cc/ and a new gc_gen/ directory was added which contains GCV5
The linux build currently excludes building gc_gen/


Added:
    incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_cc.xml
    incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/
      - copied from r454144, incubator/harmony/enhanced/drlvm/trunk/vm/gc/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/COPYRIGHT
      - copied unchanged from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/COPYRIGHT
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/LICENSE
      - copied unchanged from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/LICENSE
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/NOTICE
      - copied unchanged from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/NOTICE
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/README.txt
      - copied unchanged from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/README.txt
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/build/
      - copied from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/build/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/
      - copied from r454384, incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/COPYRIGHT
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/LICENSE
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/NOTICE
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gc_for_barrier.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_alloc.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace_collect.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_sweep/lspace.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/collector_alloc.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/thread_alloc.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace.h
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_alloc.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_copy.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/trace_forward/fspace_forward.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/verify/verify_live_heap.h
Removed:
    incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc.xml
    incubator/harmony/enhanced/drlvm/trunk/vm/gc/
Modified:
    incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml
    incubator/harmony/enhanced/drlvm/trunk/build/make/deploy.xml
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml?view=diff&rev=454390&r1=454389&r2=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml (original)
+++ incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm.xml Mon Oct  9 07:18:29 2006
@@ -31,7 +31,8 @@
         <select arch="ia32">
             <property  name="build.depends" value="vm.vmcore, 
                                                    vm.em, 
-                                                   vm.gc,
+                                                   vm.gc_gen,
+                                                   vm.gc_cc,
                                                    vm.vmi,
                                                    vm.interpreter,
                                                    vm.hythr,
@@ -43,7 +44,8 @@
         <select arch="ipf">
             <property name="build.depends" value="vm.vmcore,
                                                   vm.em, 
-                                                  vm.gc,
+                                                  vm.gc_gen,
+                                                  vm.gc_cc,
                                                   vm.interpreter,
                                                   vm.hythr,
                                                   vm.jitrino,
@@ -53,8 +55,9 @@
         <!-- ia32 dependence but w/o vm.vmi and vm.jitrino -->
         <select arch="em64t">
             <property name="build.depends" value="vm.vmcore,
-                                                  vm.em, 
-                                                  vm.gc, 
+                                                  vm.em,
+                                                  vm.gc_gen, 
+                                                  vm.gc_cc, 
                                                   vm.interpreter,
                                                   vm.hythr,
                                                   vm.jitrino,

Added: incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_cc.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_cc.xml?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_cc.xml (added)
+++ incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_cc.xml Mon Oct  9 07:18:29 2006
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+  
+    Licensed 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.
+-->
+<!--
+Author: Marina V. Goldburt, Dmitry B. Yershov
+Version: $Revision: 1.4.2.3 $
+-->
+<!--
+    This is build descriptor for the component "vm.gc_cc".
+
+    Please refer to make/components/README.txt for details about the component
+    build descriptor structure.
+  -->
+
+<project name="vm.gc_cc">
+    <target name="init" depends="common_vm">
+        <property name="build.depends" value="extra.apr,vm.vmcore,vm.hythr" />
+        <property name="outtype" value="shared" />
+        <property name="libname" value="gc_cc" />
+        <property name="src" location="${build.vm.home}" />
+
+        <compiler id="cpp.compiler" extends="common.cpp.compiler">
+            <includepath>
+                <pathelement location="${extra.apr.includes}" />
+            </includepath>
+
+            <includepath>
+                <dirset dir="${build.vm.home}">
+                    <include name="include" />
+                    <include name="vmcore/include" />
+                    <include name="vm/interface" />
+                    <select os="win">
+                        <include name="vmcore/src/util/win/include" />
+                    </select>
+                    <select os="lnx">
+                        <include name="vmcore/src/util/linux/include" />
+                    </select>
+                </dirset>
+            </includepath>
+
+            <fileset dir="${src}/gc_cc/src">
+                <include name="*.cpp" />            
+            </fileset>
+
+            <defineset define="BUILDING_GC" />
+
+            <select os="win">
+                <defineset define="_USRDLL" />
+            </select>
+
+            <select os="win" cfg="release" cxx="icl">
+                <compilerarg value="/Qip" />
+            </select>
+        </compiler>
+
+        <select os="win" arch="ipf">
+            <fileset id="asm.fileset"
+                     dir="${build.vm.home}/gc_cc/src">
+                <include name="ini_ipf_low_level.asm" />
+            </fileset>
+        </select>
+
+        <linker id="linker" extends="common.linker">
+            <select os="win">
+                <syslibset libs="advapi32,odbc32,ws2_32,mswsock" />
+                <libset libs="${vm.vmcore.lib}" dir="${vm.vmcore.libdir}" />
+            </select>
+
+            <select os="win" arch="ipf">
+                <syslibset libs="AdvAPI32" />
+            </select>
+
+            <select os="win" cfg="debug">
+                <linkerarg value="/NODEFAULTLIB:libcmtd.lib" />
+                <syslibset libs="msvcrtd" />
+            </select>
+
+            <libset libs="${vm.hythr.lib}" dir="${vm.hythr.libdir}" />
+            <select os="lnx">
+                <linkerarg value="-Bsymbolic" />
+            </select>
+        </linker>
+    </target>
+</project>

Added: incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml (added)
+++ incubator/harmony/enhanced/drlvm/trunk/build/make/components/vm/gc_gen.xml Mon Oct  9 07:18:29 2006
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+  
+    Licensed 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.
+-->
+<!--
+Author: Marina V. Goldburt, Dmitry B. Yershov
+Version: $Revision: 1.4.2.3 $
+-->
+<!--
+    This is build descriptor for the component "vm.gc_gen".
+
+    Please refer to make/components/README.txt for details about the component
+    build descriptor structure.
+  -->
+
+<project name="vm.gc_gen">
+    <target name="init" depends="common_vm">
+        <property name="build.depends" value="extra.apr,vm.vmcore,vm.hythr" />
+        <property name="outtype" value="shared" />
+        <property name="libname" value="gc_gen" />
+        <property name="src" location="${build.vm.home}" />
+
+        <compiler id="cpp.compiler" extends="common.cpp.compiler">
+            <includepath>
+                <pathelement location="${extra.apr.includes}" />
+            </includepath>
+
+            <includepath>
+                <dirset dir="${build.vm.home}">
+                    <include name="include" />
+                    <include name="vmcore/include" />
+                    <include name="vm/interface" />
+                    <select os="win">
+                        <include name="vmcore/src/util/win/include" />
+                    </select>
+                    <select os="lnx">
+                        <include name="vmcore/src/util/linux/include" />
+                    </select>
+                </dirset>
+            </includepath>
+
+            <fileset dir="${src}/gc_gen/src">
+              <select os="win">
+                <include name="common/*.cpp" />            
+                <include name="gen/*.cpp" />            
+                <include name="mark_compact/*.cpp" />            
+                <include name="mark_sweep/*.cpp" />            
+                <include name="thread/*.cpp" />            
+                <include name="trace_forward/*.cpp" />            
+                <include name="verify/*.cpp" />            
+              </select>
+
+                <select os="lnx">
+                  <exclude name="common/*.cpp" />
+                  <exclude name="gen/*.cpp" />
+                  <exclude name="mark_compact/*.cpp" />
+                  <exclude name="mark_sweep/*.cpp" />
+                  <exclude name="thread/*.cpp" />
+                  <exclude name="trace_forward/*.cpp" />
+                  <exclude name="verify/*.cpp" />
+                </select>
+            </fileset>
+
+            <defineset define="BUILDING_GC" />
+
+            <select os="win">
+                <defineset define="_USRDLL" />
+            </select>
+
+            <select os="win" cfg="release" cxx="icl">
+                <compilerarg value="/Qip" />
+            </select>
+        </compiler>
+
+        <select os="win" arch="ipf">
+            <fileset id="asm.fileset"
+                     dir="${build.vm.home}/gc_gen/src">
+                <include name="ini_ipf_low_level.asm" />
+            </fileset>
+        </select>
+
+        <linker id="linker" extends="common.linker">
+            <select os="win">
+                <syslibset libs="advapi32,odbc32,ws2_32,mswsock" />
+                <libset libs="${vm.vmcore.lib}" dir="${vm.vmcore.libdir}" />
+            </select>
+
+            <select os="win" arch="ipf">
+                <syslibset libs="AdvAPI32" />
+            </select>
+
+            <select os="win" cfg="debug">
+                <linkerarg value="/NODEFAULTLIB:libcmtd.lib" />
+                <syslibset libs="msvcrtd" />
+            </select>
+
+            <libset libs="${vm.hythr.lib}" dir="${vm.hythr.libdir}" />
+            <select os="lnx">
+                <linkerarg value="-Bsymbolic" />
+            </select>
+        </linker>
+    </target>
+</project>

Modified: incubator/harmony/enhanced/drlvm/trunk/build/make/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/build/make/deploy.xml?view=diff&rev=454390&r1=454389&r2=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/build/make/deploy.xml (original)
+++ incubator/harmony/enhanced/drlvm/trunk/build/make/deploy.xml Mon Oct  9 07:18:29 2006
@@ -46,9 +46,13 @@
             <other>bin/default:*</other>
         </jitrino>
 
-        <gc>
-            <shared>bin/default:gc</shared>
-        </gc>
+        <gc_gen>
+            <shared>bin/default:gc_gen</shared>
+        </gc_gen>
+
+        <gc_cc>
+            <shared>bin/default:gc_cc</shared>
+        </gc_cc>
 
         <vmi>
             <shared>bin/default:vmi</shared>

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/COPYRIGHT
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/COPYRIGHT?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/COPYRIGHT (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/COPYRIGHT Mon Oct  9 07:18:29 2006
@@ -0,0 +1,5 @@
+    The following copyright notice(s) were affixed to portions of the  
+    code with which this file is now or was at one time distributed and  
+    are placed here unaltered.
+ 
+         (C) Copyright 2005-2006 Intel Corporation

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/LICENSE
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/LICENSE?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/LICENSE (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/LICENSE Mon Oct  9 07:18:29 2006
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+ 
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ 
+   1. Definitions.
+ 
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+ 
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+ 
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+ 
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+ 
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+ 
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+ 
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+ 
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+ 
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+ 
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+ 
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+ 
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+ 
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+ 
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+ 
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+ 
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+ 
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+ 
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+ 
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+ 
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+ 
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+ 
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+ 
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+ 
+   END OF TERMS AND CONDITIONS
+ 
+   APPENDIX: How to apply the Apache License to your work.
+ 
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+ 
+   Copyright [yyyy] [name of copyright owner]
+ 
+   Licensed 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.

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/NOTICE
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/NOTICE?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/NOTICE (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/NOTICE Mon Oct  9 07:18:29 2006
@@ -0,0 +1,7 @@
+     This product includes software developed by The Apache Software 
+     Foundation (http://www.apache.org/).
+ 
+     Portions of Harmony were originally developed by
+     Intel Corporation and are licensed to the Apache Software
+     Foundation under the "Software Grant and Corporate Contribution 
+     License Agreement", informally known as the "Intel Harmony CLA".

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,124 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "../thread/collector.h"
+#include "../gen/gen.h"
+
+static void scan_slot(Collector* collector, Partial_Reveal_Object** p_ref)
+{
+  Partial_Reveal_Object* p_obj = *p_ref;
+  if(p_obj==NULL) return;
+
+  MarkStack* mark_stack = collector->mark_stack;
+  Space* obj_space = space_of_addr(collector->gc, p_obj);
+  Space* ref_space = space_of_addr(collector->gc, p_ref);
+
+  /* if obj to be moved, its ref slot needs remembering for later update */
+  if(obj_space->move_object) 
+    ref_space->save_reloc_func(ref_space, p_ref);
+
+  if(obj_space->mark_object_func(obj_space, p_obj))   
+    mark_stack->push(p_obj);
+    
+  return;
+}
+
+static void scan_object(Collector* collector, Partial_Reveal_Object *p_obj)
+{
+  if( !object_has_slots(p_obj) ) return;
+  
+    /* scan array object */
+  if (object_is_array(p_obj)) {
+    Partial_Reveal_Object* array = p_obj;
+    assert(!obj_is_primitive_array(array));
+    
+    int32 array_length = vector_get_length((Vector_Handle) array);
+    for (int i = 0; i < array_length; i++) {
+      Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)vector_get_element_address_ref((Vector_Handle) array, i);
+      scan_slot(collector, p_ref);
+    }   
+    return;
+  }
+
+  /* scan non-array object */
+  int *offset_scanner = init_object_scanner(p_obj);
+  while (true) {
+    Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)offset_get_ref(offset_scanner, p_obj);
+    if (p_ref == NULL) break; /* terminating ref slot */
+  
+    scan_slot(collector, p_ref);
+    offset_scanner = offset_next_ref(offset_scanner);
+  }
+
+  return;
+}
+
+static void scan_root(Collector* collector, Partial_Reveal_Object *p_obj)
+{
+  assert(p_obj);
+  Space* space = space_of_addr(collector->gc, p_obj);
+  if( !space->mark_object_func(space, p_obj) ) return;  
+      
+  MarkStack* mark_stack = collector->mark_stack;
+  mark_stack->push(p_obj);
+  
+  while(!mark_stack->empty()){
+  	p_obj = mark_stack->top();
+  	mark_stack->pop();
+	  scan_object(collector, p_obj);
+  }
+  
+  return;
+}
+
+void mark_scan_heap(Collector* collector)
+{
+  GC* gc = collector->gc;
+
+  int size = gc->root_set->size();
+  
+  for(int i=0; i<size; i++){
+    Partial_Reveal_Object **p_ref = (*gc->root_set)[i];
+	  assert(*p_ref); /* root ref should never by NULL */
+	  scan_root(collector, *p_ref);	
+  }	
+  
+  return;
+}
+
+void gc_update_rootset(GC* gc)
+{
+  RootSet* root_set = gc->root_set;
+  /* update refs in root set after moving collection */
+  for(unsigned int i=0; i < root_set->size(); i++){
+      Partial_Reveal_Object** p_ref = (*root_set)[i];
+      Partial_Reveal_Object* p_obj = *p_ref;
+      assert(p_obj); /* root ref should never by NULL*/
+      /* FIXME:: this should be reconsidered: forwarded in vt or obj_info */
+      if(!obj_is_forwarded_in_obj_info(p_obj)){
+         assert(obj_belongs_to_space(p_obj, gc_get_los((GC_Gen*)gc)));
+         continue;
+      }
+      Partial_Reveal_Object* p_target_obj = get_forwarding_pointer_in_obj_info(p_obj);
+      *p_ref = p_target_obj; 
+  }
+  
+  return;
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_common.h Mon Oct  9 07:18:29 2006
@@ -0,0 +1,263 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#ifndef _GC_COMMON_H_
+#define _GC_COMMON_H_
+
+#include <assert.h>
+#include <vector>
+#include <stack>
+#include <map>
+
+#include "port_vmem.h"
+
+#include "platform_lowlevel.h"
+
+#include "open/types.h"
+#include "open/vm_gc.h"
+#include "open/vm.h"
+#include "open/gc.h"
+#include "port_malloc.h"
+
+#include "gc_for_class.h"
+#include "gc_platform.h"
+
+#define TRUE 1
+#define FALSE 0
+#define null 0
+
+#define MB  1048576
+#define KB  1024
+
+#define BYTES_PER_WORD 4
+#define BITS_PER_BYTE 8 
+#define BITS_PER_WORD 32
+
+#define MASK_OF_BYTES_PER_WORD (BYTES_PER_WORD-1) /* 0x11 */
+#define WORD_SIZE_ROUND_UP(addr)  (((unsigned int)addr+MASK_OF_BYTES_PER_WORD)& ~MASK_OF_BYTES_PER_WORD) 
+
+#define BIT_SHIFT_TO_BYTES_PER_WORD 2 /* 2 */
+#define BIT_SHIFT_TO_BITS_PER_BYTE 3
+#define BIT_SHIFT_TO_BITS_PER_WORD 5
+#define BIT_SHIFT_TO_KILO 10 
+
+#define BIT_MASK_TO_BITS_PER_WORD ((1<<BIT_SHIFT_TO_BITS_PER_WORD)-1)
+
+#define GC_BLOCK_SHIFT_COUNT 15
+#define GC_BLOCK_SIZE_BYTES (1 << GC_BLOCK_SHIFT_COUNT)
+
+#define GC_OBJ_SIZE_THRESHOLD (GC_BLOCK_SIZE_BYTES >> 1)
+
+typedef void (*TaskType)(void*);
+
+#define GC_NUM_ROOTS_HINT  10000
+
+typedef std::stack<Partial_Reveal_Object *> MarkStack;
+typedef std::stack<Partial_Reveal_Object**> TraceStack;
+typedef std::vector<Partial_Reveal_Object*> RemobjSet;
+typedef std::vector<Partial_Reveal_Object**> RootSet;
+typedef std::vector<Partial_Reveal_Object**> RemslotSet;
+typedef std::vector<Partial_Reveal_Object**> SlotVector;
+typedef std::map<Partial_Reveal_Object*, Obj_Info_Type> ObjectMap;
+#include <hash_set>
+typedef stdext::hash_set<void *> HashSet;
+
+enum Collection_Kind {
+  MINOR_COLLECTION,
+  MAJOR_COLLECTION  
+};
+
+enum GC_CAUSE{
+  GC_CAUSE_NIL,
+  GC_CAUSE_NOS_IS_FULL,
+  GC_CAUSE_LOS_IS_FULL,
+  GC_CAUSE_RUNTIME_FORCE_GC
+};
+
+inline unsigned int vm_object_size(Partial_Reveal_Object *obj)
+{
+  Boolean arrayp = object_is_array (obj);
+  if (arrayp) {
+    return vm_vector_size(obj_get_class_handle(obj), vector_get_length((Vector_Handle)obj));
+  } else {
+    return nonarray_object_size(obj);
+  }
+}
+
+inline POINTER_SIZE_INT round_up_to_size(POINTER_SIZE_INT size, int block_size) 
+{  return (size + block_size - 1) & ~(block_size - 1); }
+
+inline POINTER_SIZE_INT round_down_to_size(POINTER_SIZE_INT size, int block_size) 
+{  return size & ~(block_size - 1); }
+
+inline Boolean obj_is_in_gc_heap(Partial_Reveal_Object *p_obj)
+{
+  return p_obj >= gc_heap_base_address() && p_obj < gc_heap_ceiling_address();
+}
+
+/* Return a pointer to the ref field offset array. */
+inline int *init_object_scanner (Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);  
+  return gcvt->gc_ref_offset_array;
+}
+
+inline void *offset_get_ref(int *offset, Partial_Reveal_Object *obj) 
+{    return (*offset == 0)? NULL: (void*)((Byte*) obj + *offset); }
+
+inline int *offset_next_ref (int *offset) 
+{  return (int *)((Byte *)offset + sizeof (int)); }
+
+Boolean obj_is_forwarded_in_vt(Partial_Reveal_Object *obj);
+inline Boolean obj_is_marked_in_vt(Partial_Reveal_Object *obj) 
+{  return ((POINTER_SIZE_INT)obj->vt_raw & MARK_BIT_MASK); }
+
+inline void obj_mark_in_vt(Partial_Reveal_Object *obj) 
+{  obj->vt_raw = (Partial_Reveal_VTable *)((POINTER_SIZE_INT)obj->vt_raw | MARK_BIT_MASK);
+   assert(!obj_is_forwarded_in_vt(obj));
+}
+
+inline void obj_unmark_in_vt(Partial_Reveal_Object *obj) 
+{
+  assert(!obj_is_forwarded_in_vt(obj));
+  assert(obj_is_marked_in_vt(obj)); 
+  obj->vt_raw = (Partial_Reveal_VTable *)((POINTER_SIZE_INT)obj->vt_raw & ~MARK_BIT_MASK);
+}
+
+inline void obj_set_forward_in_vt(Partial_Reveal_Object *obj) 
+{
+  assert(!obj_is_marked_in_vt(obj));
+  obj->vt_raw = (Partial_Reveal_VTable *)((POINTER_SIZE_INT)obj->vt_raw | FORWARDING_BIT_MASK);
+}
+
+inline Boolean obj_is_forwarded_in_vt(Partial_Reveal_Object *obj) 
+{  return (POINTER_SIZE_INT)obj->vt_raw & FORWARDING_BIT_MASK; }
+
+inline void obj_clear_forward_in_vt(Partial_Reveal_Object *obj) 
+{
+  assert(obj_is_forwarded_in_vt(obj) && !obj_is_marked_in_vt(obj));  
+  obj->vt_raw = (Partial_Reveal_VTable *)((POINTER_SIZE_INT)obj->vt_raw & ~FORWARDING_BIT_MASK);
+}
+
+inline void obj_set_forwarding_pointer_in_vt(Partial_Reveal_Object *obj, void *dest) 
+{
+  assert(!obj_is_marked_in_vt(obj));
+  obj->vt_raw = (Partial_Reveal_VTable *)((POINTER_SIZE_INT)dest | FORWARDING_BIT_MASK);
+}
+
+inline Partial_Reveal_Object *obj_get_forwarding_pointer_in_vt(Partial_Reveal_Object *obj) 
+{
+  assert(obj_is_forwarded_in_vt(obj) && !obj_is_marked_in_vt(obj));
+  return (Partial_Reveal_Object *)obj_get_vt(obj);
+}
+
+inline Partial_Reveal_Object *get_forwarding_pointer_in_obj_info(Partial_Reveal_Object *obj) 
+{
+  assert(get_obj_info(obj) & FORWARDING_BIT_MASK);
+  return (Partial_Reveal_Object*) (get_obj_info(obj) & ~FORWARDING_BIT_MASK);
+}
+
+inline Boolean obj_is_forwarded_in_obj_info(Partial_Reveal_Object *obj) 
+{
+  return (get_obj_info(obj) & FORWARDING_BIT_MASK);
+}
+
+inline void set_forwarding_pointer_in_obj_info(Partial_Reveal_Object *obj,void *dest)
+{  set_obj_info(obj,(Obj_Info_Type)dest | FORWARDING_BIT_MASK); }
+
+struct GC;
+/* all Spaces inherit this Space structure */
+typedef struct Space{
+  void* heap_start;
+  void* heap_end;
+  unsigned int reserved_heap_size;
+  unsigned int committed_heap_size;
+  unsigned int num_collections;
+  GC* gc;
+  Boolean move_object;
+  Boolean (*mark_object_func)(Space* space, Partial_Reveal_Object* p_obj);
+  void (*save_reloc_func)(Space* space, Partial_Reveal_Object** p_ref);
+  void (*update_reloc_func)(Space* space);
+}Space;
+
+inline unsigned int space_committed_size(Space* space){ return space->committed_heap_size;}
+inline void* space_heap_start(Space* space){ return space->heap_start; }
+inline void* space_heap_end(Space* space){ return space->heap_end; }
+
+inline Boolean address_belongs_to_space(void* addr, Space* space) 
+{
+  return (addr >= space_heap_start(space) && addr < space_heap_end(space));
+}
+
+inline Boolean obj_belongs_to_space(Partial_Reveal_Object *p_obj, Space* space)
+{
+  return address_belongs_to_space((Partial_Reveal_Object*)p_obj, space);
+}
+
+/* all GCs inherit this GC structure */
+struct Mutator;
+struct Collector;
+
+typedef struct GC{
+  void* heap_start;
+  void* heap_end;
+  unsigned int reserved_heap_size;
+  unsigned int committed_heap_size;
+  unsigned int num_collections;
+  
+  /* mutation related info */
+  Mutator *mutator_list;
+  SpinLock mutator_list_lock;
+  unsigned int num_mutators;
+
+  /* collection related info */    
+  Collector** collectors;
+  unsigned int num_collectors;
+  unsigned int num_active_collectors; /* not all collectors are working */
+  
+  /* rootsets for collection (FIXME:: should be distributed to collectors) */
+  RootSet* root_set;
+  unsigned int collect_kind; /* MAJOR or MINOR */
+
+  /* mem info */
+  apr_pool_t *aux_pool;
+  port_vmem_t *allocated_memory;
+
+}GC;
+
+inline void gc_init_rootset(GC* gc) 
+{
+	gc->root_set = new RootSet();
+	gc->root_set->reserve(GC_NUM_ROOTS_HINT);
+	gc->root_set->clear();
+}
+
+inline void gc_reset_rootset(GC* gc) 
+{
+	gc->root_set->clear();
+}
+void gc_update_rootset(GC* gc);
+void mark_scan_heap(Collector* collector);
+
+inline void* gc_heap_base(GC* gc){ return gc->heap_start; }
+inline void* gc_heap_ceiling(GC* gc){ return gc->heap_end; }
+
+
+#endif //_GC_COMMON_H_

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,154 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "gc_common.h"
+
+/* Setter functions for the gc class property field. */
+void gc_set_prop_alignment_mask (GC_VTable_Info *gcvt, unsigned int the_mask)
+{
+  gcvt->gc_class_properties |= the_mask;
+}
+void gc_set_prop_non_ref_array (GC_VTable_Info *gcvt)
+{
+  gcvt->gc_class_properties |= CL_PROP_NON_REF_ARRAY_MASK;
+}
+void gc_set_prop_array (GC_VTable_Info *gcvt)
+{
+  gcvt->gc_class_properties |= CL_PROP_ARRAY_MASK;
+}
+void gc_set_prop_pinned (GC_VTable_Info *gcvt)
+{
+  gcvt->gc_class_properties |= CL_PROP_PINNED_MASK;
+}
+void gc_set_prop_finalizable (GC_VTable_Info *gcvt)
+{
+  gcvt->gc_class_properties |= CL_PROP_FINALIZABLE_MASK;
+}
+
+
+/* A comparison function for qsort() called below to order offset slots. */
+static int
+intcompare(const void *vi, const void *vj)
+{
+  const int *i = (const int *) vi;
+  const int *j = (const int *) vj;
+  if (*i > *j)
+    return 1;
+  if (*i < *j)
+    return -1;
+  return 0;
+}
+
+static int *build_ref_offset_array(Class_Handle ch, GC_VTable_Info *gcvt)
+{
+  unsigned num_ref_fields = 0;
+  unsigned num_fields = class_num_instance_fields_recursive(ch);
+
+  unsigned idx;
+  for(idx = 0; idx < num_fields; idx++) {
+    Field_Handle fh = class_get_instance_field_recursive(ch, idx);
+    if(field_is_reference(fh)) {
+      num_ref_fields++;
+    }
+  }
+
+  if( num_ref_fields )   
+    gcvt->gc_object_has_slots = true;
+  else 
+    return NULL;
+     
+  /* add a null-termination slot */
+  unsigned int size = (num_ref_fields+1) * sizeof (unsigned int);
+
+  /* alloc from gcvt pool */
+  int *result = (int*) STD_MALLOC(size);
+  assert(result);
+
+  int *new_ref_array = result;
+  for(idx = 0; idx < num_fields; idx++) {
+    Field_Handle fh = class_get_instance_field_recursive(ch, idx);
+    if(field_is_reference(fh)) {
+      *new_ref_array = field_get_offset(fh);
+      new_ref_array++;
+    }
+  }
+
+  /* ref array is NULL-terminated */
+  *new_ref_array = NULL;
+
+  gcvt->gc_number_of_ref_fields = num_ref_fields;
+
+  /* offsets were built with idx, may not be in order. Let's sort it anyway.
+     FIXME: verify_live_heap depends on ordered offset array. */
+  qsort(result, num_ref_fields, sizeof(*result), intcompare);
+
+  gcvt->gc_ref_offset_array  = result;
+  
+  return new_ref_array;
+}
+
+void gc_class_prepared (Class_Handle ch, VTable_Handle vth) 
+{
+  GC_VTable_Info *gcvt;  
+  assert(ch);
+  assert(vth);
+
+  Partial_Reveal_VTable *vt = (Partial_Reveal_VTable *)vth;
+  
+  /* FIXME: gcvts are too random is memory */
+  gcvt = (GC_VTable_Info *) STD_MALLOC(sizeof(GC_VTable_Info));
+  assert(gcvt);
+  vtable_set_gcvt(vt, gcvt);
+  memset((void *)gcvt, 0, sizeof(GC_VTable_Info));
+  gcvt->gc_clss = ch;
+  gcvt->gc_class_properties = 0;
+  gcvt->gc_object_has_slots = false;
+  
+  gc_set_prop_alignment_mask(gcvt, class_get_alignment(ch));
+
+  if(class_is_array(ch)) {
+    Class_Handle array_element_class = class_get_array_element_class(ch);
+    gc_set_prop_array(gcvt);
+    gcvt->gc_array_element_size = class_element_size(ch);
+    unsigned int the_offset = vector_first_element_offset_unboxed(array_element_class);
+    gcvt->gc_array_first_element_offset = the_offset;
+  
+    if (class_is_non_ref_array (ch)) {
+      gc_set_prop_non_ref_array(gcvt);
+    }else{
+      gcvt->gc_object_has_slots = true;
+    }
+  }
+
+  if (class_is_finalizable(ch)) {
+    gc_set_prop_finalizable(gcvt);
+  }
+
+  unsigned int size = class_get_boxed_data_size(ch);
+  gcvt->gc_allocated_size = size;
+  
+  /* Build the offset array */
+  build_ref_offset_array(ch, gcvt);
+
+  gcvt->gc_class_name = class_get_name(ch);
+  assert (gcvt->gc_class_name);
+
+}  /* gc_class_prepared */
+

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_class.h Mon Oct  9 07:18:29 2006
@@ -0,0 +1,139 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#ifndef _GC_TYPES_H_
+#define _GC_TYPES_H_
+
+#include "open/types.h"
+
+#define FORWARDING_BIT_MASK 0x1
+#define MARK_BIT_MASK 0x2
+
+typedef void *Thread_Handle; 
+typedef POINTER_SIZE_INT Obj_Info_Type;
+
+typedef struct GC_VTable_Info {
+  unsigned int gc_object_has_slots;
+  unsigned int gc_number_of_ref_fields;
+
+  uint32 gc_class_properties;    // This is the same as class_properties in VM's VTable.
+
+  unsigned int instance_data_size;
+
+  // Offset from the top by CLASS_ALLOCATED_SIZE_OFFSET
+  // The number of bytes allocated for this object. It is the same as
+  // instance_data_size with the constraint bit cleared. This includes
+  // the OBJECT_HEADER_SIZE as well as the OBJECT_VTABLE_POINTER_SIZE
+  unsigned int gc_allocated_size;
+
+  unsigned int gc_array_element_size;
+
+  // This is the offset from the start of the object to the first element in the
+  // array. It isn't a constant since we pad double words.
+  int gc_array_first_element_offset;
+
+  // The GC needs access to the class name for debugging and for collecting information
+  // about the allocation behavior of certain classes. Store the name of the class here.
+  const char *gc_class_name;
+  Class_Handle gc_clss;
+
+  // This array holds an array of offsets to the pointer fields in
+  // an instance of this class, including the weak referent field.
+  // It would be nice if this
+  // was located immediately prior to the vtable, since that would
+  // eliminate a dereference.
+  int *gc_ref_offset_array;
+  
+} GC_VTable_Info;
+
+typedef struct Partial_Reveal_VTable {
+  GC_VTable_Info *gcvt;
+} Partial_Reveal_VTable;
+
+typedef struct Partial_Reveal_Object {
+  Partial_Reveal_VTable *vt_raw;
+  Obj_Info_Type obj_info;
+} Partial_Reveal_Object;
+
+inline Obj_Info_Type get_obj_info(Partial_Reveal_Object *obj) 
+{  return obj->obj_info; }
+
+inline void set_obj_info(Partial_Reveal_Object *obj, Obj_Info_Type new_obj_info) 
+{  obj->obj_info = new_obj_info; }
+
+inline Obj_Info_Type *get_obj_info_addr(Partial_Reveal_Object *obj) 
+{  return &obj->obj_info; }
+
+inline Partial_Reveal_VTable *obj_get_vtraw(Partial_Reveal_Object *obj) 
+{  return obj->vt_raw; }
+
+inline Partial_Reveal_VTable **obj_get_vtraw_addr(Partial_Reveal_Object *obj) 
+{  return &obj->vt_raw; }
+
+inline Partial_Reveal_VTable *obj_get_vt(Partial_Reveal_Object *obj) 
+{  return (Partial_Reveal_VTable *)((POINTER_SIZE_INT)obj->vt_raw & ~(FORWARDING_BIT_MASK | MARK_BIT_MASK)); }
+
+inline void obj_set_vt(Partial_Reveal_Object *obj, Allocation_Handle ah) 
+{  obj->vt_raw = (Partial_Reveal_VTable *)ah; }
+
+inline GC_VTable_Info *vtable_get_gcvt(Partial_Reveal_VTable *vt) 
+{  return vt->gcvt; }
+
+inline void vtable_set_gcvt(Partial_Reveal_VTable *vt, GC_VTable_Info *new_gcvt) 
+{  vt->gcvt = new_gcvt; }
+
+inline GC_VTable_Info *obj_get_gcvt(Partial_Reveal_Object *obj) 
+{
+  Partial_Reveal_VTable *vt = obj_get_vt(obj);
+  return vtable_get_gcvt(vt);
+}
+
+inline Boolean object_has_slots(Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);
+  return gcvt->gc_object_has_slots;   
+}
+
+inline Boolean object_is_array(Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);
+  return (gcvt->gc_class_properties & CL_PROP_ARRAY_MASK);
+  
+} 
+
+inline Boolean obj_is_primitive_array(Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);  
+  return (gcvt->gc_class_properties & CL_PROP_NON_REF_ARRAY_MASK);
+}
+
+inline Class_Handle obj_get_class_handle(Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);  
+  return gcvt->gc_clss;
+}
+
+inline unsigned int nonarray_object_size(Partial_Reveal_Object *obj) 
+{
+  GC_VTable_Info *gcvt = obj_get_gcvt(obj);  
+  return gcvt->gc_allocated_size;
+}
+
+#endif //#ifndef _GC_TYPES_H_
\ No newline at end of file

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,111 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "vm_threads.h"
+
+#include "../gen/gen.h"
+
+static GC* p_global_gc = NULL;
+
+void gc_init() 
+{  
+  assert(p_global_gc == NULL);
+  GC* gc = (GC*)STD_MALLOC(sizeof(GC_Gen));
+  assert(gc);
+  memset(gc, 0, sizeof(GC));  
+  p_global_gc = gc;
+  gc_gen_initialize((GC_Gen*)gc, min_heap_size_bytes, max_heap_size_bytes);
+  /* initialize the main thread*/
+  // gc_thread_init(vm_get_gc_thread_local());
+  
+  return;
+}
+
+/* this interface need reconsidering. is_pinned is unused. */
+void gc_add_root_set_entry(Managed_Object_Handle *ref, Boolean is_pinned) 
+{  	
+  Partial_Reveal_Object** p_ref = (Partial_Reveal_Object**)ref;
+  if (*p_ref == NULL) return;	
+	assert( !obj_is_marked_in_vt(*p_ref));
+	assert( !obj_is_forwarded_in_vt(*p_ref) && !obj_is_forwarded_in_obj_info(*p_ref)); 
+	assert( obj_is_in_gc_heap(*p_ref));
+	p_global_gc->root_set->push_back(p_ref);
+} 
+
+/* VM to force GC */
+void gc_force_gc() 
+{
+  vm_gc_lock_enum();
+  gc_gen_reclaim_heap((GC_Gen*)p_global_gc, GC_CAUSE_RUNTIME_FORCE_GC);  
+  vm_gc_unlock_enum();
+}
+
+void gc_wrapup() 
+{  
+  gc_gen_destruct((GC_Gen*)p_global_gc);
+  p_global_gc = NULL;
+}
+
+void* gc_heap_base_address() 
+{  return gc_heap_base(p_global_gc); }
+
+void* gc_heap_ceiling_address() 
+{  return gc_heap_ceiling(p_global_gc); }
+
+/* this is a contract between vm and gc */
+void mutator_initialize(GC* gc, void* tls_gc_info);
+void mutator_destruct(GC* gc, void* tls_gc_info); 
+void gc_thread_init(void* gc_info)
+{  mutator_initialize(p_global_gc, gc_info);  }
+
+void gc_thread_kill(void* gc_info)
+{  mutator_destruct(p_global_gc, gc_info);  }
+
+int64 gc_free_memory() 
+{
+	return (int64)gc_gen_free_memory_size((GC_Gen*)p_global_gc);
+}
+
+/* java heap size.*/
+int64 gc_total_memory() 
+{
+	return (int64)((POINTER_SIZE_INT)gc_heap_ceiling(p_global_gc) - (POINTER_SIZE_INT)gc_heap_base(p_global_gc)); 
+}
+
+void gc_vm_initialized()
+{ return; }
+
+Boolean gc_is_object_pinned (Managed_Object_Handle obj)
+{  return 0; }
+
+void gc_pin_object (Managed_Object_Handle* p_object) 
+{  return; }
+
+void gc_unpin_object (Managed_Object_Handle* p_object) 
+{  return; }
+
+Managed_Object_Handle gc_get_next_live_object(void *iterator) 
+{  assert(0); return NULL; }
+
+unsigned int gc_time_since_last_gc()
+{  assert(0); return 0; }
+
+void gc_add_root_set_entry_interior_pointer (void **slot, int offset, Boolean is_pinned) 
+{  assert(0); }

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h Mon Oct  9 07:18:29 2006
@@ -0,0 +1,108 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#ifndef _GC_PLATFORM_H_
+#define _GC_PLATFORM_H_
+
+
+#include <apr_time.h>
+#include <apr_atomic.h>
+
+#include <open/hythread_ext.h>
+
+#define USEC_PER_SEC INT64_C(1000000)
+
+#define VmThreadHandle (void*)
+#define VmEventHandle   hysem_t
+#define THREAD_OK       TM_ERROR_NONE
+
+inline int vm_wait_event(VmEventHandle event)
+{   IDATA stat = hysem_wait(event);
+    assert(stat == TM_ERROR_NONE); return stat;
+}
+
+inline int vm_set_event(VmEventHandle event)
+{   IDATA stat = hysem_post(event);
+    assert(stat == TM_ERROR_NONE); return stat;
+}
+
+inline int vm_reset_event(VmEventHandle event)
+{   IDATA stat = hysem_set(event,0);
+    assert(stat == TM_ERROR_NONE); return stat;
+}
+
+inline int vm_create_event(VmEventHandle* event, unsigned int initial_count, unsigned int max_count)
+{
+  return hysem_create(event, initial_count, max_count);
+}
+
+inline void vm_thread_yield()
+{
+  hythread_yield();
+}
+
+inline int vm_create_thread(void* ret_thread, unsigned int stacksize, unsigned int priority, unsigned int suspend, int (*func)(void*), void *data)
+{ 
+  return hythread_create((hythread_t*)ret_thread, (UDATA)stacksize, (UDATA)priority, (UDATA)suspend, 
+                             (hythread_entrypoint_t)func, data);
+}
+
+inline void *atomic_casptr(volatile void **mem, void *with, const void *cmp) {
+  return apr_atomic_casptr(mem, with, cmp);
+}
+
+inline uint32 atomic_cas32(volatile apr_uint32_t *mem,
+                                           apr_uint32_t swap,
+                                           apr_uint32_t cmp) {
+	return (uint32)apr_atomic_cas32(mem, swap, cmp);
+}
+
+inline Boolean pool_create(apr_pool_t **newpool, apr_pool_t *parent) {
+	return (Boolean)apr_pool_create(newpool, parent);
+}
+
+inline void pool_destroy(apr_pool_t *p) {
+	apr_pool_destroy(p);
+}
+
+inline uint32 atomic_inc32(volatile apr_uint32_t *mem) {
+	return (uint32)apr_atomic_inc32(mem);
+}
+
+inline uint32 atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) {
+	return (uint32)apr_atomic_add32(mem, val);
+}
+
+inline int64 time_now() {
+	return apr_time_now();
+}
+
+typedef volatile unsigned int SpinLock;
+
+enum Lock_State{
+  FREE_LOCK,
+  LOCKED
+};
+
+#define try_lock(x) (!atomic_cas32(&(x), LOCKED, FREE_LOCK))
+#define lock(x)	while( !try_lock(x)){ while( x==LOCKED );}
+#define unlock(x) do{ x = FREE_LOCK;}while(0)
+
+#endif //_GC_PLATFORM_H_

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gc_for_barrier.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gc_for_barrier.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gc_for_barrier.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gc_for_barrier.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "../gen/gen.h"
+
+#include "../thread/mutator.h"
+
+/* All the write barrier interfaces need cleanup */
+
+Boolean gc_requires_barriers() 
+{   return 1; }
+
+/* The implementations are only temporary */
+static void gc_write_barrier_generic(Managed_Object_Handle p_obj_holding_ref, Managed_Object_Handle *p_slot, 
+                      Managed_Object_Handle p_target, unsigned int kind) 
+{
+  Mutator *mutator = (Mutator *)vm_get_gc_thread_local();
+  GC_Gen* gc = (GC_Gen*)mutator->gc;
+  if(kind == WRITE_BARRIER_SLOT ){
+    if( address_belongs_to_nursery((void *)p_target, gc) && 
+         !address_belongs_to_nursery((void *)p_slot, gc)) 
+    {
+      mutator->remslot->push_back((Partial_Reveal_Object **)p_slot);
+    }
+  }else if( kind == WRITE_BARRIER_OBJECT ){
+    if( !address_belongs_to_nursery((void *)p_obj_holding_ref, gc) ) {
+      mutator->remobj->push_back((Partial_Reveal_Object *)p_obj_holding_ref);
+    }    
+  }else{  
+    assert(kind == WRITE_BARRIER_UPDATE ); 
+    *p_slot = p_target;
+    if( address_belongs_to_nursery((void *)p_target, gc) && 
+         !address_belongs_to_nursery((void *)p_slot, gc)) 
+    {
+      mutator->remslot->push_back((Partial_Reveal_Object **)p_slot);
+    }      
+  }
+}
+
+/* temporary write barriers, need reconsidering */
+void gc_write_barrier(Managed_Object_Handle p_obj_holding_ref)
+{
+  gc_write_barrier_generic(p_obj_holding_ref, NULL, NULL, WRITE_BARRIER_OBJECT); 
+}
+
+/* for array copy and object clone */
+void gc_heap_wrote_object (Managed_Object_Handle p_obj_holding_ref)
+{
+  gc_write_barrier_generic(p_obj_holding_ref, NULL, NULL, WRITE_BARRIER_OBJECT); 
+}
+
+/* The following routines were supposed to be the only way to alter any value in gc heap. */
+void gc_heap_write_ref (Managed_Object_Handle p_obj_holding_ref, unsigned offset, Managed_Object_Handle p_target) 
+{  assert(0); }
+
+void gc_heap_slot_write_ref (Managed_Object_Handle p_obj_holding_ref,Managed_Object_Handle *p_slot, Managed_Object_Handle p_target)
+{  
+  gc_write_barrier_generic(NULL, p_slot, p_target, WRITE_BARRIER_UPDATE); 
+}
+
+/* this is used for global object update, e.g., strings. Since globals are roots, no barrier here */
+void gc_heap_write_global_slot(Managed_Object_Handle *p_slot,Managed_Object_Handle p_target)
+{
+  *p_slot = p_target;
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,244 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "port_sysinfo.h"
+
+#include "gen.h"
+#include "../thread/mutator.h"
+#include "../thread/collector.h"
+#include "../verify/verify_live_heap.h"
+
+/* heap size limit is not interesting. only for manual tuning purpose */
+unsigned int min_heap_size_bytes = 32 * MB;
+unsigned int max_heap_size_bytes = 64 * MB;
+
+/* fspace size limit is not interesting. only for manual tuning purpose */
+unsigned int min_nos_size_bytes = 2 * MB;
+unsigned int max_nos_size_bytes = 64 * MB;
+
+static void gc_gen_get_system_info(GC_Gen *gc_gen) 
+{
+  gc_gen->_machine_page_size_bytes = port_vmem_page_sizes()[0];
+  gc_gen->_num_processors = port_CPUs_number();
+}
+
+void gc_gen_initialize(GC_Gen *gc_gen, unsigned int min_heap_size, unsigned int max_heap_size) 
+{
+	assert(gc_gen);	
+  assert(max_heap_size <= max_heap_size_bytes);
+	/* FIXME:: we need let virtual space to include unmapped region.
+	   Heuristically for Nursery+MatureFrom+MatureTo(unmapped)+LOS(mapped+unmapped), 
+	   we need almost half more than the user specified virtual space size. 
+	   That's why we have the below. */
+	max_heap_size += max_heap_size>>1;
+
+	min_heap_size = round_up_to_size(min_heap_size, GC_BLOCK_SIZE_BYTES);
+	max_heap_size = round_up_to_size(max_heap_size, GC_BLOCK_SIZE_BYTES);
+
+	gc_gen_get_system_info(gc_gen); 
+
+  void *reserved_base = NULL;
+
+  /* allocate memory for gc_gen */
+  gc_gen->allocated_memory = NULL;
+  pool_create(&gc_gen->aux_pool, 0);
+  
+  apr_status_t status = port_vmem_reserve(&gc_gen->allocated_memory, 
+                  &reserved_base, max_heap_size, 
+                  PORT_VMEM_MODE_READ | PORT_VMEM_MODE_WRITE, 
+                  gc_gen->_machine_page_size_bytes, gc_gen->aux_pool);
+  
+  while(APR_SUCCESS != status){
+    max_heap_size -= gc_gen->_machine_page_size_bytes;
+    status = port_vmem_reserve(&gc_gen->allocated_memory, 
+                  &reserved_base, max_heap_size, 
+                  PORT_VMEM_MODE_READ | PORT_VMEM_MODE_WRITE, 
+                  gc_gen->_machine_page_size_bytes, gc_gen->aux_pool);  
+  }
+  assert(max_heap_size > min_heap_size_bytes);
+  gc_gen->reserved_heap_size = max_heap_size;
+  gc_gen->heap_start = reserved_base;
+  gc_gen->heap_end = (void*)((unsigned int)reserved_base + max_heap_size);
+  gc_gen->num_collections = 0;
+
+  /* heuristic nos + mos + LOS */
+  unsigned int nos_size =  max_heap_size >> 4; 
+  assert(nos_size > min_nos_size_bytes);
+	gc_nos_initialize(gc_gen, reserved_base, nos_size);	
+
+	unsigned int mos_size = max_heap_size >> 1;
+	reserved_base = (void*)((unsigned int)reserved_base + nos_size);
+	gc_mos_initialize(gc_gen, reserved_base, mos_size);
+  
+	unsigned int los_size = max_heap_size >> 2;
+	reserved_base = (void*)((unsigned int)gc_gen->heap_end - los_size);
+	gc_los_initialize(gc_gen, reserved_base, los_size);
+
+  gc_gen->committed_heap_size = space_committed_size((Space*)gc_gen->nos) +
+                                space_committed_size((Space*)gc_gen->mos) +
+                                space_committed_size((Space*)gc_gen->los);
+  
+  gc_init_rootset((GC*)gc_gen);	
+
+	gc_gen->mutator_list = NULL;
+	gc_gen->mutator_list_lock = FREE_LOCK;
+
+  gc_gen->num_mutators = 0;
+  
+  collector_initialize((GC*)gc_gen);
+  
+  if( verify_live_heap ){  /* for live heap verify*/
+    gc_init_heap_verification((GC*)gc_gen);
+  }
+
+  return;
+}
+
+void gc_gen_destruct(GC_Gen *gc_gen) 
+{
+	gc_nos_destruct(gc_gen);
+	gc_gen->nos = NULL;
+	
+	gc_mos_destruct(gc_gen);	
+	gc_gen->mos = NULL;
+
+	gc_los_destruct(gc_gen);	
+  gc_gen->los = NULL;
+  
+  collector_destruct((GC*)gc_gen);
+
+  if( verify_live_heap ){
+    gc_terminate_heap_verification((GC*)gc_gen);
+  }
+
+	STD_FREE(gc_gen);
+}
+
+
+Boolean major_collection_needed(GC_Gen* gc)
+{
+  return mspace_free_memory_size(gc->mos) < fspace_used_memory_size(gc->nos);  
+}
+
+void* mos_alloc(unsigned size, Alloc_Context *alloc_ctx){return mspace_alloc(size, alloc_ctx);}
+void* nos_alloc(unsigned size, Alloc_Context *alloc_ctx){return fspace_alloc(size, alloc_ctx);}
+void* los_alloc(unsigned size, Alloc_Context *alloc_ctx){return lspace_alloc(size, alloc_ctx);}
+Space* gc_get_nos(GC_Gen* gc){ return (Space*)gc->nos;}
+Space* gc_get_mos(GC_Gen* gc){ return (Space*)gc->mos;}
+Space* gc_get_los(GC_Gen* gc){ return (Space*)gc->los;}
+void gc_set_nos(GC_Gen* gc, Space* nos){ gc->nos = (Fspace*)nos;}
+void gc_set_mos(GC_Gen* gc, Space* mos){ gc->mos = (Mspace*)mos;}
+void gc_set_los(GC_Gen* gc, Space* los){ gc->los = (Lspace*)los;}
+unsigned int gc_get_processor_num(GC_Gen* gc){ return gc->_num_processors;}
+
+void gc_preprocess_collector(Collector *collector)
+{
+  GC_Gen* gc = (GC_Gen*)collector->gc;
+  
+  /* this_cycle_remset is ready to be used */
+  assert(collector->this_cycle_remset->empty());
+
+  return;
+}
+
+void gc_postprocess_collector(Collector *collector)
+{ 
+  GC_Gen* gc = (GC_Gen*)collector->gc;
+      
+  /* for MINOR_COLLECTION */
+  Fspace* fspace = (Fspace*)gc_get_nos(gc);
+  
+  /* switch its remsets, this_cycle_remset data kept in space->remslot_sets */
+  /* last_cycle_remset was in space->remslot_sets and cleared during collection */
+  assert(collector->last_cycle_remset->empty());
+
+  RemslotSet* temp_set = collector->this_cycle_remset;
+  collector->this_cycle_remset = collector->last_cycle_remset;
+  collector->last_cycle_remset = temp_set;
+  
+  fspace->remslot_sets->push_back(collector->last_cycle_remset);
+  
+  return;
+}
+
+void gc_preprocess_mutator(GC_Gen* gc)
+{
+  Mutator *mutator = gc->mutator_list;
+  Fspace* fspace = (Fspace*)mutator->alloc_space;
+  
+  while (mutator) {
+    fspace->remslot_sets->push_back(mutator->remslot);
+    fspace->remobj_sets->push_back(mutator->remobj);  
+    mutator = mutator->next;
+  }
+ 
+  return;
+}
+
+void gc_postprocess_mutator(GC_Gen* gc)
+{
+  Mutator *mutator = gc->mutator_list;
+  while (mutator) {
+    assert(mutator->remobj->empty());
+    assert(mutator->remslot->empty());
+    alloc_context_reset((Alloc_Context*)mutator);    
+    mutator = mutator->next;
+  }
+  
+  return;
+}
+
+static unsigned int gc_decide_collection_kind(GC_Gen* gc, unsigned int cause)
+{
+  if(major_collection_needed(gc) || cause== GC_CAUSE_LOS_IS_FULL)
+    return  MAJOR_COLLECTION;
+
+  return MINOR_COLLECTION;     
+}
+
+void gc_gen_reclaim_heap(GC_Gen* gc, unsigned int cause)
+{  
+  gc->num_collections++;
+
+  gc->collect_kind = gc_decide_collection_kind(gc, cause);
+
+  /* Stop the threads and collect the roots. */
+  gc_reset_rootset((GC*)gc);  
+  vm_enumerate_root_set_all_threads();
+  
+  gc_preprocess_mutator(gc);
+  
+  if(verify_live_heap) gc_verify_heap((GC*)gc, TRUE);
+
+  if(gc->collect_kind == MINOR_COLLECTION)
+    fspace_collection(gc->nos);
+  else{
+    mspace_collection(gc->mos); /* fspace collection is included */
+    lspace_collection(gc->los);
+  }
+  
+  if(verify_live_heap) gc_verify_heap((GC*)gc, FALSE);
+      
+  gc_postprocess_mutator(gc);
+
+  vm_resume_threads_after();
+
+  return;
+}

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/gen/gen.h Mon Oct  9 07:18:29 2006
@@ -0,0 +1,148 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#ifndef _GC_GEN_H_
+#define _GC_GEN_H_
+
+#include "../common/gc_common.h"
+#include "../thread/thread_alloc.h"
+#include "../trace_forward/fspace.h"
+#include "../mark_compact/mspace.h"
+#include "../mark_sweep/lspace.h"
+  
+enum Write_Barrier_Kind{
+  WRITE_BARRIER_NIL,  
+  WRITE_BARRIER_SLOT,  
+  WRITE_BARRIER_OBJECT,
+  WRITE_BARRIER_UPDATE      
+}; 
+
+/* some globals */
+
+/* heap size limit is not interesting. only for manual tuning purpose */
+extern unsigned int min_heap_size_bytes;
+extern unsigned int max_heap_size_bytes;
+
+/* fspace size is variable, adjusted adaptively within the range */
+extern unsigned int min_nos_size_bytes;
+extern unsigned int max_nos_size_bytes;
+
+extern unsigned int block_size_bytes;
+
+typedef struct GC_Gen {
+  /* <-- First couple of fields overloadded as GC */
+  void* heap_start;
+  void* heap_end;
+  unsigned int reserved_heap_size;
+  unsigned int committed_heap_size;
+  unsigned int num_collections;
+  
+  /* mutation related info */
+  Mutator *mutator_list;
+  SpinLock mutator_list_lock;
+  unsigned int num_mutators;
+
+  /* collection related info */    
+  Collector** collectors;
+  unsigned int num_collectors;
+  unsigned int num_active_collectors; /* not all collectors are working */
+  
+  /* rootsets for collection (FIXME:: should be distributed to collectors) */
+  RootSet* root_set;
+  unsigned int collect_kind; /* MAJOR or MINOR */
+  
+  /* mem info */
+  apr_pool_t *aux_pool;
+  port_vmem_t *allocated_memory;
+  /* END of GC --> */
+  
+  Fspace *nos;
+  Mspace *mos;
+  Lspace *los;
+    
+  /* system info */ 
+  unsigned int _machine_page_size_bytes;
+  unsigned int _num_processors;
+  
+} GC_Gen;
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+void gc_gen_initialize(GC_Gen *gc, unsigned int initial_heap_size, unsigned int final_heap_size);
+void gc_gen_destruct(GC_Gen *gc);
+                        
+inline unsigned int gc_gen_free_memory_size(GC_Gen* gc)
+{  return fspace_free_memory_size(gc->nos) +
+         mspace_free_memory_size(gc->mos) +
+         lspace_free_memory_size(gc->los);  }
+                        
+void gc_gen_reclaim_heap(GC_Gen* gc, unsigned int cause);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+inline void gc_nos_initialize(GC_Gen* gc, void* start, unsigned int nos_size)
+{ fspace_initialize((GC*)gc, start, nos_size); }
+
+inline void gc_nos_destruct(GC_Gen* gc)
+{	fspace_destruct(gc->nos); }
+
+inline void gc_mos_initialize(GC_Gen* gc, void* start, unsigned int mos_size)
+{ mspace_initialize((GC*)gc, start, mos_size); }
+
+inline void gc_mos_destruct(GC_Gen* gc)
+{ mspace_destruct(gc->mos); }
+
+inline void gc_los_initialize(GC_Gen* gc, void* start, unsigned int los_size)
+{ lspace_initialize((GC*)gc, start, los_size); }
+
+inline void gc_los_destruct(GC_Gen* gc)
+{	lspace_destruct(gc->los); }
+
+inline Boolean address_belongs_to_nursery(void* addr, GC_Gen* gc)
+{ return address_belongs_to_space(addr, (Space*)gc->nos); }
+
+extern void* nos_boundary;
+extern void* los_boundary;
+
+inline Space* space_of_addr(GC* gc, void* addr)
+{
+  if( addr < nos_boundary) return (Space*)((GC_Gen*)gc)->nos;
+  if( addr < los_boundary) return (Space*)((GC_Gen*)gc)->mos;
+  return (Space*)((GC_Gen*)gc)->los;
+}
+
+void* mos_alloc(unsigned size, Alloc_Context *alloc_ctx);
+void* nos_alloc(unsigned size, Alloc_Context *alloc_ctx);
+void* los_alloc(unsigned size, Alloc_Context *alloc_ctx);
+Space* gc_get_nos(GC_Gen* gc);
+Space* gc_get_mos(GC_Gen* gc);
+Space* gc_get_los(GC_Gen* gc);
+void gc_set_nos(GC_Gen* gc, Space* nos);
+void gc_set_mos(GC_Gen* gc, Space* mos);
+void gc_set_los(GC_Gen* gc, Space* los);
+unsigned int gc_get_processor_num(GC_Gen* gc);
+
+void gc_preprocess_mutator(GC_Gen* gc);
+void gc_postprocess_mutator(GC_Gen* gc);
+void gc_preprocess_collector(Collector* collector);
+void gc_postprocess_collector(Collector* collector);
+
+#endif /* ifndef _GC_GEN_H_ */
+

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.cpp?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.cpp (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.cpp Mon Oct  9 07:18:29 2006
@@ -0,0 +1,91 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#include "mspace.h"
+
+static void mspace_init_blocks(Mspace* mspace)
+{
+  int size = sizeof(Block_Info)* mspace->num_total_blocks;
+  Block_Info* block_info =  (Block_Info*)STD_MALLOC(size);
+  memset(block_info, 0, size);
+  
+  for(unsigned int i=0; i < mspace->num_current_blocks; i++){
+    Block_Header* block = (Block_Header*)((unsigned int)space_heap_start((Space*)mspace) + i*mspace->block_size_bytes);
+    block->free = (void*)((unsigned int)block + GC_BLOCK_HEADER_SIZE_BYTES);
+    block->ceiling = (void*)((unsigned int)block + mspace->block_size_bytes); 
+    block->base = block->free;
+    block->block_idx = i;
+    
+    block_info[i].block = block;
+    block_info[i].status = BLOCK_FREE;  
+    block_info[i].reloc_table = new SlotVector();
+  }
+  
+  mspace->block_info = block_info;
+  
+  return;
+}
+
+struct GC_Gen;
+extern void gc_set_mos(GC_Gen* gc, Space* space);
+void mspace_initialize(GC* gc, void* start, unsigned int mspace_size)
+{
+    Mspace* mspace = (Mspace*)STD_MALLOC( sizeof(Mspace));
+    assert(mspace);
+    memset(mspace, 0, sizeof(Mspace));
+    
+    mspace->block_size_bytes = GC_BLOCK_SIZE_BYTES;
+    mspace->reserved_heap_size = mspace_size;
+    mspace->num_total_blocks = mspace_size/mspace->block_size_bytes;
+
+    mspace_size >>= 1;   
+    void* reserved_base = start;
+    int status = port_vmem_commit(&reserved_base, mspace_size, gc->allocated_memory); 
+    assert(status == APR_SUCCESS && reserved_base == start);
+    
+    memset(reserved_base, 0, mspace_size);
+    mspace->committed_heap_size = mspace_size;
+    mspace->heap_start = reserved_base;
+    mspace->heap_end = (void *)((unsigned int)reserved_base + mspace->reserved_heap_size);
+    mspace->num_current_blocks = mspace_size/mspace->block_size_bytes;
+    
+    mspace->num_used_blocks = 0;
+    mspace->free_block_idx = 0;
+    
+    mspace_init_blocks(mspace);
+    
+    mspace->obj_info_map = new ObjectMap();
+    mspace->mark_object_func = mspace_mark_object;
+    mspace->save_reloc_func = mspace_save_reloc;
+    mspace->update_reloc_func = mspace_update_reloc;
+
+    mspace->move_object = TRUE;
+    mspace->gc = gc;
+    gc_set_mos((GC_Gen*)gc, (Space*)mspace);
+
+    return;
+}
+
+
+void mspace_destruct(Mspace* mspace)
+{
+  /* inverse of initialize */
+}
+

Added: incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.h?view=auto&rev=454390
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/mark_compact/mspace.h Mon Oct  9 07:18:29 2006
@@ -0,0 +1,125 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/**
+ * @author Xiao-Feng Li, 2006/10/05
+ */
+
+#ifndef _MSC_SPACE_H_
+#define _MSC_SPACE_H_
+
+#include "../common/gc_common.h"
+#include "../thread/thread_alloc.h"
+
+typedef struct Block_Header {
+  void* base;                       
+  void* free;                       
+  void* ceiling;                    
+  unsigned int block_idx;           
+  unsigned int mark_table[1];  /* entry num == MARKBIT_TABLE_SIZE_WORDS */
+}Block_Header;
+
+enum Block_Status {
+  BLOCK_NIL,
+  BLOCK_FREE,
+  BLOCK_IN_USE,
+  BLOCK_USED
+};
+
+typedef struct Block_Info{
+  Block_Header* block;
+  Boolean status;
+
+  SlotVector* reloc_table;
+    
+}Block_Info;
+
+/* Mark-compaction space is orgnized into blocks*/
+typedef struct Mspace{
+  /* <-- first couple of fields are overloadded as Space */
+  void* heap_start;
+  void* heap_end;
+  unsigned int reserved_heap_size;
+  unsigned int committed_heap_size;
+  unsigned int num_collections;
+  GC* gc;
+  Boolean move_object;
+  Boolean (*mark_object_func)(Mspace* space, Partial_Reveal_Object* p_obj);
+  void (*save_reloc_func)(Mspace* space, Partial_Reveal_Object** p_ref);
+  void (*update_reloc_func)(Mspace* space);
+  /* END of Space --> */
+    
+  Block_Info* block_info; /* data structure for all the blocks */
+  
+  volatile unsigned int num_used_blocks;
+  volatile unsigned int free_block_idx;
+  unsigned int compact_block_low_idx;
+  unsigned int compact_block_high_idx;
+
+  unsigned int block_size_bytes;
+  unsigned int num_current_blocks;
+  unsigned int num_total_blocks;
+
+  /* during compaction, save non-zero obj_info who's overwritten by forwarding pointer */
+  ObjectMap*  obj_info_map; 
+    
+}Mspace;
+
+void mspace_initialize(GC* gc, void* reserved_base, unsigned int mspace_size);
+void mspace_destruct(Mspace* mspace);
+
+inline unsigned int mspace_free_memory_size(Mspace* mspace){ return GC_BLOCK_SIZE_BYTES * (mspace->num_current_blocks - mspace->num_used_blocks);  }
+inline Boolean mspace_has_free_block(Mspace* mspace){ return mspace->free_block_idx < mspace->num_current_blocks; }
+
+void* mspace_alloc(unsigned size, Alloc_Context *alloc_ctx);
+void mspace_collection(Mspace* mspace);
+
+#define GC_BLOCK_HEADER_VARS_SIZE_BYTES (unsigned int)&(((Block_Header*)0)->mark_table)
+
+/* BlockSize - MarkbitTable*32 = HeaderVars + MarkbitTable
+   => MarkbitTable = (BlockSize - HeaderVars)/33 */
+#define MARKBIT_TABLE_COMPUTE_DIVISOR 33
+/* +1 to round up*/
+#define MARKBIT_TABLE_COMPUTED_SIZE_BYTE ((GC_BLOCK_SIZE_BYTES-GC_BLOCK_HEADER_VARS_SIZE_BYTES)/MARKBIT_TABLE_COMPUTE_DIVISOR + 1)
+#define MARKBIT_TABLE_SIZE_WORDS ((MARKBIT_TABLE_COMPUTED_SIZE_BYTE + MASK_OF_BYTES_PER_WORD)&~MASK_OF_BYTES_PER_WORD)
+#define MARKBIT_TABLE_SIZE_BYTES (MARKBIT_TABLE_SIZE_WORDS * BYTES_PER_WORD)
+
+#define GC_BLOCK_HEADER_SIZE_BYTES (MARKBIT_TABLE_SIZE_BYTES + GC_BLOCK_HEADER_VARS_SIZE_BYTES)
+#define GC_BLOCK_BODY_SIZE_BYTES (GC_BLOCK_SIZE_BYTES - GC_BLOCK_HEADER_SIZE_BYTES)
+#define GC_BLOCK_BODY(block) ((void*)((unsigned int)block + GC_BLOCK_HEADER_SIZE_BYTES))
+#define GC_BLOCK_END(block) ((void*)((unsigned int)block + GC_BLOCK_SIZE_BYTES))
+
+#define GC_BLOCK_LOW_MASK ((unsigned int)(GC_BLOCK_SIZE_BYTES - 1))
+#define GC_BLOCK_HIGH_MASK (~GC_BLOCK_LOW_MASK)
+#define GC_BLOCK_HEADER(addr) ((Block_Header *)((unsigned int)addr & GC_BLOCK_HIGH_MASK))
+#define GC_BLOCK_INDEX(addr) ((unsigned int)(GC_BLOCK_HEADER(addr)->block_idx))
+#define GC_BLOCK_INFO_ADDRESS(mspace, addr) ((Block_Info *)&(mspace->block_info[GC_BLOCK_INDEX(addr)]))
+#define GC_BLOCK_INFO_BLOCK(mspace, block) ((Block_Info *)&(mspace->block_info[block->block_idx]))
+
+#define ADDRESS_OFFSET_TO_BLOCK_HEADER(addr) ((unsigned int)((unsigned int)addr&GC_BLOCK_LOW_MASK))
+#define ADDRESS_OFFSET_IN_BLOCK_BODY(addr) ((unsigned int)(ADDRESS_OFFSET_TO_BLOCK_HEADER(addr)- GC_BLOCK_HEADER_SIZE_BYTES))
+
+#define OBJECT_BIT_INDEX_TO_MARKBIT_TABLE(p_obj)    (ADDRESS_OFFSET_IN_BLOCK_BODY(p_obj) >> 2)
+#define OBJECT_WORD_INDEX_TO_MARKBIT_TABLE(p_obj)   (OBJECT_BIT_INDEX_TO_MARKBIT_TABLE(p_obj) >> BIT_SHIFT_TO_BITS_PER_WORD)
+#define OBJECT_WORD_OFFSET_IN_MARKBIT_TABLE(p_obj)  (OBJECT_BIT_INDEX_TO_MARKBIT_TABLE(p_obj) & BIT_MASK_TO_BITS_PER_WORD)
+
+#define GC_BLOCK_OBJECT_AT_INDEX(block, idx) (block->mark_table[idx])
+
+Boolean mspace_mark_object(Mspace* mspace, Partial_Reveal_Object *p_obj);
+void mspace_save_reloc(Mspace* mspace, Partial_Reveal_Object** p_ref);
+void mspace_update_reloc(Mspace* mspace);
+
+#endif //#ifdef _MSC_SPACE_H_
\ No newline at end of file



Mime
View raw message