harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r510534 - in /harmony/enhanced/drlvm/trunk: build/make/components/vm/interpreter.xml build/make/targets/build.native.xml vm/interpreter/src/interp_native_em64t.cpp vm/interpreter/src/invokeJNI_Windows_em64t.asm
Date Thu, 22 Feb 2007 14:29:08 GMT
Author: gshimansky
Date: Thu Feb 22 06:29:07 2007
New Revision: 510534

URL: http://svn.apache.org/viewvc?view=rev&rev=510534
Log:
Applied HARMONY-3213 [drlvm][winx64] interpreter update

Build works on windows x86_64


Added:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/build/make/components/vm/interpreter.xml
    harmony/enhanced/drlvm/trunk/build/make/targets/build.native.xml
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp

Modified: harmony/enhanced/drlvm/trunk/build/make/components/vm/interpreter.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm/interpreter.xml?view=diff&rev=510534&r1=510533&r2=510534
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm/interpreter.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm/interpreter.xml Thu Feb 22 06:29:07
2007
@@ -126,25 +126,29 @@
             </select>
         </compiler>
 
-        <select os="lnx">
-            <fileset id="asm.fileset" dir="${src}">
-                <select os="lnx" arch="ia32">
-                    <include name="invokeJNI_ia32.asm" />
-                </select>
+        <fileset id="asm.fileset" dir="${src}">
+            <select os="lnx" arch="ia32">
+                <include name="invokeJNI_ia32.asm" />
+            </select>
 
-                <select os="lnx" arch="em64t">
-                    <include name="invokeJNI_em64t.asm" />
-                </select>
+            <select os="lnx" arch="em64t">
+                <include name="invokeJNI_em64t.asm" />
+            </select>
 
-                <select os="lnx" arch="ipf">
-                    <include name="invokeJNI_ipf.asm" />
-                </select>
+            <select os="lnx" arch="ipf">
+                <include name="invokeJNI_ipf.asm" />
+            </select>
 
-                <select os="win" arch="ipf">
-                    <include name="invokeJNI_Windows_ipf.asm" />
-                </select>
-            </fileset>
-        </select>
+            <select os="win" arch="ia32">
+                <exclude name="*" />
+            </select>
+            <select os="win" arch="ipf">
+                <include name="invokeJNI_Windows_ipf.asm" />
+            </select>
+            <select os="win" arch="em64t">
+                <include name="invokeJNI_Windows_em64t.asm" />
+            </select>
+        </fileset>
 
         <linker id="linker" extends="common.linker">
             <select os="lnx">

Modified: harmony/enhanced/drlvm/trunk/build/make/targets/build.native.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/targets/build.native.xml?view=diff&rev=510534&r1=510533&r2=510534
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/targets/build.native.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/targets/build.native.xml Thu Feb 22 06:29:07 2007
@@ -81,6 +81,12 @@
             <equals arg1="${cfg.build}" arg2="debug" />
         </condition>
         <property name="is.cfg.debug" value="false" />
+
+        <condition property="object.suffix" value="obj">
+            <isset property="if.win" />
+        </condition>
+        <property name="object.suffix" value="o" />
+
             
         <property name="obj.out.dir" location="${build.dir}/_obj" />
         <mkdir dir="${obj.out.dir}" />
@@ -127,8 +133,14 @@
             <property name="asm.executable" value="icc" />
         </select>
         <select os="win">
-            <property name="asm.executable" value="ml" />
-            <property name="asm.add.arg" value="/c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd
  -DWIN32" />
+            <select arch="em64t">
+                <property name="asm.executable" value="ml64" />
+                <property name="asm.add.arg" value="/c /Cp /W3 /nologo /Zd /Zi -DWIN32"
/>
+            </select>
+            <select arch="ia32">
+                <property name="asm.executable" value="ml" />
+                <property name="asm.add.arg" value="/c /Cp /W3 /nologo /coff /Zm /Zd /Zi
/Gd -DWIN32" />
+            </select>
         </select>
 
         <condition property="asm.add.arg" value="-Wa,--fatal-warnings -c -x assembler-with-cpp
-g">
@@ -147,21 +159,21 @@
                 <propertyregex override="yes" property="object" input="@{file}" regexp=".*[/\\]([^\.]*)\.[^\.]*"
replace="\1" defaultValue="@{file}" />
                 <dependset>
                     <srcfileset refid="asm.fileset" />
-                    <targetfilelist dir="${build.dir}" files="${object}.o" />
+                    <targetfilelist dir="${build.dir}" files="${object}.${object.suffix}"
/>
                 </dependset>
                 <if>
                     <not>
-                        <available file="${build.dir}/${object}.o" />
+                        <available file="${build.dir}/${object}.${object.suffix}" />
                     </not>
                     <then>
                         <exec executable="${asm.executable}" failonerror="true">
                             <arg line="${asm.args}" />
                             <arg line="${asm.add.arg}" />
                             <select os="lnx">
-                                <arg line=" -o${build.dir}/_obj/${object}.o @{file} "
/>
+                                <arg line=" -o${build.dir}/_obj/${object}.${object.suffix}
@{file} " />
                             </select>
                             <select os="win">
-                                <arg line="/Fo${build.dir}/_obj/${object}.o @{file} "
/>
+                                <arg line="/Fo${build.dir}/_obj/${object}.${object.suffix}
@{file} " />
                             </select>
                         </exec>
                     </then>

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp?view=diff&rev=510534&r1=510533&r2=510534
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp Thu Feb 22 06:29:07
2007
@@ -36,19 +36,10 @@
 // ppervov: HACK: allows using STL modifiers (dec/hex) and special constants (endl)
 using namespace std;
 
-#ifdef _WIN32
-static int64 /*__declspec(naked)*/ __stdcall invokeJNI(uint64 *args, uword n_fps, uword n_stacks,
-        GenericFunctionPointer f) {
-    abort();
-    return(0);
-}
-#else /* Linux */
 extern "C" {
     int64 invokeJNI(uint64 *args, uword n_fps, uword n_stacks, GenericFunctionPointer f);
 }
 
-#endif
-
 typedef double (*DoubleFuncPtr)(uword*,uword,word,GenericFunctionPointer);
 typedef ManagedObject** (*RefFuncPtr)(uword*,uword,word,GenericFunctionPointer);
 typedef void* (*ObjFuncPtr)(uword*,uword,word,GenericFunctionPointer);
@@ -67,6 +58,14 @@
 CharFuncPtr invokeJNI_Char = (CharFuncPtr) invokeJNI;
 ByteFuncPtr invokeJNI_Byte = (ByteFuncPtr) invokeJNI;
 
+#ifdef _WIN32
+#define MAX_REG_FLOATS  4
+#define MAX_REG_INTS  4
+#else
+#define MAX_REG_FLOATS  8
+#define MAX_REG_INTS  6
+#endif
+
 void
 interpreter_execute_native_method(
         Method *method,
@@ -74,6 +73,7 @@
         jvalue *args) {
     assert(!hythread_is_suspend_enabled());
 
+
     DEBUG_TRACE("\n<<< interpreter_invoke_native: "
            << method->get_class()->get_name()->bytes << " "
            << method->get_name()->bytes
@@ -92,10 +92,10 @@
     int n_ints = 0;
     int n_fps = 0;
     int n_stacks = 0;
-    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (8 + sz + 2) * sizeof(uword));
+    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (MAX_REG_FLOATS + sz + 2) *
sizeof(uword));
     uword *fps = out_args + 1;
-    uword *ints = fps + 8;
-    uword *stacks = ints + 6;
+    uword *ints = fps + MAX_REG_FLOATS;
+    uword *stacks = ints + MAX_REG_INTS;
 
     int pos = 0;
     ints[n_ints++] = (uword) get_jni_native_intf();
@@ -118,7 +118,7 @@
                 {
                     jobject obj = args[pos++].l;
                     ObjectHandle UNUSED h = (ObjectHandle) obj;
-                    if (n_ints != 6) {
+                    if (n_ints != MAX_REG_INTS) {
                         ints[n_ints++] = (uword) obj;
                     } else {
                         stacks[n_stacks++] = (uword) obj;
@@ -133,7 +133,7 @@
             case JAVA_TYPE_BYTE:
             case JAVA_TYPE_INT:
                 // sign extend
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = (uword)(word) args[pos++].i;
                 } else {
                     stacks[n_stacks++] = (uword)(word) args[pos++].i;
@@ -143,7 +143,7 @@
             case JAVA_TYPE_BOOLEAN:
             case JAVA_TYPE_CHAR:
                 // zero extend
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = (word) args[pos++].i;
                 } else {
                     stacks[n_stacks++] = (word) args[pos++].i;
@@ -151,7 +151,7 @@
                 break;
 
             case JAVA_TYPE_LONG:
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = args[pos++].j;
                 } else {
                     stacks[n_stacks++] = args[pos++].j;
@@ -159,14 +159,14 @@
                 break;
 
             case JAVA_TYPE_FLOAT:
-                if (n_fps != 8) {
+                if (n_fps != MAX_REG_FLOATS) {
                     *(float*)&fps[n_fps++] = args[pos++].f;
                 } else {
                     *(float*)&stacks[n_stacks++] = args[pos++].f;
                 }
 
             case JAVA_TYPE_DOUBLE:
-                if (n_fps != 8) {
+                if (n_fps != MAX_REG_FLOATS) {
                     fps[n_fps++] = args[pos++].j;
                 } else {
                     stacks[n_stacks++] = args[pos++].j;
@@ -297,10 +297,10 @@
     int n_ints = 0;
     int n_fps = 0;
     int n_stacks = 0;
-    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (8 + sz + 2) * sizeof(uword));
+    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (MAX_REG_FLOATS + sz + 2) *
sizeof(uword));
     uword *fps = out_args + 1;
-    uword *ints = fps + 8;
-    uword *stacks = ints + 6;
+    uword *ints = fps + MAX_REG_FLOATS;
+    uword *stacks = ints + MAX_REG_INTS;
 
     frame.This = *(method->get_class()->get_class_handle());
     ints[n_ints++] = (uword) get_jni_native_intf();
@@ -331,7 +331,7 @@
                         arg = (uword) &cr;
 #endif
                     }
-                    if (n_ints != 6) {
+                    if (n_ints != MAX_REG_INTS) {
                         ints[n_ints++] = arg;
                     } else {
                         stacks[n_stacks++] = arg;
@@ -348,7 +348,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 // sign extend
                 arg = (uword)(word) prevFrame.stack.pick(pos--).i;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -360,7 +360,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 // zero extend
                 arg = prevFrame.stack.pick(pos--).u;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -371,7 +371,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 ASSERT_TAGS(!prevFrame.stack.ref(pos-1));
                 arg = prevFrame.stack.getLong(pos-1).u64;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -384,7 +384,7 @@
                     ASSERT_TAGS(!prevFrame.stack.ref(pos));
                     // zero extend
                     float farg = prevFrame.stack.pick(pos--).f;
-                    if (n_fps != 8) {
+                    if (n_fps != MAX_REG_FLOATS) {
                         *(float*)&fps[n_fps++] = farg;
                     } else {
                         *(float*)&stacks[n_stacks++] = farg;
@@ -397,7 +397,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos-1));
                 arg = prevFrame.stack.getLong(pos-1).u64;
 
-                if (n_fps != 8) {
+                if (n_fps != MAX_REG_FLOATS) {
                     fps[n_fps++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -576,10 +576,10 @@
     int n_ints = 0;
     int n_fps = 0;
     int n_stacks = 0;
-    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (8 + sz + 2) * sizeof(uword));
+    uword *out_args = (uword*) ALLOC_FRAME(8 + sizeof(char) + (MAX_REG_FLOATS + sz + 2) *
sizeof(uword));
     uword *fps = out_args + 1;
-    uword *ints = fps + 8;
-    uword *stacks = ints + 6;
+    uword *ints = fps + MAX_REG_FLOATS;
+    uword *stacks = ints + MAX_REG_INTS;
 
     ints[n_ints++] = (uword) get_jni_native_intf();
     ints[n_ints++] = (uword) &frame.This;
@@ -616,7 +616,7 @@
                         arg = (uword) &cr;
 #endif
                     }
-                    if (n_ints != 6) {
+                    if (n_ints != MAX_REG_INTS) {
                         ints[n_ints++] = arg;
                     } else {
                         stacks[n_stacks++] = arg;
@@ -632,7 +632,7 @@
                 // zero extend
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 arg = prevFrame.stack.pick(pos--).u;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -645,7 +645,7 @@
                 // sign extend
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 arg = (uword)(word) prevFrame.stack.pick(pos--).i;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -656,7 +656,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 ASSERT_TAGS(!prevFrame.stack.ref(pos-1));
                 arg = prevFrame.stack.getLong(pos-1).u64;
-                if (n_ints != 6) {
+                if (n_ints != MAX_REG_INTS) {
                     ints[n_ints++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;
@@ -668,7 +668,7 @@
                 {
                     ASSERT_TAGS(!prevFrame.stack.ref(pos));
                     float farg = prevFrame.stack.pick(pos--).f;
-                    if (n_fps != 8) {
+                    if (n_fps != MAX_REG_FLOATS) {
                         *(float*)&fps[n_fps++] = farg;
                     } else {
                         *(float*)&stacks[n_stacks++] = farg;
@@ -679,7 +679,7 @@
                 ASSERT_TAGS(!prevFrame.stack.ref(pos));
                 ASSERT_TAGS(!prevFrame.stack.ref(pos-1));
                 arg = prevFrame.stack.getLong(pos-1).u64;
-                if (n_fps != 8) {
+                if (n_fps != MAX_REG_FLOATS) {
                     fps[n_fps++] = arg;
                 } else {
                     stacks[n_stacks++] = arg;

Added: harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm?view=auto&rev=510534
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm (added)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm Thu Feb 22
06:29:07 2007
@@ -0,0 +1,52 @@
+
+PUBLIC	invokeJNI
+
+_TEXT	SEGMENT
+
+invokeJNI PROC
+
+;    int64 invokeJNI(uint64 *args, uword n_fps, uword n_stacks, GenericFunctionPointer f);
+;   rcx - memory
+;   rdx - n fp args
+;   r8  - n mem args
+;   r9  - function ptr
+
+	push	rbp
+	mov	rbp, rsp
+    mov rax, rcx ; mem
+    mov rcx, r8 ; n mem args
+
+; cycle to fill all fp args
+    movsd xmm0, qword ptr [rax+8]
+    movsd xmm1, qword ptr [rax+16]
+    movsd xmm2, qword ptr [rax+24]
+    movsd xmm3, qword ptr [rax+32]
+
+; store memory args
+	mov r10, r9 ; func ptr
+	lea	r9, qword ptr [rax+rcx*8+64]
+	sub	r9, rsp ; offset
+    cmp rcx, 0
+    jz cycle_end
+cycle:
+	push qword ptr [rsp+r9]
+	loop cycle
+cycle_end:
+    mov rcx, [rax + 40]
+    mov rdx, [rax + 48]
+    mov r8,  [rax + 56]
+    mov r9,  [rax + 64]
+
+    sub rsp, 32 ; shadow space
+
+	call	r10
+	leave
+	ret
+
+invokeJNI ENDP
+
+
+_TEXT	ENDS
+
+END
+

Propchange: harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message