Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyTypes.java @ 13514:0fbee3eb71f0
Ruby: import project.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Mon, 06 Jan 2014 17:12:09 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13513:64a23ce736a0 | 13514:0fbee3eb71f0 |
---|---|
1 /* | |
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This | |
3 * code is released under a tri EPL/GPL/LGPL license. You can use it, | |
4 * redistribute it and/or modify it under the terms of the: | |
5 * | |
6 * Eclipse Public License version 1.0 | |
7 * GNU General Public License version 2 | |
8 * GNU Lesser General Public License version 2.1 | |
9 */ | |
10 package com.oracle.truffle.ruby.nodes; | |
11 | |
12 import java.math.*; | |
13 | |
14 import com.oracle.truffle.api.dsl.*; | |
15 import com.oracle.truffle.api.nodes.*; | |
16 import com.oracle.truffle.ruby.runtime.*; | |
17 import com.oracle.truffle.ruby.runtime.core.*; | |
18 import com.oracle.truffle.ruby.runtime.core.array.*; | |
19 import com.oracle.truffle.ruby.runtime.core.range.*; | |
20 import com.oracle.truffle.ruby.runtime.methods.*; | |
21 import com.oracle.truffle.ruby.runtime.objects.*; | |
22 | |
23 /** | |
24 * The list of types and type conversions that the AST interpreter knows about and can specialise | |
25 * using. Used by the DSL. | |
26 */ | |
27 @TypeSystem({UndefinedPlaceholder.class, // | |
28 NilPlaceholder.class, // | |
29 boolean.class, // | |
30 int.class, // | |
31 double.class, // | |
32 BigInteger.class, // | |
33 FixnumRange.class, // | |
34 ObjectRange.class, // | |
35 RubyArray.class, // | |
36 RubyBignum.class, // | |
37 RubyBinding.class, // | |
38 RubyClass.class, // | |
39 RubyContinuation.class, // | |
40 RubyException.class, // | |
41 RubyFiber.class, // | |
42 RubyFile.class, // | |
43 RubyFixnum.class, // | |
44 RubyFloat.class, // | |
45 RubyHash.class, // | |
46 RubyMatchData.class, // | |
47 RubyMethod.class, // | |
48 RubyModule.class, // | |
49 RubyNilClass.class, // | |
50 RubyProc.class, // | |
51 RubyRange.class, // | |
52 RubyRegexp.class, // | |
53 RubyString.class, // | |
54 RubySymbol.class, // | |
55 RubyThread.class, // | |
56 RubyTime.class, // | |
57 RubyObject.class, // | |
58 RubyBasicObject.class, // | |
59 Node.class, // | |
60 Object[].class}) | |
61 public class RubyTypes { | |
62 | |
63 /* | |
64 * The implicit casts allow the DSL to convert from an object of one type to another to satisfy | |
65 * specializations. | |
66 */ | |
67 | |
68 @ImplicitCast | |
69 public NilPlaceholder unboxNil(@SuppressWarnings("unused") RubyNilClass value) { | |
70 return NilPlaceholder.INSTANCE; | |
71 } | |
72 | |
73 @ImplicitCast | |
74 public int unboxFixnum(RubyFixnum value) { | |
75 return value.getValue(); | |
76 } | |
77 | |
78 @ImplicitCast | |
79 public BigInteger unboxBignum(RubyBignum value) { | |
80 return value.getValue(); | |
81 } | |
82 | |
83 @ImplicitCast | |
84 public double unboxFloat(RubyFloat value) { | |
85 return value.getValue(); | |
86 } | |
87 | |
88 } |