comparison src/cpu/zero/vm/interpreterRT_zero.cpp @ 1379:f9271ff9d324

6941224: Improved stack overflow handling for Zero Summary: Adding stack overflow checking to Shark brought to light a bunch of deficiencies in Zero's stack overflow code. Reviewed-by: twisti Contributed-by: Gary Benson <gbenson@redhat.com>
author twisti
date Thu, 15 Apr 2010 02:40:12 -0700
parents 354d3184f6b2
children c18cbe5936b8
comparison
equal deleted inserted replaced
1377:ef74d6d1ac1e 1379:f9271ff9d324
1 /* 1 /*
2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright 2007, 2008 Red Hat, Inc. 3 * Copyright 2007, 2008, 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.
138 ZeroStack *stack = thread->zero_stack(); 138 ZeroStack *stack = thread->zero_stack();
139 139
140 int required_words = 140 int required_words =
141 (align_size_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) + 141 (align_size_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) +
142 (method->is_static() ? 2 : 1) + method->size_of_parameters() + 1; 142 (method->is_static() ? 2 : 1) + method->size_of_parameters() + 1;
143 if (required_words > stack->available_words()) { 143
144 Unimplemented(); 144 stack->overflow_check(required_words, CHECK_NULL);
145 }
146 145
147 intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize); 146 intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize);
148 SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf); 147 SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf);
149 sshg.generate(UCONST64(-1)); 148 sshg.generate(UCONST64(-1));
150 149