comparison src/cpu/zero/vm/entry_zero.hpp @ 1514:22af4ce8dba1

6951784: Zero deoptimizer changes Summary: The way Zero currently handles deoptimization can lead to methods being freed while they are still being executed. Reviewed-by: twisti Contributed-by: Gary Benson <gbenson@redhat.com>
author twisti
date Wed, 12 May 2010 03:49:52 -0700
parents 354d3184f6b2
children c18cbe5936b8
comparison
equal deleted inserted replaced
1513:df736661d0c8 1514:22af4ce8dba1
1 /* 1 /*
2 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright 2008, 2009 Red Hat, Inc. 3 * Copyright 2008, 2009, 2010 Red Hat, Inc.
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.
39 void set_entry_point(address entry_point) { 39 void set_entry_point(address entry_point) {
40 _entry_point = entry_point; 40 _entry_point = entry_point;
41 } 41 }
42 42
43 private: 43 private:
44 typedef void (*NormalEntryFunc)(methodOop method, 44 typedef int (*NormalEntryFunc)(methodOop method,
45 intptr_t base_pc, 45 intptr_t base_pc,
46 TRAPS); 46 TRAPS);
47 typedef void (*OSREntryFunc)(methodOop method, 47 typedef int (*OSREntryFunc)(methodOop method,
48 address osr_buf, 48 address osr_buf,
49 intptr_t base_pc, 49 intptr_t base_pc,
50 TRAPS); 50 TRAPS);
51 51
52 public: 52 public:
53 void invoke(methodOop method, TRAPS) const { 53 void invoke(methodOop method, TRAPS) const {
54 ((NormalEntryFunc) entry_point())(method, (intptr_t) this, THREAD); 54 maybe_deoptimize(
55 ((NormalEntryFunc) entry_point())(method, (intptr_t) this, THREAD),
56 THREAD);
55 } 57 }
56 void invoke_osr(methodOop method, address osr_buf, TRAPS) const { 58 void invoke_osr(methodOop method, address osr_buf, TRAPS) const {
57 ((OSREntryFunc) entry_point())(method, osr_buf, (intptr_t) this, THREAD); 59 maybe_deoptimize(
60 ((OSREntryFunc) entry_point())(method, osr_buf, (intptr_t) this, THREAD),
61 THREAD);
62 }
63
64 private:
65 static void maybe_deoptimize(int deoptimized_frames, TRAPS) {
66 if (deoptimized_frames)
67 CppInterpreter::main_loop(deoptimized_frames - 1, THREAD);
58 } 68 }
59 69
60 public: 70 public:
61 static ByteSize entry_point_offset() { 71 static ByteSize entry_point_offset() {
62 return byte_offset_of(ZeroEntry, _entry_point); 72 return byte_offset_of(ZeroEntry, _entry_point);