Skip to content

Commit

Permalink
Use raw strings so JIT at least finds the method. This uncovers a wri…
Browse files Browse the repository at this point in the history
…nkle in

our strategy.  Errors are generated from the search deep in Module but it is a
raw String.  This is somewhat ok for most strings because they just happen to be
utf-8 so the display.  This is a big issue though since we want proper error
message....
enebo committed Jan 11, 2018
1 parent 0f96a52 commit fae1a96
Showing 2 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/ir/instructions/CallBase.java
Original file line number Diff line number Diff line change
@@ -95,6 +95,13 @@ public String getName() {
return StringSupport.byteListAsString(name);
}

/**
* Return 8859_1 string since this is what method table stores now.
*/
public String getRawName() {
return name.toString();
}

public ByteList getByteName() {
return name;
}
18 changes: 9 additions & 9 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -564,7 +564,7 @@ public void AttrAssignInstr(AttrAssignInstr attrAssignInstr) {

compileCallCommon(
jvmMethod(),
attrAssignInstr.getName(),
attrAssignInstr.getRawName(),
callArgs,
attrAssignInstr.getReceiver(),
callArgs.length,
@@ -1058,7 +1058,7 @@ public void CallInstr(CallInstr callInstr) {
}

IRBytecodeAdapter m = jvmMethod();
String name = callInstr.getName();
String name = callInstr.getRawName();
Operand[] args = callInstr.getCallArgs();
Operand receiver = callInstr.getReceiver();
int numArgs = args.length;
@@ -1158,7 +1158,7 @@ public void CheckForLJEInstr(CheckForLJEInstr checkForljeinstr) {

@Override
public void ClassSuperInstr(ClassSuperInstr classsuperinstr) {
String name = classsuperinstr.getName();
String name = classsuperinstr.getRawName();
Operand[] args = classsuperinstr.getCallArgs();
Operand definingModule = classsuperinstr.getDefiningModule();
boolean[] splatMap = classsuperinstr.splatMap();
@@ -1403,7 +1403,7 @@ public void InheritanceSearchConstInstr(InheritanceSearchConstInstr inheritances

@Override
public void InstanceSuperInstr(InstanceSuperInstr instancesuperinstr) {
String name = instancesuperinstr.getName();
String name = instancesuperinstr.getRawName();
Operand[] args = instancesuperinstr.getCallArgs();
Operand definingModule = instancesuperinstr.getDefiningModule();
boolean[] splatMap = instancesuperinstr.splatMap();
@@ -1526,7 +1526,7 @@ public void NopInstr(NopInstr nopinstr) {
@Override
public void NoResultCallInstr(NoResultCallInstr noResultCallInstr) {
IRBytecodeAdapter m = jvmMethod();
String name = noResultCallInstr.getName();
String name = noResultCallInstr.getRawName();
Operand[] args = noResultCallInstr.getCallArgs();
Operand receiver = noResultCallInstr.getReceiver();
int numArgs = args.length;
@@ -1539,7 +1539,7 @@ public void NoResultCallInstr(NoResultCallInstr noResultCallInstr) {

public void oneFixnumArgNoBlockCallInstr(OneFixnumArgNoBlockCallInstr oneFixnumArgNoBlockCallInstr) {
IRBytecodeAdapter m = jvmMethod();
String name = oneFixnumArgNoBlockCallInstr.getName();
String name = oneFixnumArgNoBlockCallInstr.getRawName();
long fixnum = oneFixnumArgNoBlockCallInstr.getFixnumArg();
Operand receiver = oneFixnumArgNoBlockCallInstr.getReceiver();
Variable result = oneFixnumArgNoBlockCallInstr.getResult();
@@ -1564,7 +1564,7 @@ public void oneFixnumArgNoBlockCallInstr(OneFixnumArgNoBlockCallInstr oneFixnumA

public void oneFloatArgNoBlockCallInstr(OneFloatArgNoBlockCallInstr oneFloatArgNoBlockCallInstr) {
IRBytecodeAdapter m = jvmMethod();
String name = oneFloatArgNoBlockCallInstr.getName();
String name = oneFloatArgNoBlockCallInstr.getRawName();
double flote = oneFloatArgNoBlockCallInstr.getFloatArg();
Operand receiver = oneFloatArgNoBlockCallInstr.getReceiver();
Variable result = oneFloatArgNoBlockCallInstr.getResult();
@@ -2216,7 +2216,7 @@ public void UndefMethodInstr(UndefMethodInstr undefmethodinstr) {

@Override
public void UnresolvedSuperInstr(UnresolvedSuperInstr unresolvedsuperinstr) {
String name = unresolvedsuperinstr.getName();
String name = unresolvedsuperinstr.getRawName();
Operand[] args = unresolvedsuperinstr.getCallArgs();
// this would be getDefiningModule but that is not used for unresolved super
Operand definingModule = UndefinedValue.UNDEFINED;
@@ -2260,7 +2260,7 @@ public void YieldInstr(YieldInstr yieldinstr) {

@Override
public void ZSuperInstr(ZSuperInstr zsuperinstr) {
String name = zsuperinstr.getName();
String name = zsuperinstr.getRawName();
Operand[] args = zsuperinstr.getCallArgs();
// this would be getDefiningModule but that is not used for unresolved super
Operand definingModule = UndefinedValue.UNDEFINED;

0 comments on commit fae1a96

Please sign in to comment.