comparison agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java @ 2245:638119ce7cfd

7009309: JSR 292: compiler/6991596/Test6991596.java crashes on fastdebug JDK7/b122 Reviewed-by: kvn, never
author twisti
date Tue, 01 Feb 2011 03:38:44 -0800
parents c18cbe5936b8
children
comparison
equal deleted inserted replaced
2244:4f26f535a225 2245:638119ce7cfd
1 /* 1 /*
2 * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
29 import sun.jvm.hotspot.types.*; 29 import sun.jvm.hotspot.types.*;
30 30
31 /** Very minimal port for now to get frames working */ 31 /** Very minimal port for now to get frames working */
32 32
33 public class StubRoutines { 33 public class StubRoutines {
34 private static AddressField callStubReturnAddressField; 34 private static AddressField callStubReturnAddressField;
35 private static AddressField callStubCompiledReturnAddressField;
36 35
37 static { 36 static {
38 VM.registerVMInitializedObserver(new Observer() { 37 VM.registerVMInitializedObserver(new Observer() {
39 public void update(Observable o, Object data) { 38 public void update(Observable o, Object data) {
40 initialize(VM.getVM().getTypeDataBase()); 39 initialize(VM.getVM().getTypeDataBase());
42 }); 41 });
43 } 42 }
44 43
45 private static synchronized void initialize(TypeDataBase db) { 44 private static synchronized void initialize(TypeDataBase db) {
46 Type type = db.lookupType("StubRoutines"); 45 Type type = db.lookupType("StubRoutines");
47
48 callStubReturnAddressField = type.getAddressField("_call_stub_return_address"); 46 callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
49 // Only some platforms have specific return from compiled to call_stub
50 try {
51 type = db.lookupType("StubRoutines::x86");
52 if (type != null) {
53 callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return");
54 }
55 } catch (RuntimeException re) {
56 callStubCompiledReturnAddressField = null;
57 }
58 if (callStubCompiledReturnAddressField == null && VM.getVM().getCPU().equals("x86")) {
59 throw new InternalError("Missing definition for _call_stub_compiled_return");
60 }
61 } 47 }
62 48
63 public StubRoutines() { 49 public StubRoutines() {
64 } 50 }
65 51
66 public boolean returnsToCallStub(Address returnPC) { 52 public boolean returnsToCallStub(Address returnPC) {
67 Address addr = callStubReturnAddressField.getValue(); 53 Address addr = callStubReturnAddressField.getValue();
68 boolean result = false;
69 if (addr == null) {
70 result = (addr == returnPC);
71 } else {
72 result = addr.equals(returnPC);
73 }
74 if (result || callStubCompiledReturnAddressField == null ) return result;
75 // Could be a return to compiled code return point
76 addr = callStubCompiledReturnAddressField.getValue();
77 if (addr == null) { 54 if (addr == null) {
78 return (addr == returnPC); 55 return (addr == returnPC);
79 } else { 56 } else {
80 return (addr.equals(returnPC)); 57 return (addr.equals(returnPC));
81 } 58 }
82
83 } 59 }
84 } 60 }