comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/local/SLReadArgumentNode.java @ 13821:b16ec83edc73

Documentation and more refactoring of Simple Language
author Christian Wimmer <christian.wimmer@oracle.com>
date Wed, 29 Jan 2014 20:45:43 -0800
parents 7c418666c6c9
children 64c77f0577bb
comparison
equal deleted inserted replaced
13820:20e7727588e8 13821:b16ec83edc73
1 /* 1 /*
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
29 29
30 public class SLReadArgumentNode extends SLExpressionNode { 30 public class SLReadArgumentNode extends SLExpressionNode {
31 31
32 private final int index; 32 private final int index;
33 33
34 private final BranchProfile outOfBounds = new BranchProfile(); 34 private final BranchProfile outOfBoundsTaken = new BranchProfile();
35 35
36 public SLReadArgumentNode(int index) { 36 public SLReadArgumentNode(int index) {
37 this.index = index; 37 this.index = index;
38 } 38 }
39 39
41 public Object executeGeneric(VirtualFrame frame) { 41 public Object executeGeneric(VirtualFrame frame) {
42 Object[] args = SLArguments.getFromFrame(frame); 42 Object[] args = SLArguments.getFromFrame(frame);
43 if (index < args.length) { 43 if (index < args.length) {
44 return args[index]; 44 return args[index];
45 } else { 45 } else {
46 outOfBounds.enter(); 46 outOfBoundsTaken.enter();
47 return SLNull.INSTANCE; 47 return SLNull.SINGLETON;
48 } 48 }
49 } 49 }
50 } 50 }