-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 in G/truffle from ~MATTHIAS.G.GRIMMER_ORACLE.C…
…OM/truffle:master to master * commit 'feec4a84e5157b24c01329c341c69b389ecdd065': Factor language check into guard helper method in CachedObjectAccessNode Rename LanguageCheck annotation to CanResolve Use deep copy of can-resolve node of interop DSL Add tests for @LanguageCheck annotation Extend Interop DSL and provide an @LanguageCheck annotation, which allows expressing the language check as a node
- Loading branch information
Showing
20 changed files
with
697 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/interop/ValidTruffleObject11MR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.oracle.truffle.api.dsl.test.interop; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.interop.CanResolve; | ||
import com.oracle.truffle.api.interop.MessageResolution; | ||
import com.oracle.truffle.api.interop.Resolve; | ||
import com.oracle.truffle.api.interop.TruffleObject; | ||
import com.oracle.truffle.api.nodes.Node; | ||
|
||
@SuppressWarnings("unused") | ||
@MessageResolution(receiverType = ValidTruffleObject11.class, language = TestTruffleLanguage.class) | ||
public class ValidTruffleObject11MR { | ||
|
||
@Resolve(message = "READ") | ||
public abstract static class ReadNode11 extends Node { | ||
|
||
protected Object access(VirtualFrame frame, ValidTruffleObject1 receiver, Object name) { | ||
return 0; | ||
} | ||
} | ||
|
||
@CanResolve | ||
public abstract static class LanguageCheck1 extends Node { | ||
|
||
protected boolean test(VirtualFrame frame, TruffleObject receiver) { | ||
return receiver instanceof ValidTruffleObject11; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/interop/ValidTruffleObject12MR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.oracle.truffle.api.dsl.test.interop; | ||
|
||
import com.oracle.truffle.api.dsl.test.ExpectError; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.interop.CanResolve; | ||
import com.oracle.truffle.api.interop.MessageResolution; | ||
import com.oracle.truffle.api.interop.Resolve; | ||
import com.oracle.truffle.api.interop.TruffleObject; | ||
import com.oracle.truffle.api.nodes.Node; | ||
|
||
@SuppressWarnings("unused") | ||
@MessageResolution(receiverType = ValidTruffleObject12.class, language = TestTruffleLanguage.class) | ||
@ExpectError("Only one @LanguageCheck element allowed") | ||
public class ValidTruffleObject12MR { | ||
|
||
@Resolve(message = "READ") | ||
public abstract static class ReadNode12 extends Node { | ||
|
||
protected Object access(VirtualFrame frame, ValidTruffleObject1 receiver, Object name) { | ||
return 0; | ||
} | ||
} | ||
|
||
@CanResolve | ||
public abstract static class LanguageCheck1 extends Node { | ||
|
||
protected boolean test(VirtualFrame frame, TruffleObject receiver) { | ||
return receiver instanceof ValidTruffleObject11; | ||
} | ||
} | ||
|
||
@CanResolve | ||
public abstract static class LanguageCheck2 extends Node { | ||
|
||
protected boolean test(VirtualFrame frame, TruffleObject receiver) { | ||
return receiver instanceof ValidTruffleObject11; | ||
} | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...ffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/interop/ValidTruffleObject13MR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.oracle.truffle.api.dsl.test.interop; | ||
|
||
import com.oracle.truffle.api.dsl.test.ExpectError; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.interop.CanResolve; | ||
import com.oracle.truffle.api.interop.MessageResolution; | ||
import com.oracle.truffle.api.interop.Resolve; | ||
import com.oracle.truffle.api.interop.TruffleObject; | ||
import com.oracle.truffle.api.nodes.Node; | ||
|
||
@SuppressWarnings("unused") | ||
@MessageResolution(receiverType = ValidTruffleObject12.class, language = TestTruffleLanguage.class) | ||
public class ValidTruffleObject13MR { | ||
|
||
@Resolve(message = "READ") | ||
public abstract static class ReadNode13 extends Node { | ||
|
||
protected Object access(VirtualFrame frame, ValidTruffleObject1 receiver, Object name) { | ||
return 0; | ||
} | ||
} | ||
|
||
@CanResolve | ||
public abstract static class LanguageCheck1 extends Node { | ||
|
||
@ExpectError("Method must return a boolean value") | ||
protected Object test(VirtualFrame frame, TruffleObject receiver) { | ||
return receiver instanceof ValidTruffleObject11; | ||
} | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...ffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/interop/ValidTruffleObject14MR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.oracle.truffle.api.dsl.test.interop; | ||
|
||
import com.oracle.truffle.api.dsl.test.ExpectError; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.interop.CanResolve; | ||
import com.oracle.truffle.api.interop.MessageResolution; | ||
import com.oracle.truffle.api.interop.Resolve; | ||
import com.oracle.truffle.api.interop.TruffleObject; | ||
import com.oracle.truffle.api.nodes.Node; | ||
|
||
@SuppressWarnings("unused") | ||
@MessageResolution(receiverType = ValidTruffleObject12.class, language = TestTruffleLanguage.class) | ||
public class ValidTruffleObject14MR { | ||
|
||
@Resolve(message = "READ") | ||
public abstract static class ReadNode14 extends Node { | ||
|
||
protected Object access(VirtualFrame frame, ValidTruffleObject1 receiver, Object name) { | ||
return 0; | ||
} | ||
} | ||
|
||
@CanResolve | ||
public abstract static class LanguageCheck1 extends Node { | ||
|
||
@ExpectError("The receiver type must be TruffleObject") | ||
protected boolean test(VirtualFrame frame, ValidTruffleObject12 receiver) { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.