1.1 --- a/jitcraft/Structures.cpp Tue Jul 24 23:53:34 2012 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,46 +0,0 @@
1.4 -/* vim: set ts=4 sw=4 tw=99 et
1.5 - *
1.6 - * Copyright (C) 2012 David Anderson
1.7 - *
1.8 - * This file is part of JITCraft.
1.9 - *
1.10 - * JITCraft is free software: you can redistribute it and/or modify it under
1.11 - * the terms of the GNU General Public License as published by the Free
1.12 - * Software Foundation, either version 3 of the License, or (at your option)
1.13 - * any later version.
1.14 - *
1.15 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
1.16 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1.18 - *
1.19 - * You should have received a copy of the GNU General Public License along with
1.20 - * JITCraft. If not, see http://www.gnu.org/licenses/.
1.21 - */
1.22 -#include "Structures.h"
1.23 -#include "Types.h"
1.24 -
1.25 -using namespace ke;
1.26 -
1.27 -StructureBufferBuilder::StructureBufferBuilder()
1.28 - : size_(0)
1.29 -{
1.30 -}
1.31 -
1.32 -bool
1.33 -StructureBufferBuilder::add(Handle<Type> type, unsigned *offset)
1.34 -{
1.35 - *offset = size_;
1.36 -
1.37 - if (!type->isTraceable()) {
1.38 - // For now, assume the size of primitives is 4-byte.
1.39 - assert(type->isInt32() || type->isFloat());
1.40 - size_ += 4;
1.41 - return true;
1.42 - }
1.43 -
1.44 - if (!offsets_.append(size_))
1.45 - return false;
1.46 -
1.47 - size_ += sizeof(Object *);
1.48 - return true;
1.49 -}