You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2008/03/03 19:59:09 UTC

svn commit: r633236 - in /harmony/enhanced/drlvm/trunk: make/vm/ vm/doc/ vm/include/open/ vm/port/include/ vm/port/src/thread/linux/ vm/port/src/thread/win/ vm/tests/unit/thread/ vm/thread/doc/ vm/thread/src/ vm/vmcore/src/jvmti/ vm/vmcore/src/lil/em64...

Author: gshimansky
Date: Mon Mar  3 10:59:04 2008
New Revision: 633236

URL: http://svn.apache.org/viewvc?rev=633236&view=rev
Log:
Applied patch 0010 from HARMONY-5504
[drlvm][port] Restructure DRLVM's sources to extract most of platform dependent code into portlib

Patch implements transfer control code to Registers context
and renames memory RW barriers


Added:
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_em64t.s
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_ia32.s
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp   (with props)
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_em64t.asm
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_ia32.asm
Removed:
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/apr_thread_ext.c
    harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/apr_thread_ext.c
Modified:
    harmony/enhanced/drlvm/trunk/make/vm/port.xml
    harmony/enhanced/drlvm/trunk/vm/doc/doc.properties
    harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
    harmony/enhanced/drlvm/trunk/vm/port/include/port_general.h
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_1.c
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_2.c
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_3.c
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_4.c
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_5.c
    harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_6.c
    harmony/enhanced/drlvm/trunk/vm/thread/doc/ThreadManager.htm
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp

Modified: harmony/enhanced/drlvm/trunk/make/vm/port.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/make/vm/port.xml?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/make/vm/port.xml (original)
+++ harmony/enhanced/drlvm/trunk/make/vm/port.xml Mon Mar  3 10:59:04 2008
@@ -54,6 +54,7 @@
             <include name="modules/*.c"/>
             <include name="modules/linux/*.c" if="is.unix"/>
             <include name="modules/win/*.c" if="is.windows"/>
+            <include name="thread/linux/*ipf.cpp" if="is.unix.ia64"/>
         </patternset>
 
         <depend-includes paths="port.includes"/>
@@ -65,6 +66,10 @@
                 <include name="atomic/win/*.asm" if="is.windows.x86_64"/>
                 <include name="atomic/linux_ipf/port_atomic_asm.asm" if="is.unix.ia64"/>
                 <include name="barriers/linux_ipf/port_barriers.asm" if="is.unix.ia64"/>
+                <include name="thread/win/thread_asm_ia32.asm" if="is.windows.x86"/>
+                <include name="thread/win/thread_asm_em64t.asm" if="is.windows.x86_64"/>
+                <include name="thread/linux/thread_asm_ia32.s" if="is.unix.x86"/>
+                <include name="thread/linux/thread_asm_em64t.s" if="is.unix.x86_64"/>
             </fileset>
         </compile-asm>
         

Modified: harmony/enhanced/drlvm/trunk/vm/doc/doc.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/doc/doc.properties?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/doc/doc.properties (original)
+++ harmony/enhanced/drlvm/trunk/vm/doc/doc.properties Mon Mar  3 10:59:04 2008
@@ -132,7 +132,6 @@
 ${classlib.dir}/modules/luni/src/main/native/include/shared/vmi.h \
 
 apr_extension.intf= \
-port/include/apr_thread_ext.h  \
 port/include/clog.h  \
 port/include/cxxlog.h  \
 port/include/lil.h  \

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h Mon Mar  3 10:59:04 2008
@@ -133,7 +133,7 @@
 #include <apr_portable.h>
 
 #include <assert.h>
-#include "apr_thread_ext.h"
+#include "port_barriers.h"
 
 //@{
 /**
@@ -641,7 +641,7 @@
     thread = tm_self_tls;
     ((HyThread_public *)thread)->disable_count++;
 
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (((HyThread_public *)thread)->request && 
 	((HyThread_public *)thread)->disable_count == 1) {

Modified: harmony/enhanced/drlvm/trunk/vm/port/include/port_general.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/include/port_general.h?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/include/port_general.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/include/port_general.h Mon Mar  3 10:59:04 2008
@@ -38,11 +38,11 @@
 #else // !__cplusplus
 
 #ifdef WIN32
-#define PORT_INLINE __inline
+#define PORT_INLINE __forceinline
 #else // !WIN32
 
 #ifdef __linux__
-#define PORT_INLINE inline  __attribute__((always_inline))
+#define PORT_INLINE static  __attribute__((always_inline))
 #else // !__linux__
 #define PORT_INLINE static
 #endif // __linux__

Added: harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_em64t.s
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_em64t.s?rev=633236&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_em64t.s (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_em64t.s Mon Mar  3 10:59:04 2008
@@ -0,0 +1,82 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+	.text
+	.align 16
+
+// struct Registers {
+// uint64 rsp;   ; 00h
+// uint64 rbp;   ; 08h
+// uint64 rip;   ; 10h
+// // callee-saved
+// uint64 rbx;   ; 18h
+// uint64 r12;   ; 20h
+// uint64 r13;   ; 28h
+// uint64 r14;   ; 30h
+// uint64 r15;   ; 38h
+// // scratched
+// uint64 rax;   ; 40h
+// uint64 rcx;   ; 48h
+// uint64 rdx;   ; 50h
+// uint64 rsi;   ; 58h
+// uint64 rdi;   ; 60h
+// uint64 r8;    ; 68h
+// uint64 r9;    ; 70h
+// uint64 r10;   ; 78h
+// uint64 r11;   ; 80h
+//
+// uint32 eflags;; 88h
+// };
+//
+// void transfer_to_regs(Registers* regs)
+
+.globl transfer_to_regs
+	.type	transfer_to_regs, @function
+transfer_to_regs:
+    movq    %rdi, %rdx // regs pointer (1st param - RDI) -> RDX
+
+    movq    0x08(%rdx), %rbp // RBP field
+    movq    0x18(%rdx), %rbx // RBX field
+    movq    0x20(%rdx), %r12 // R12 field
+    movq    0x28(%rdx), %r13 // R13 field
+    movq    0x30(%rdx), %r14 // R14 field
+    movq    0x38(%rdx), %r15 // R15 field
+    movq    0x58(%rdx), %rsi // RSI field
+    movq    0x60(%rdx), %rdi // RDI field
+    movq    0x68(%rdx), %r8  // R8 field
+    movq    0x70(%rdx), %r9  // R9 field
+    movq    0x78(%rdx), %r10 // R10 field
+    movq    0x80(%rdx), %r11 // R11 field
+
+    movq    0x00(%rdx), %rax // (new RSP) -> RAX
+    movq    %rax, (%rsp)     // (new RSP) -> [RSP] for future use
+    movq    0x10(%rdx), %rcx // (new RIP) -> RCX
+    movq    %rcx, -0x88(%rax)// (new RIP) -> [(new RSP) - 128 - 8]
+    movq    0x40(%rdx), %rax // RAX field
+
+    movzbq  0x88(%rdx), %rcx // (EFLAGS & 0xff) -> RCX
+    test    %rcx, %rcx
+    je      __skipefl__
+    push    %rcx
+    popfq
+__skipefl__:
+
+    movq    0x48(%rdx), %rcx // RCX field
+    movq    0x50(%rdx), %rdx // RDX field
+
+    movq    (%rsp), %rsp     // load new RSP
+    jmpq    * -0x88(%rsp)    // JMP to new RIP
+

Added: harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_ia32.s
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_ia32.s?rev=633236&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_ia32.s (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_asm_ia32.s Mon Mar  3 10:59:04 2008
@@ -0,0 +1,58 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+	.text
+	.align 4
+
+// struct Registers {
+// uint32 eax;    +00
+// uint32 ebx;    +04
+// uint32 ecx;    +08
+// uint32 edx;    +0C
+// uint32 edi;    +10
+// uint32 esi;    +14
+// uint32 ebp;    +18
+// uint32 esp;    +1C
+// uint32 eip;    +20
+// uint32 eflags; +24
+// };
+//
+// void transfer_to_regs(Registers* regs)
+
+.globl transfer_to_regs
+	.type	transfer_to_regs, @function
+transfer_to_regs:
+    movl    0x04(%esp), %edx // store regs pointer to EDX
+    movl    0x20(%edx), %ebx // EIP field -> EBX
+    movl    0x1C(%edx), %ecx // ESP field
+    subl    $4, %ecx
+    movl    %ecx, 0x04(%esp) // (new ESP - 4) -> [ESP + 4] (safe storage)
+    movl    0x14(%edx), %esi // ESI field
+    movl    0x10(%edx), %edi // EDI field
+    movl    0x18(%edx), %ebp // EBP field
+    movl    %ebx, (%ecx)     // new EIP -> (new ESP - 4) (as return address)
+    movl    0x00(%edx), %eax // EAX field
+    movl    0x04(%edx), %ebx // EBX field
+    movzbl  0x24(%edx), %ecx // (EFLAGS & 0xff) -> ECX
+    test    %ecx, %ecx
+    je      _label_
+    push    %ecx             // restore EFLAGS
+    popfl
+_label_:
+    movl    0x08(%edx), %ecx // ECX field
+    movl    0x0C(%edx), %edx // EDX field
+    movl    0x04(%esp), %esp // ((new ESP - 4) -> ESP
+    ret                      // JMP by RET

Added: harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp?rev=633236&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp Mon Mar  3 10:59:04 2008
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "open/platform_types.h"
+
+
+void transfer_to_regs(Registers* regs)
+{
+    // FIXME: not implemented
+    fprintf(stderr, "FIXME: transfer_to_regs: not implemented\n");
+    assert(0);
+    abort();
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/port/src/thread/linux/thread_ipf.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_em64t.asm
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_em64t.asm?rev=633236&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_em64t.asm (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_em64t.asm Mon Mar  3 10:59:04 2008
@@ -0,0 +1,89 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License.  You may obtain a copy of the License at
+;
+;    http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+
+_TEXT   SEGMENT
+
+; struct Registers {
+; uint64 rsp;   ; 00h
+; uint64 rbp;   ; 08h
+; uint64 rip;   ; 10h
+; // callee-saved
+; uint64 rbx;   ; 18h
+; uint64 r12;   ; 20h
+; uint64 r13;   ; 28h
+; uint64 r14;   ; 30h
+; uint64 r15;   ; 38h
+; // scratched
+; uint64 rax;   ; 40h
+; uint64 rcx;   ; 48h
+; uint64 rdx;   ; 50h
+; uint64 rsi;   ; 58h
+; uint64 rdi;   ; 60h
+; uint64 r8;    ; 68h
+; uint64 r9;    ; 70h
+; uint64 r10;   ; 78h
+; uint64 r11;   ; 80h
+;
+; uint32 eflags;; 88h
+; };
+;
+; void transfer_to_regs(Registers* regs)
+
+PUBLIC  transfer_to_regs
+
+transfer_to_regs PROC
+
+    mov     rdx, rcx ; regs pointer (1st param - RCX) -> RDX
+
+    mov     rbp, qword ptr [rdx+08h] ; RBP field
+    mov     rbx, qword ptr [rdx+18h] ; RBX field
+    mov     r12, qword ptr [rdx+20h] ; R12 field
+    mov     r13, qword ptr [rdx+28h] ; R13 field
+    mov     r14, qword ptr [rdx+30h] ; R14 field
+    mov     r15, qword ptr [rdx+38h] ; R15 field
+    mov     rsi, qword ptr [rdx+58h] ; RSI field
+    mov     rdi, qword ptr [rdx+60h] ; RDI field
+    mov     r8,  qword ptr [rdx+68h] ; R8 field
+    mov     r9,  qword ptr [rdx+70h] ; R9 field
+    mov     r10, qword ptr [rdx+78h] ; R10 field
+    mov     r11, qword ptr [rdx+80h] ; R11 field
+
+    mov     rax, qword ptr [rdx+00h] ; (new RSP) -> RAX
+    mov     qword ptr [rsp], rax     ; (new RSP) -> [RSP] for future use
+    mov     rcx, qword ptr [rdx+10h] ; (new RIP) -> RCX
+    mov     qword ptr [rax-88h],rcx  ; (new RIP) -> [(new RSP) - 128 - 8]
+    mov     rax, qword ptr [rdx+40h] ; RAX field
+
+    movzx   rcx,  byte ptr [rdx+88h] ; (EFLAGS & 0xff) -> RCX
+    test    rcx, rcx
+    je      __skipefl__
+    push    rcx
+    popfq
+__skipefl__:
+
+    mov     rcx, qword ptr [rdx+48h] ; RCX field
+    mov     rdx, qword ptr [rdx+50h] ; RDX field
+
+    mov     rsp, qword ptr [rsp]     ; load new RSP
+    jmp     qword ptr [rsp-88h]      ; JMP to new RIP
+
+transfer_to_regs ENDP
+
+
+_TEXT   ENDS
+
+END

Added: harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_ia32.asm
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_ia32.asm?rev=633236&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_ia32.asm (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/thread/win/thread_asm_ia32.asm Mon Mar  3 10:59:04 2008
@@ -0,0 +1,68 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License.  You may obtain a copy of the License at
+;
+;    http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+        .386P
+
+_TEXT   SEGMENT PARA USE32 PUBLIC 'CODE'
+
+; struct Registers {
+; uint32 eax;    +00
+; uint32 ebx;    +04
+; uint32 ecx;    +08
+; uint32 edx;    +0C
+; uint32 edi;    +10
+; uint32 esi;    +14
+; uint32 ebp;    +18
+; uint32 esp;    +1C
+; uint32 eip;    +20
+; uint32 eflags; +24
+; };
+;
+; void transfer_to_regs(Registers* regs)
+
+PUBLIC  transfer_to_regs
+
+transfer_to_regs PROC
+
+    mov     edx, dword ptr [esp+04h] ; store regs pointer to EDX
+    mov     ebx, dword ptr [edx+20h] ; EIP field -> EBX
+    mov     ecx, dword ptr [edx+1Ch] ; ESP field
+    sub     ecx,4
+    mov     dword ptr [esp+04h], ecx ; (new ESP - 4) -> [ESP + 4] (safe storage)
+    mov     esi, dword ptr [edx+14h] ; ESI field
+    mov     edi, dword ptr [edx+10h] ; EDI field
+    mov     ebp, dword ptr [edx+18h] ; EBP field
+    mov     dword ptr [ecx], ebx     ; new EIP -> (new ESP - 4) (as return address)
+    mov     eax, dword ptr [edx+00h] ; EAX field
+    mov     ebx, dword ptr [edx+04h] ; EBX field
+    movzx   ecx,  byte ptr [edx+24h] ; (EFLAGS & 0xff) -> ECX
+    test    ecx, ecx
+    je      _label_
+    push    ecx                      ; restore EFLAGS
+    popfd
+_label_:
+    mov     ecx, dword ptr [edx+08h] ; ECX field
+    mov     edx, dword ptr [edx+0Ch] ; EDX field
+    mov     esp, dword ptr [esp+04h] ; ((new ESP - 4) -> ESP
+    ret                              ; JMP by RET
+
+transfer_to_regs ENDP
+
+
+_TEXT   ENDS
+
+END
+

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_1.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_1.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_1.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_1.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_2.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_2.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_2.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_2.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_3.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_3.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_3.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_3.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_4.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_4.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_4.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_4.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_5.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_5.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_5.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_5.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_6.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_6.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_6.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend_6.c Mon Mar  3 10:59:04 2008
@@ -15,7 +15,7 @@
 *  limitations under the License.
 */
 
-#include <apr_thread_ext.h>
+#include <port_barriers.h>
 #include <port_sysinfo.h>
 #include <open/hythread.h>
 #include <open/hythread_ext.h>
@@ -46,7 +46,7 @@
     assert(((HyThread_public *)thread)->group == get_java_thread_group());
 
     ((HyThread_public *)thread)->disable_count++;
-    //apr_memory_rw_barrier();
+    //port_rw_barrier();
 
     if (thread->request && thread->disable_count == 1) {
         // enter to safe point if suspend request was set

Modified: harmony/enhanced/drlvm/trunk/vm/thread/doc/ThreadManager.htm
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/doc/ThreadManager.htm?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/doc/ThreadManager.htm (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/doc/ThreadManager.htm Mon Mar  3 10:59:04 2008
@@ -375,7 +375,7 @@
             <b>The porting layer</b> to interact with the underlying
             system and enable <a href="#Portability">portability</a>
             for threading. The TM native layer queries functions of
-            the APR interfaces and the apr_thread_ext interface.
+            the APR interfaces and the portlib interfaces.
          
          <li>
             <b>The just-in-time compiler</b> to provide optimized

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c Mon Mar  3 10:59:04 2008
@@ -26,6 +26,7 @@
 #include <open/hythread_ext.h>
 #include "thread_private.h"
 #include <apr_atomic.h>
+#include "port_barriers.h"
 
 static void thread_safe_point_impl(hythread_t thread);
 
@@ -126,7 +127,7 @@
     // set disable count to 0 (safe region value)
     gc_disable_count = thread->disable_count;
     thread->disable_count = 0;
-    apr_memory_rw_barrier();
+    port_rw_barrier();
 
     do {
         TRACE(("safe point enter: thread: %p, suspend_count: %d, request: %d",
@@ -464,7 +465,7 @@
     assert(count >= 0);
     self->disable_count = count;
 
-    apr_memory_rw_barrier();
+    port_rw_barrier();
 
     if (count && self->suspend_count) {
         thread_safe_point_impl(self);

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c Mon Mar  3 10:59:04 2008
@@ -27,6 +27,7 @@
 #include "thread_private.h"
 #include <apr_atomic.h>
 #include <port_atomic.h>
+#include "port_barriers.h"
 
 /** @name Thin monitors support. Implement thin-fat scheme.
  */
@@ -94,7 +95,7 @@
     lockword&=0x7FF;
     lockword|=(monitor_id << 11) | 0x80000000;
     *lockword_ptr=lockword;
-    apr_memory_rw_barrier();
+    port_rw_barrier();
 }
 
 IDATA get_fat_lock_id(hythread_thin_monitor_t *lockword_ptr) {

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h Mon Mar  3 10:59:04 2008
@@ -30,7 +30,6 @@
 #include <apr_portable.h>
 
 #include <assert.h>
-#include "apr_thread_ext.h"
 
 #ifdef __linux__
 #include <pthread.h>

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Mon Mar  3 10:59:04 2008
@@ -38,6 +38,7 @@
 #include "ncai_internal.h"
 #include "jvmti_break_intf.h"
 #include "cci.h"
+#include "port_thread.h"
 
 
 #if (defined _IA32_) || (defined _EM64T_)
@@ -616,10 +617,8 @@
         // context. In case the target location happens to be
         // instrumented, it means that another breakpoint has been set
         // there right after unlock was done.
-        StackIterator* si = (StackIterator*) STD_ALLOCA(si_size());
-        si_fill_from_registers(si, &regs, false, m2n_get_previous_frame(m2nf));
-
-        si_transfer_control(si);
+        m2n_set_last_frame(m2n_get_previous_frame(m2nf));
+        transfer_to_regs(&regs);
     }
     assert(bp->addr == addr);
     TRACE2("jvmti.break", "Process native breakpoint: "
@@ -836,11 +835,9 @@
     // transfers execution control to the instruction buffer to
     // execute the original instruction with the registers which it
     // had before breakpoint happened
-    StackIterator* si = (StackIterator*) STD_ALLOCA(si_size());
-    si_fill_from_registers(si, &regs, false, m2n_get_previous_frame(m2nf));
-
-    si_set_ip(si, instruction_buffer, false);
-    si_transfer_control(si);
+    m2n_set_last_frame(m2n_get_previous_frame(m2nf));
+    regs.set_ip(instruction_buffer);
+    transfer_to_regs(&regs);
 #else
     // PLATFORM dependent code
     abort();

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/em64t/stack_iterator_em64t.cpp Mon Mar  3 10:59:04 2008
@@ -177,7 +177,7 @@
         return addr;
     }
 
-    const int STUB_SIZE = 247;
+    const int STUB_SIZE = 239;
     char * stub = (char *)malloc_fixed_code_for_jit(STUB_SIZE,
         DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_COLD, CAA_Allocate);
     char * ss = stub;
@@ -225,14 +225,12 @@
     ss = get_reg(ss, rax_opnd, rdx_reg, CONTEXT_OFFSET(p_rax), true);
 
     // Restore processor flags
-    ss = alu(ss, xor_opc, rcx_opnd,  rcx_opnd);
-    ss = mov(ss, rcx_opnd,  M_Base_Opnd(rdx_reg, CONTEXT_OFFSET(eflags)), size_8);
+    ss = movzx(ss, rcx_opnd,  M_Base_Opnd(rdx_reg, CONTEXT_OFFSET(eflags)), size_8);
     ss = test(ss, rcx_opnd, rcx_opnd);
     ss = branch8(ss, Condition_Z,  Imm_Opnd(size_8, 0));
     char* patch_offset = ((char*)ss) - 1; // Store location for jump patch
-    ss = alu(ss, and_opc, rcx_opnd, Imm_Opnd(size_32, 0xff));
     ss = push(ss,  rcx_opnd);
-    *ss++ = (char)0x9D; // POPFD
+    *ss++ = (char)0x9D; // POPFQ
     // Patch conditional jump
     POINTER_SIZE_SINT offset =
         (POINTER_SIZE_SINT)ss - (POINTER_SIZE_SINT)patch_offset - 1;
@@ -277,8 +275,7 @@
         je          __label12__
         mov         rax,qword ptr [rax]
 __label12__
-        xor         rcx,rcx
-        mov         ecx,dword ptr [rdx+90h]
+        movzx       rcx,byte ptr [rdx+90h]
         test        rcx,rcx
         je          __label13__
         push        rcx

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/lil/ia32/stack_iterator_ia32.cpp Mon Mar  3 10:59:04 2008
@@ -134,7 +134,7 @@
         return addr;
     }
 
-    const int stub_size = 0x4d;
+    const int stub_size = 0x48;
     char *stub = (char *)malloc_fixed_code_for_jit(stub_size, DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_COLD, CAA_Allocate);
 #ifdef _DEBUG
     memset(stub, 0xcc /*int 3*/, stub_size);
@@ -168,11 +168,10 @@
     ss = get_reg(ss, &eax_opnd, eax_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_eax);
     ss = get_reg(ss, &ebx_opnd, ebx_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_ebx);
 
-    ss = mov(ss, ecx_opnd,  M_Base_Opnd(edx_reg, (unsigned)&((StackIterator*)0)->c.eflags));
+    ss = movzx(ss, ecx_opnd,  M_Base_Opnd(edx_reg, (unsigned)&((StackIterator*)0)->c.eflags), size_8);
     ss = test(ss, ecx_opnd, ecx_opnd);
     ss = branch8(ss, Condition_Z,  Imm_Opnd(size_8, 0));
     char* patch_offset = ((char *)ss) - 1; // Store location for jump patch
-    ss = alu(ss, and_opc, ecx_opnd, Imm_Opnd(size_32, 0xff));
     ss = push(ss,  ecx_opnd);
     *ss++ = (char)0x9D; // POPFD
     // Patch conditional jump
@@ -208,7 +207,7 @@
         mov         eax,dword ptr [eax]
         mov         ebx,dword ptr [edx+18h]
         mov         ebx,dword ptr [ebx]
-        mov         ecx,dword ptr [edx+28h]
+        movzx       ecx,byte ptr [edx+28h]
         test        ecx,ecx
         je          _label_
         push        ecx

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp?rev=633236&r1=633235&r2=633236&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_ti_timing.cpp Mon Mar  3 10:59:04 2008
@@ -24,7 +24,6 @@
 #include <open/hythread_ext.h>
 #include <open/jthread.h>
 #include "vm_threads.h"
-#include "apr_thread_ext.h"
 
 #define THREAD_CPU_TIME_SUPPORTED 1