Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

This commit is contained in:
Brian Carlstrom 2010-05-27 22:38:57 -07:00
commit 0e67a03748
4 changed files with 19 additions and 2 deletions

View file

@ -10,7 +10,7 @@
#ifndef _CUTILS_ASHMEM_H
#define _CUTILS_ASHMEM_H
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View file

@ -87,6 +87,11 @@ mspace create_contiguous_mspace_with_base(size_t starting_capacity,
size_t max_capacity, int locked, void *base);
size_t destroy_contiguous_mspace(mspace msp);
/*
Returns the position of the "break" within the given mspace.
*/
void *contiguous_mspace_sbrk0(mspace msp);
#endif
/*

View file

@ -271,4 +271,16 @@ size_t destroy_contiguous_mspace(mspace msp) {
}
return 0;
}
void *contiguous_mspace_sbrk0(mspace msp) {
struct mspace_contig_state *cs;
mstate ms;
const unsigned int pagesize = PAGESIZE;
ms = (mstate)msp;
cs = (struct mspace_contig_state *)((uintptr_t)ms & ~(pagesize-1));
assert(cs->magic == CONTIG_STATE_MAGIC);
assert(cs->m == ms);
return cs->brk;
}
#endif

View file

@ -454,7 +454,7 @@ static void showLog(LogState *state,
numVecs = numLines*3; // 3 iovecs per line.
if (numVecs > INLINE_VECS) {
vec = (struct iovec*)malloc(sizeof(struct iovec)*numLines);
vec = (struct iovec*)malloc(sizeof(struct iovec)*numVecs);
if (vec == NULL) {
msg = "LOG: write failed, no memory";
numVecs = 3;