src/share/vm/runtime/stackValue.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6706829 Sdiff src/share/vm/runtime

src/share/vm/runtime/stackValue.cpp

Print this page


   1 /*
   2  * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


  69       return new StackValue(value.p); // 64-bit high half is stack junk
  70     }
  71     case Location::int_in_long: { // Holds an int in a long register?
  72       // The callee has no clue whether the register holds an int,
  73       // long or is unused.  He always saves a long.  Here we know
  74       // a long was saved, but we only want an int back.  Narrow the
  75       // saved long to the int that the JVM wants.
  76       assert( loc.is_register(), "ints always saved to stack in 1 word" );
  77       union { intptr_t p; jint ji;} value;
  78       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
  79       value.ji = (jint) *(jlong*) value_addr;
  80       return new StackValue(value.p); // 64-bit high half is stack junk
  81     }
  82 #ifdef _LP64
  83     case Location::dbl:
  84       // Double value in an aligned adjacent pair
  85       return new StackValue(*(intptr_t*)value_addr);
  86     case Location::lng:
  87       // Long   value in an aligned adjacent pair
  88       return new StackValue(*(intptr_t*)value_addr);
















  89 #endif
  90     case Location::oop: {
  91       Handle h(*(oop *)value_addr); // Wrap a handle around the oop
  92       return new StackValue(h);
  93     }
  94     case Location::addr: {
  95       ShouldNotReachHere(); // both C1 and C2 now inline jsrs
  96     }
  97     case Location::normal: {
  98       // Just copy all other bits straight through
  99       union { intptr_t p; jint ji;} value;
 100       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
 101       value.ji = *(jint*)value_addr;
 102       return new StackValue(value.p);
 103     }
 104     case Location::invalid:
 105       return new StackValue();
 106     default:
 107       ShouldNotReachHere();
 108     }


   1 /*
   2  * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


  69       return new StackValue(value.p); // 64-bit high half is stack junk
  70     }
  71     case Location::int_in_long: { // Holds an int in a long register?
  72       // The callee has no clue whether the register holds an int,
  73       // long or is unused.  He always saves a long.  Here we know
  74       // a long was saved, but we only want an int back.  Narrow the
  75       // saved long to the int that the JVM wants.
  76       assert( loc.is_register(), "ints always saved to stack in 1 word" );
  77       union { intptr_t p; jint ji;} value;
  78       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
  79       value.ji = (jint) *(jlong*) value_addr;
  80       return new StackValue(value.p); // 64-bit high half is stack junk
  81     }
  82 #ifdef _LP64
  83     case Location::dbl:
  84       // Double value in an aligned adjacent pair
  85       return new StackValue(*(intptr_t*)value_addr);
  86     case Location::lng:
  87       // Long   value in an aligned adjacent pair
  88       return new StackValue(*(intptr_t*)value_addr);
  89     case Location::narrowoop: {
  90       union { intptr_t p; narrowOop noop;} value;
  91       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
  92       if (loc.is_register()) {
  93         // The callee has no clue whether the register holds an int,
  94         // long or is unused.  He always saves a long.  Here we know
  95         // a long was saved, but we only want an int back.  Narrow the
  96         // saved long to the int that the JVM wants.
  97         value.noop =  (narrowOop) *(julong*) value_addr;
  98       } else {
  99         value.noop = *(narrowOop*) value_addr;
 100       }
 101       // Decode narrowoop and wrap a handle around the oop
 102       Handle h(oopDesc::decode_heap_oop(value.noop));
 103       return new StackValue(h);
 104     }
 105 #endif
 106     case Location::oop: {
 107       Handle h(*(oop *)value_addr); // Wrap a handle around the oop
 108       return new StackValue(h);
 109     }
 110     case Location::addr: {
 111       ShouldNotReachHere(); // both C1 and C2 now inline jsrs
 112     }
 113     case Location::normal: {
 114       // Just copy all other bits straight through
 115       union { intptr_t p; jint ji;} value;
 116       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
 117       value.ji = *(jint*)value_addr;
 118       return new StackValue(value.p);
 119     }
 120     case Location::invalid:
 121       return new StackValue();
 122     default:
 123       ShouldNotReachHere();
 124     }


src/share/vm/runtime/stackValue.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File