hotspot/src/cpu/ppc/vm/ppc.ad
changeset 24018 77b156916bab
parent 23498 a0e67b766e5c
child 24349 d8f40e5b392d
equal deleted inserted replaced
24016:2927072ed5fb 24018:77b156916bab
     1 //
     1 //
     2 // Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     2 // Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     3 // Copyright 2012, 2013 SAP AG. All rights reserved.
     3 // Copyright 2012, 2014 SAP AG. All rights reserved.
     4 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5 //
     5 //
     6 // This code is free software; you can redistribute it and/or modify it
     6 // This code is free software; you can redistribute it and/or modify it
     7 // under the terms of the GNU General Public License version 2 only, as
     7 // under the terms of the GNU General Public License version 2 only, as
     8 // published by the Free Software Foundation.
     8 // published by the Free Software Foundation.
  1360 
  1360 
  1361 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
  1361 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
  1362   Compile* C = ra_->C;
  1362   Compile* C = ra_->C;
  1363   MacroAssembler _masm(&cbuf);
  1363   MacroAssembler _masm(&cbuf);
  1364 
  1364 
  1365   const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
  1365   const long framesize = C->frame_size_in_bytes();
  1366   assert(framesize%(2*wordSize) == 0, "must preserve 2*wordSize alignment");
  1366   assert(framesize % (2 * wordSize) == 0, "must preserve 2*wordSize alignment");
  1367 
  1367 
  1368   const bool method_is_frameless      = false /* TODO: PPC port C->is_frameless_method()*/;
  1368   const bool method_is_frameless      = false /* TODO: PPC port C->is_frameless_method()*/;
  1369 
  1369 
  1370   const Register return_pc            = R20; // Must match return_addr() in frame section.
  1370   const Register return_pc            = R20; // Must match return_addr() in frame section.
  1371   const Register callers_sp           = R21;
  1371   const Register callers_sp           = R21;
  1386   // Calls to C2R adapters often do not accept exceptional returns.
  1386   // Calls to C2R adapters often do not accept exceptional returns.
  1387   // We require that their callers must bang for them. But be
  1387   // We require that their callers must bang for them. But be
  1388   // careful, because some VM calls (such as call site linkage) can
  1388   // careful, because some VM calls (such as call site linkage) can
  1389   // use several kilobytes of stack. But the stack safety zone should
  1389   // use several kilobytes of stack. But the stack safety zone should
  1390   // account for that. See bugs 4446381, 4468289, 4497237.
  1390   // account for that. See bugs 4446381, 4468289, 4497237.
  1391   if (C->need_stack_bang(framesize) && UseStackBanging) {
  1391 
       
  1392   int bangsize = C->bang_size_in_bytes();
       
  1393   assert(bangsize >= framesize || bangsize <= 0, "stack bang size incorrect");
       
  1394   if (C->need_stack_bang(bangsize) && UseStackBanging) {
  1392     // Unfortunately we cannot use the function provided in
  1395     // Unfortunately we cannot use the function provided in
  1393     // assembler.cpp as we have to emulate the pipes. So I had to
  1396     // assembler.cpp as we have to emulate the pipes. So I had to
  1394     // insert the code of generate_stack_overflow_check(), see
  1397     // insert the code of generate_stack_overflow_check(), see
  1395     // assembler.cpp for some illuminative comments.
  1398     // assembler.cpp for some illuminative comments.
  1396     const int page_size = os::vm_page_size();
  1399     const int page_size = os::vm_page_size();
  1397     int bang_end = StackShadowPages*page_size;
  1400     int bang_end = StackShadowPages * page_size;
  1398 
  1401 
  1399     // This is how far the previous frame's stack banging extended.
  1402     // This is how far the previous frame's stack banging extended.
  1400     const int bang_end_safe = bang_end;
  1403     const int bang_end_safe = bang_end;
  1401 
  1404 
  1402     if (framesize > page_size) {
  1405     if (bangsize > page_size) {
  1403       bang_end += framesize;
  1406       bang_end += bangsize;
  1404     }
  1407     }
  1405 
  1408 
  1406     int bang_offset = bang_end_safe;
  1409     int bang_offset = bang_end_safe;
  1407 
  1410 
  1408     while (bang_offset <= bang_end) {
  1411     while (bang_offset <= bang_end) {
  1444     // R11 trashed
  1447     // R11 trashed
  1445   } // C->need_stack_bang(framesize) && UseStackBanging
  1448   } // C->need_stack_bang(framesize) && UseStackBanging
  1446 
  1449 
  1447   unsigned int bytes = (unsigned int)framesize;
  1450   unsigned int bytes = (unsigned int)framesize;
  1448   long offset = Assembler::align_addr(bytes, frame::alignment_in_bytes);
  1451   long offset = Assembler::align_addr(bytes, frame::alignment_in_bytes);
  1449   ciMethod *currMethod = C -> method();
  1452   ciMethod *currMethod = C->method();
  1450 
  1453 
  1451   // Optimized version for most common case.
  1454   // Optimized version for most common case.
  1452   if (UsePower6SchedulerPPC64 &&
  1455   if (UsePower6SchedulerPPC64 &&
  1453       !method_is_frameless && Assembler::is_simm((int)(-offset), 16) &&
  1456       !method_is_frameless && Assembler::is_simm((int)(-offset), 16) &&
  1454       !(false /* ConstantsALot TODO: PPC port*/)) {
  1457       !(false /* ConstantsALot TODO: PPC port*/)) {