ffi/native.o: ffi/native.c
ghc -Wall -O2 -c $< -o $@
+runtime: jmate/lang/MateRuntime.java
+ javac jmate/lang/MateRuntime.java
+ javah -o rts/mock/jmate_lang_MateRuntime.h jmate.lang.MateRuntime
+ gcc -shared -fPIC -I$(JAVA_HOME)/include rts/mock/jmate_lang_MateRuntime.c -I./rts/mock -o rts/mock/libMateRuntime.so
+
GHCCALL = ghc --make $(GHC_OPT) Mate.hs ffi/trap.c -o $@ $(GHC_LD) -outputdir
mate: Mate.hs ffi/trap.c $(HS_FILES) $(HS_BOOT) ffi/native.o $(CLASS_FILES)
@mkdir -p $(B_RELEASE)
import Mate.ClassPool
import Mate.Debug
import Mate.Utilities
-import Mate.GarbageAlloc
+import Mate.Rts()
foreign import ccall "dynamic"
code_void :: FunPtr (IO ()) -> IO ()
foreign import ccall "&printMemoryUsage"
printMemoryUsageAddr :: FunPtr (IO ())
+foreign import ccall "&loadLibrary"
+ loadLibraryAddr :: FunPtr (IO ())
+
getMethodEntry :: CPtrdiff -> CPtrdiff -> IO CPtrdiff
getMethodEntry signal_from methodtable = do
mmap <- getMethodMap
let scm = toString cm; smethod = toString method
if scm == "jmate/lang/MateRuntime" then do
case smethod of
+ "loadLibrary" ->
+ return . funPtrToAddr $ loadLibraryAddr
"demoInterfaceCall" ->
return . funPtrToAddr $ demoInterfaceCallAddr
"printMemoryUsage" ->
--- /dev/null
+module Mate.Rts (loadLibrary) where
+
+foreign export ccall loadLibrary :: IO ()
+loadLibrary :: IO ()
+loadLibrary = print "load lib"
package jmate.lang;
public class MateRuntime {
- public static native void demoInterfaceCall(int val);
- public static native void printMemoryUsage();
+
+ public static native void loadLibrary(String lib);
+ public static native int getCurrentHeapSize();
}
--- /dev/null
+package jmate.lang;
+
+public class Runtime
+{
+ public Runtime()
+ {
+ }
+
+ public void loadLibrary(String name)
+ {
+ }
+
+ public static Runtime getRuntime()
+ {
+ return new Runtime();
+ }
+}
--- /dev/null
+#include "jmate_lang_MateRuntime.h"
+
+JNIEXPORT jint JNICALL Java_jmate_lang_MateRuntime_getCurrentHeapSize
+ (JNIEnv *env, jclass class)
+{
+ return 0;
+}
+
+
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class jmate_lang_MateRuntime */
+
+#ifndef _Included_jmate_lang_MateRuntime
+#define _Included_jmate_lang_MateRuntime
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: jmate_lang_MateRuntime
+ * Method: getCurrentHeapSize
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_jmate_lang_MateRuntime_getCurrentHeapSize
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
public class Garbage1
{
-
+ static
+ {
+ loadLibrary();
+ }
+
+ public static void loadLibrary()
+ {
+ //Runtime.getRuntime().loadLibrary("MateRuntime");
+ }
public Garbage1(){}
public Big2()
{
- arr = new int[0x400];
+ arr = new int[0xF400];
//System.out.println("foo");
}
class2test=$1
-openjdk="java -client"
+openjdk="java -client -Djava.library.path=rts/mock"
openjdk_output=`mktemp`
mate="./mate"
mate_output=`mktemp`