Skip to content

Commit

Permalink
WIP migration of bootloader from C++ to C
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed Mar 5, 2009
1 parent c9ed392 commit d1bb949
Show file tree
Hide file tree
Showing 17 changed files with 792 additions and 106 deletions.
36 changes: 18 additions & 18 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ Check to make sure all required properties are specified. This includes properti

<target name="gen-runbootimage" depends="check-properties">
<mkdir dir="${build.native}"/>
<echo file="${build.native}/RunBootImage.h">
<echo file="${build.native}/bootloader.h">
const unsigned heap_default_initial_size = ${config.default-heapsize.initial}*1024*1024;
const unsigned heap_default_maximum_size = ${config.default-heapsize.maximum}*1024*1024;
const char *rvm_version = "Jikes RVM ${rvm.version} (r${svn.revision})";
Expand Down Expand Up @@ -1531,7 +1531,7 @@ Check to make sure all required properties are specified. This includes properti
<equals arg1="${target.arch.sse2}" arg2="none"/>
</condition>
<property name="rvm.common.args" value="${rvm.includes} ${rvm.defines} ${rvm.sse.args}"/>
<property name="rvm.c++.args" value="${shld.args} ${rvm.common.args}"/>
<property name="rvm.c.args" value="${shld.args} ${rvm.common.args}"/>

<condition property="rvm.arch.src"
value="${bl.dir}/ia32/initBootRecord.c ${bl.dir}/ia32/libvm.c ${bl.dir}/ia32/disasm.c ${bl.dir}/ia32/ihnpdsm.c">
Expand All @@ -1547,11 +1547,11 @@ Check to make sure all required properties are specified. This includes properti
<equals arg1="${config.include.perfctr}" arg2="true"/>
</condition>

<property name="rvm.syscall.src" value="${bl.dir}/sysAlignmentCheck.C ${bl.dir}/sysConsole.C ${bl.dir}/sysIO.C ${bl.dir}/sysLibrary.C ${bl.dir}/sysMath.C ${bl.dir}/sysMemory.C ${bl.dir}/sysMisc.C ${bl.dir}/sysPerfCtr.C ${bl.dir}/sysThread.C ${bl.dir}/sysTime.C"/>
<property name="rvm.syscall.src" value="${bl.dir}/sysAlignmentCheck.c ${bl.dir}/sysConsole.c ${bl.dir}/sysIO.c ${bl.dir}/sysLibrary.c ${bl.dir}/sysMath.c ${bl.dir}/sysMemory.c ${bl.dir}/sysMisc.c ${bl.dir}/sysPerfCtr.c ${bl.dir}/sysThread.c ${bl.dir}/sysTime.c"/>

<condition property="rvm.src"
value="${bl.dir}/RunBootImage.C ${bl.dir}/sysGCSpy.C ${rvm.syscall.src} ${rvm.arch.src} ${perfctr.src}"
else="${bl.dir}/RunBootImage.C ${rvm.syscall.src} ${rvm.arch.src} ${perfctr.src}">
value="${bl.dir}/main.c ${bl.dir}/sysGCSpy.c ${rvm.syscall.src} ${rvm.arch.src} ${perfctr.src}"
else="${bl.dir}/main.c ${rvm.syscall.src} ${rvm.arch.src} ${perfctr.src}">
<equals arg1="include.gcspy" arg2="true"/>
</condition>
</target>
Expand All @@ -1577,15 +1577,15 @@ Check to make sure all required properties are specified. This includes properti
<target name="build-bootloader" depends="build-gcspy-stub,build-ppc-bootThread">

<!-- rdynamic flag used to control the exporting of symbols into an ELF -->
<condition property="c++.rdynamic" value="" else="-rdynamic">
<condition property="c.rdynamic" value="" else="-rdynamic">
<or>
<equals arg1="${target.os}" arg2="OSX"/>
<equals arg1="${target.os}" arg2="AIX" />
</or>
</condition>

<!-- is the real-time library necessary? -->
<condition property="c++.librt" value="" else="-lrt">
<condition property="c.librt" value="" else="-lrt">
<or>
<equals arg1="${target.os}" arg2="OSX"/>
<equals arg1="${target.os}" arg2="Windows"/>
Expand All @@ -1600,11 +1600,11 @@ Check to make sure all required properties are specified. This includes properti
<path id="rvm.obj">
<pathelement path="${build.base}/${target.dll-prefix}rvm.obj"/>
</path>
<exec executable="${c++.exe}" failonerror="true">
<arg line="${rvm.c++.args} -lpthread ${c++.librt}"/>
<exec executable="${c.exe}" failonerror="true">
<arg line="${rvm.c.args} -lpthread ${c.librt}"/>
<arg value="-o"/>
<arg path="${toString:rvm.dll}"/>
<arg path="${bl.dir}/jvm.C"/>
<arg path="${bl.dir}/jvm.c"/>
</exec>

<!-- create vmi shared library -->
Expand All @@ -1618,7 +1618,7 @@ Check to make sure all required properties are specified. This includes properti
<pathelement path="${build.base}/${target.dll-prefix}vmi${target.dll-ext}"/>
</path>
<exec executable="${c.exe}" failonerror="true">
<arg line="-DLINUX=1 ${rvm.c++.args} -lpthread ${c++.librt} -L${harmony.lib.dir} -lhyprt -lhyarchive -lhyzlib"/>
<arg line="-DLINUX=1 ${rvm.c.args} -lpthread ${c.librt} -L${harmony.lib.dir} -lhyprt -lhyarchive -lhyzlib"/>
<arg value="-o"/>
<arg value="${toString:vmi.dll}"/>
<arg value="${bl.dir}/harmony.c"/>
Expand All @@ -1631,8 +1631,8 @@ Check to make sure all required properties are specified. This includes properti
<!-- create rvmdynlib shared library -->
<echo message="Creating rvmdynlib.dll"/>
<property name="rvmdynlib.dll" value="${target.dll-prefix}rvmdynlib${target.jni-suffix}"/>
<exec executable="${c++.exe}" failonerror="true">
<arg line="${rvm.c++.args}"/>
<exec executable="${c.exe}" failonerror="true">
<arg line="${rvm.c.args}"/>
<arg value="-o"/>
<arg value="${build.base}/${rvmdynlib.dll}"/>
<arg value="-L${build.base}"/>
Expand All @@ -1650,8 +1650,8 @@ Check to make sure all required properties are specified. This includes properti
</conditions>
<sequential>
<echo message="Creating JikesRVM"/>
<exec executable="${c++.exe}" failonerror="true">
<arg line="${c++.args} ${rvm.common.args} ${gcspy.lib.dir} -lpthread ${perfctr.lib} ${c++.librt} ${rvm.src} ${c++.rdynamic} -g"/>
<exec executable="${c.exe}" failonerror="true">
<arg line="${c.args} ${rvm.common.args} ${gcspy.lib.dir} -lpthread ${perfctr.lib} ${c.librt} ${rvm.src} ${c.rdynamic} -g"/>
<arg value="-o"/>
<arg path="${build.base}/JikesRVM"/>
<arg value="-L${build.base}"/>
Expand All @@ -1666,8 +1666,8 @@ Check to make sure all required properties are specified. This includes properti
</conditions>
<sequential>
<echo message="Creating JikesRVM"/>
<exec executable="${c++.exe}" failonerror="true">
<arg line="${c++.args} ${rvm.common.args} ${gcspy.lib.dir} -lpthread ${perfctr.lib} ${c++.librt} ${c++.rdynamic} -g"/>
<exec executable="${c.exe}" failonerror="true">
<arg line="${c.args} ${rvm.common.args} ${gcspy.lib.dir} -lpthread ${perfctr.lib} ${c.librt} ${c.rdynamic} -g"/>
<arg value="-o"/>
<arg path="${build.base}/JikesRVM"/>
<arg value="-L${build.base}"/>
Expand All @@ -1694,7 +1694,7 @@ Check to make sure all required properties are specified. This includes properti
<arg path="${build.base}/JikesRVM-symbols.s"/>
</exec>

<exec executable="${c++.exe}" failonerror="true">
<exec executable="${c.exe}" failonerror="true">
<arg value="-c"/>
<arg value="-o"/>
<arg value="${build.base}/JikesRVM-symbols.o"/>
Expand Down
14 changes: 7 additions & 7 deletions tools/bootloader/jni/org_jikesrvm_runtime_DynamicLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
* JNI functions to support OnLoad
*/

// Java includes
/* Java includes */
#include <jni.h>

// generated class header
/* generated class header */
#include "org_jikesrvm_runtime_DynamicLibrary.h"

extern struct Java sysJavaVM;
extern struct JavaVM_ sysJavaVM;

typedef jint (*JNI_OnLoad)(Java *vm, void *reserved);
typedef jint (*JNI_OnLoad)(struct JavaVM_ *vm, void *reserved);

/*
* Class: comibm.jikesrvm.DynamicLibrary
* Method: runJNI_OnLoad
* Signature: (Lorg/vmmagic/unboxed/Address;)I
*/
extern "C" JNIEXPORT jint JNICALL Java_org_jikesrvm_runtime_DynamicLibrary_runJNI_1OnLoad (JNIEnv *env,
jclass clazz,
jobject JNI_OnLoadAddress) {
JNIEXPORT jint JNICALL Java_org_jikesrvm_runtime_DynamicLibrary_runJNI_1OnLoad (JNIEnv *env,
jclass clazz,
jobject JNI_OnLoadAddress) {
return ((JNI_OnLoad)JNI_OnLoadAddress)(&sysJavaVM, NULL);
}
File renamed without changes.
Loading

0 comments on commit d1bb949

Please sign in to comment.