annotate truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/LayoutStrategy.java @ 22548:6b76a24fffbd default tip

Use all variables: a, b, u,v and x, y
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 14 Jan 2016 14:20:57 +0100
parents cf203af4610c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
1 /*
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
4 *
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
8 *
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
13 * accompanied this code).
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
14 *
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
18 *
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
21 * questions.
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
22 */
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
23 package com.oracle.truffle.object;
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
24
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
25 import com.oracle.truffle.api.object.DynamicObject;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
26 import com.oracle.truffle.api.object.Location;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
27 import com.oracle.truffle.api.object.Property;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
28 import com.oracle.truffle.api.object.Shape;
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 18408
diff changeset
29 import com.oracle.truffle.object.ShapeImpl.BaseAllocator;
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
30
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
31 public abstract class LayoutStrategy {
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
32 public abstract boolean updateShape(DynamicObject object);
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
33
22289
cf203af4610c avoid unnecessary casts
Andreas Woess <andreas.woess@oracle.com>
parents: 22288
diff changeset
34 public abstract ShapeImpl ensureValid(ShapeImpl newShape);
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
35
22289
cf203af4610c avoid unnecessary casts
Andreas Woess <andreas.woess@oracle.com>
parents: 22288
diff changeset
36 public abstract ShapeImpl ensureSpace(ShapeImpl shape, Location location);
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
37
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
38 public abstract boolean isAutoExtArray();
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
39
22289
cf203af4610c avoid unnecessary casts
Andreas Woess <andreas.woess@oracle.com>
parents: 22288
diff changeset
40 public abstract BaseAllocator createAllocator(LayoutImpl shape);
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
41
22289
cf203af4610c avoid unnecessary casts
Andreas Woess <andreas.woess@oracle.com>
parents: 22288
diff changeset
42 public abstract BaseAllocator createAllocator(ShapeImpl shape);
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
43
22289
cf203af4610c avoid unnecessary casts
Andreas Woess <andreas.woess@oracle.com>
parents: 22288
diff changeset
44 protected abstract ShapeAndProperty generalizeProperty(Property oldProperty, Object value, ShapeImpl currentShape, ShapeImpl nextShape);
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
45
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
46 public static class ShapeAndProperty {
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
47 private final Shape shape;
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
48 private final Property property;
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
49
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
50 public ShapeAndProperty(Shape shape, Property property) {
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
51 this.shape = shape;
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
52 this.property = property;
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
53 }
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
54
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
55 public Shape getShape() {
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
56 return shape;
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
57 }
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
58
22288
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
59 public Property getProperty() {
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
60 return property;
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
61 }
47172a9b40ac Object model refactoring, add Shape#defineProperty
Andreas Woess <andreas.woess@oracle.com>
parents: 22157
diff changeset
62 }
18408
2c3666f44855 Truffle: initial commit of object API implementation
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
63 }