6941224: Improved stack overflow handling for Zero

Adding stack overflow checking to Shark brought to light a bunch of deficiencies in Zero's stack overflow code.

Reviewed-by: twisti
This commit is contained in:
Gary Benson 2010-04-15 02:40:12 -07:00 committed by Christian Thalinger
parent a1446b775d
commit 95b528bff0
10 changed files with 121 additions and 134 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008, 2009 Red Hat, Inc.
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,9 +29,14 @@ class ZeroStack {
intptr_t *_top; // the word past the end of the stack
intptr_t *_sp; // the top word on the stack
private:
int _shadow_pages_size; // how much ABI stack must we keep free?
public:
ZeroStack()
: _base(NULL), _top(NULL), _sp(NULL) {}
: _base(NULL), _top(NULL), _sp(NULL) {
_shadow_pages_size = StackShadowPages * os::vm_page_size();
}
bool needs_setup() const {
return _base == NULL;
@ -81,6 +86,14 @@ class ZeroStack {
return _sp -= count;
}
int shadow_pages_size() const {
return _shadow_pages_size;
}
public:
void overflow_check(int required_words, TRAPS);
static void handle_overflow(TRAPS);
public:
static ByteSize base_offset() {
return byte_offset_of(ZeroStack, _base);