src/os/windows/vm/chaitin_windows.cpp

changeset 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/os/windows/vm/chaitin_windows.cpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,77 @@
     1.4 +/*
     1.5 + * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#include "incls/_precompiled.incl"
    1.29 +#include "incls/_chaitin_windows.cpp.incl"
    1.30 +
    1.31 +// Disallow the use of the frame pointer (EBP) for implicit null exceptions
    1.32 +// on win95/98.  If we do not do this, the OS gets confused and gives a stack
    1.33 +// error.
    1.34 +void PhaseRegAlloc::pd_preallocate_hook() {
    1.35 +#ifndef _WIN64
    1.36 +  if (ImplicitNullChecks && !os::win32::is_nt()) {
    1.37 +    for (uint block_num=1; block_num<_cfg._num_blocks; block_num++) {
    1.38 +      Block *block = _cfg._blocks[block_num];
    1.39 +
    1.40 +      Node *block_end = block->end();
    1.41 +      if (block_end->is_MachNullCheck() &&
    1.42 +          block_end->as_Mach()->ideal_Opcode() != Op_Con) {
    1.43 +        // The last instruction in the block is an implicit null check.
    1.44 +        // Fix its input so that it does not load into the frame pointer.
    1.45 +        _matcher.pd_implicit_null_fixup(block_end->in(1)->as_Mach(),
    1.46 +                                        block_end->as_MachNullCheck()->_vidx);
    1.47 +      }
    1.48 +    }
    1.49 +  }
    1.50 +#else
    1.51 +  // WIN64==itanium on XP
    1.52 +#endif
    1.53 +}
    1.54 +
    1.55 +#ifdef ASSERT
    1.56 +// Verify that no implicit null check uses the frame pointer (EBP) as
    1.57 +// its register on win95/98.  Use of the frame pointer in an implicit
    1.58 +// null check confuses the OS, yielding a stack error.
    1.59 +void PhaseRegAlloc::pd_postallocate_verify_hook() {
    1.60 +#ifndef _WIN64
    1.61 +  if (ImplicitNullChecks && !os::win32::is_nt()) {
    1.62 +    for (uint block_num=1; block_num<_cfg._num_blocks; block_num++) {
    1.63 +      Block *block = _cfg._blocks[block_num];
    1.64 +
    1.65 +      Node *block_end = block->_nodes[block->_nodes.size()-1];
    1.66 +      if (block_end->is_MachNullCheck() && block_end->as_Mach()->ideal_Opcode() != Op_Con) {
    1.67 +        // The last instruction in the block is an implicit
    1.68 +        // null check.  Verify that this instruction does not
    1.69 +        // use the frame pointer.
    1.70 +        int reg = get_reg_first(block_end->in(1)->in(block_end->as_MachNullCheck()->_vidx));
    1.71 +        assert(reg != EBP_num,
    1.72 +               "implicit null check using frame pointer on win95/98");
    1.73 +      }
    1.74 +    }
    1.75 +  }
    1.76 +#else
    1.77 +  // WIN64==itanium on XP
    1.78 +#endif
    1.79 +}
    1.80 +#endif

mercurial