25
25
import org .truffleruby .core .string .RubyString ;
26
26
import org .truffleruby .core .string .StringUtils ;
27
27
import org .truffleruby .interop .ForeignToRubyArgumentsNode ;
28
- import org .truffleruby .interop .ForeignToRubyNode ;
29
28
import org .truffleruby .interop .TranslateInteropRubyExceptionNode ;
30
29
import org .truffleruby .language .control .RaiseException ;
31
30
import org .truffleruby .language .dispatch .DispatchConfiguration ;
@@ -587,18 +586,16 @@ private static boolean isIVar(String name) {
587
586
public Object readMember (String name ,
588
587
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
589
588
@ Cached @ Shared ("definedNode" ) InternalRespondToNode definedNode ,
590
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
591
589
@ Cached GetMethodObjectNode getMethodObjectNode ,
592
590
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
593
591
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
594
592
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ,
595
593
@ Shared ("translateRubyException" ) @ Cached TranslateInteropRubyExceptionNode translateRubyException ,
596
594
@ Shared ("errorProfile" ) @ Cached BranchProfile errorProfile )
597
595
throws UnknownIdentifierException , UnsupportedMessageException {
598
- Object rubyName = nameToRubyNode .executeConvert (name );
599
596
Object dynamic ;
600
597
try {
601
- dynamic = dispatchNode .call (this , "polyglot_read_member" , rubyName );
598
+ dynamic = dispatchNode .call (this , "polyglot_read_member" , name );
602
599
} catch (RaiseException e ) {
603
600
throw translateRubyException .execute (e , name );
604
601
}
@@ -623,15 +620,13 @@ public void writeMember(String name, Object value,
623
620
@ Cached WriteObjectFieldNode writeObjectFieldNode ,
624
621
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
625
622
@ CachedLibrary ("this" ) RubyLibrary rubyLibrary ,
626
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
627
623
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
628
624
@ Shared ("translateRubyException" ) @ Cached TranslateInteropRubyExceptionNode translateRubyException ,
629
625
@ Shared ("errorProfile" ) @ Cached BranchProfile errorProfile )
630
626
throws UnknownIdentifierException , UnsupportedMessageException {
631
- Object rubyName = nameToRubyNode .executeConvert (name );
632
627
Object dynamic ;
633
628
try {
634
- dynamic = dispatchNode .call (this , "polyglot_write_member" , rubyName , value );
629
+ dynamic = dispatchNode .call (this , "polyglot_write_member" , name , value );
635
630
} catch (RaiseException e ) {
636
631
throw translateRubyException .execute (e , name );
637
632
}
@@ -652,19 +647,16 @@ public void writeMember(String name, Object value,
652
647
653
648
@ ExportMessage
654
649
public void removeMember (String name ,
655
- @ Exclusive @ Cached ForeignToRubyNode foreignToRubyNode ,
656
650
@ Exclusive @ Cached DispatchNode removeInstanceVariableNode ,
657
651
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
658
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
659
652
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
660
653
@ Shared ("translateRubyException" ) @ Cached TranslateInteropRubyExceptionNode translateRubyException ,
661
654
@ Shared ("errorProfile" ) @ Cached BranchProfile errorProfile ,
662
655
@ CachedLibrary ("this" ) InteropLibrary interopLibrary )
663
656
throws UnknownIdentifierException , UnsupportedMessageException {
664
- Object rubyName = nameToRubyNode .executeConvert (name );
665
657
Object dynamic ;
666
658
try {
667
- dynamic = dispatchNode .call (this , "polyglot_remove_member" , rubyName );
659
+ dynamic = dispatchNode .call (this , "polyglot_remove_member" , name );
668
660
} catch (RaiseException e ) {
669
661
throw translateRubyException .execute (e , name );
670
662
}
@@ -675,7 +667,7 @@ public void removeMember(String name,
675
667
throw UnknownIdentifierException .create (name );
676
668
}
677
669
try {
678
- removeInstanceVariableNode .call (this , "remove_instance_variable" , rubyName );
670
+ removeInstanceVariableNode .call (this , "remove_instance_variable" , name );
679
671
} catch (RaiseException e ) { // raises only if the name is missing
680
672
// concurrent change in whether the member is removable
681
673
errorProfile .enter ();
@@ -690,13 +682,11 @@ public Object invokeMember(String name, Object[] arguments,
690
682
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchMember ,
691
683
@ Exclusive @ Cached ForeignToRubyArgumentsNode foreignToRubyArgumentsNode ,
692
684
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
693
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
694
685
@ Shared ("translateRubyException" ) @ Cached TranslateInteropRubyExceptionNode translateRubyException ,
695
686
@ Shared ("errorProfile" ) @ Cached BranchProfile errorProfile )
696
687
throws UnknownIdentifierException , UnsupportedTypeException , UnsupportedMessageException , ArityException {
697
688
Object [] convertedArguments = foreignToRubyArgumentsNode .executeConvert (arguments );
698
- Object rubyName = nameToRubyNode .executeConvert (name );
699
- Object [] combinedArguments = ArrayUtils .unshift (convertedArguments , rubyName );
689
+ Object [] combinedArguments = ArrayUtils .unshift (convertedArguments , name );
700
690
Object dynamic ;
701
691
try {
702
692
dynamic = dispatchDynamic .call (this , "polyglot_invoke_member" , combinedArguments );
@@ -720,12 +710,10 @@ public boolean isMemberReadable(String name,
720
710
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
721
711
@ Cached @ Shared ("definedNode" ) InternalRespondToNode definedNode ,
722
712
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
723
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
724
713
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
725
714
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
726
715
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
727
- Object rubyName = nameToRubyNode .executeConvert (name );
728
- Object dynamic = dispatchNode .call (this , "polyglot_member_readable?" , rubyName );
716
+ Object dynamic = dispatchNode .call (this , "polyglot_member_readable?" , name );
729
717
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
730
718
if (ivarFoundProfile .profile (objectLibrary .containsKey (this , name ))) {
731
719
return true ;
@@ -743,10 +731,8 @@ public boolean isMemberModifiable(String name,
743
731
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
744
732
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
745
733
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
746
- @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
747
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ) {
748
- Object rubyName = nameToRubyNode .executeConvert (name );
749
- Object dynamic = dispatchNode .call (this , "polyglot_member_modifiable?" , rubyName );
734
+ @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ) {
735
+ Object dynamic = dispatchNode .call (this , "polyglot_member_modifiable?" , name );
750
736
return isMemberModifiableRemovable (
751
737
dynamic ,
752
738
name ,
@@ -762,10 +748,8 @@ public boolean isMemberRemovable(String name,
762
748
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
763
749
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
764
750
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
765
- @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
766
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ) {
767
- Object rubyName = nameToRubyNode .executeConvert (name );
768
- Object dynamic = dispatchNode .call (this , "polyglot_member_removable?" , rubyName );
751
+ @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ) {
752
+ Object dynamic = dispatchNode .call (this , "polyglot_member_removable?" , name );
769
753
return isMemberModifiableRemovable (
770
754
dynamic ,
771
755
name ,
@@ -798,10 +782,8 @@ public boolean isMemberInsertable(String name,
798
782
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
799
783
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
800
784
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
801
- @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
802
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ) {
803
- Object rubyName = nameToRubyNode .executeConvert (name );
804
- Object dynamic = dispatchNode .call (this , "polyglot_member_insertable?" , rubyName );
785
+ @ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ) {
786
+ Object dynamic = dispatchNode .call (this , "polyglot_member_insertable?" , name );
805
787
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
806
788
if (rubyLibrary .isFrozen (this ) || !isIVar (name )) {
807
789
return false ;
@@ -818,12 +800,10 @@ public boolean isMemberInvocable(String name,
818
800
@ CachedLibrary ("this" ) DynamicObjectLibrary objectLibrary ,
819
801
@ Cached @ Shared ("definedNode" ) InternalRespondToNode definedNode ,
820
802
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
821
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
822
803
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
823
804
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
824
805
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
825
- Object rubyName = nameToRubyNode .executeConvert (name );
826
- Object dynamic = dispatchNode .call (this , "polyglot_member_invocable?" , rubyName );
806
+ Object dynamic = dispatchNode .call (this , "polyglot_member_invocable?" , name );
827
807
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
828
808
Object iVar = objectLibrary .getOrDefault (this , name , null );
829
809
if (ivarFoundProfile .profile (iVar != null )) {
@@ -842,12 +822,10 @@ public boolean isMemberInternal(String name,
842
822
@ Cached @ Shared ("definedNode" ) InternalRespondToNode definedNode ,
843
823
@ Exclusive @ Cached (parameters = "PUBLIC" ) InternalRespondToNode definedPublicNode ,
844
824
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
845
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
846
825
@ Exclusive @ Cached BooleanCastNode booleanCastNode ,
847
826
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
848
827
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
849
- Object rubyName = nameToRubyNode .executeConvert (name );
850
- Object dynamic = dispatchNode .call (this , "polyglot_member_internal?" , rubyName );
828
+ Object dynamic = dispatchNode .call (this , "polyglot_member_internal?" , name );
851
829
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
852
830
Object result = objectLibrary .getOrDefault (this , name , null );
853
831
if (ivarFoundProfile .profile (result != null )) {
@@ -864,12 +842,10 @@ public boolean isMemberInternal(String name,
864
842
865
843
@ ExportMessage
866
844
public boolean hasMemberReadSideEffects (String name ,
867
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
868
845
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
869
846
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
870
847
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
871
- Object rubyName = nameToRubyNode .executeConvert (name );
872
- Object dynamic = dispatchNode .call (this , "polyglot_has_member_read_side_effects?" , rubyName );
848
+ Object dynamic = dispatchNode .call (this , "polyglot_has_member_read_side_effects?" , name );
873
849
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
874
850
return false ;
875
851
} else {
@@ -879,12 +855,10 @@ public boolean hasMemberReadSideEffects(String name,
879
855
880
856
@ ExportMessage
881
857
public boolean hasMemberWriteSideEffects (String name ,
882
- @ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ,
883
858
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode dispatchNode ,
884
859
@ Shared ("dynamicProfile" ) @ Cached ConditionProfile dynamicProfile ,
885
860
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
886
- Object rubyName = nameToRubyNode .executeConvert (name );
887
- Object dynamic = dispatchNode .call (this , "polyglot_has_member_write_side_effects?" , rubyName );
861
+ Object dynamic = dispatchNode .call (this , "polyglot_has_member_write_side_effects?" , name );
888
862
if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
889
863
return false ;
890
864
} else {
0 commit comments