2008-11-23 23:58:01 +00:00
|
|
|
/* Copyright (c) 2008, Avian Contributors
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#ifndef BOOTIMAGE_H
|
|
|
|
#define BOOTIMAGE_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2008-11-21 23:20:35 +00:00
|
|
|
namespace vm {
|
|
|
|
|
|
|
|
class BootImage {
|
|
|
|
public:
|
|
|
|
static const unsigned Magic = 0x22377322;
|
|
|
|
|
|
|
|
unsigned magic;
|
|
|
|
|
|
|
|
unsigned heapSize;
|
|
|
|
unsigned codeSize;
|
|
|
|
|
|
|
|
unsigned loader;
|
|
|
|
unsigned stringMap;
|
|
|
|
unsigned types;
|
2008-11-23 23:58:01 +00:00
|
|
|
|
|
|
|
unsigned callTable;
|
|
|
|
unsigned methodTree;
|
|
|
|
unsigned methodTreeSentinal;
|
2008-11-28 22:02:45 +00:00
|
|
|
|
|
|
|
uintptr_t codeBase;
|
2008-11-21 23:20:35 +00:00
|
|
|
|
|
|
|
unsigned defaultThunk;
|
|
|
|
unsigned nativeThunk;
|
|
|
|
unsigned aioobThunk;
|
2008-11-28 22:02:45 +00:00
|
|
|
|
|
|
|
unsigned thunkTable;
|
|
|
|
unsigned thunkSize;
|
|
|
|
|
|
|
|
unsigned compileMethodCall;
|
|
|
|
unsigned invokeNativeCall;
|
|
|
|
unsigned throwArrayIndexOutOfBoundsCall;
|
|
|
|
|
|
|
|
#define THUNK(s) unsigned s##Call;
|
2008-11-21 23:20:35 +00:00
|
|
|
#include "thunks.cpp"
|
|
|
|
#undef THUNK
|
|
|
|
};
|
|
|
|
|
2008-11-28 22:02:45 +00:00
|
|
|
inline unsigned
|
|
|
|
codeMapSize(unsigned codeSize)
|
|
|
|
{
|
|
|
|
return ceiling(codeSize, BitsPerWord) * BytesPerWord;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline unsigned
|
|
|
|
heapMapSize(unsigned heapSize)
|
|
|
|
{
|
2008-11-29 23:08:14 +00:00
|
|
|
return ceiling(heapSize, BitsPerWord * BytesPerWord) * BytesPerWord;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline object
|
|
|
|
bootObject(uintptr_t* heap, unsigned offset)
|
|
|
|
{
|
|
|
|
if (offset) {
|
|
|
|
return reinterpret_cast<object>(heap + offset - 1);
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2008-11-28 22:02:45 +00:00
|
|
|
}
|
|
|
|
|
2008-11-21 23:20:35 +00:00
|
|
|
} // namespace vm
|
2008-11-23 23:58:01 +00:00
|
|
|
|
|
|
|
#endif//BOOTIMAGE_H
|