Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions dev/import-perl5/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ imports:
type: directory

# Specific patched files (applied after directory import above)
- source: perl5/t/test.pl
target: perl5_t/t/test.pl
patch: test.pl.patch

- source: perl5/t/re/pat.t
target: perl5_t/t/re/pat.t
patch: pat.t.patch
Expand Down
64 changes: 0 additions & 64 deletions dev/import-perl5/patches/test.pl.patch

This file was deleted.

38 changes: 38 additions & 0 deletions src/main/java/org/perlonjava/codegen/EmitBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,44 @@ public static void emitBlock(EmitterVisitor emitterVisitor, BlockNode node) {
element.accept(voidVisitor);
}

// Check for non-local control flow after each statement in labeled blocks
// Only for simple blocks to avoid ASM VerifyError
if (node.isLoop && node.labelName != null && i < list.size() - 1 && list.size() <= 3) {
// Check if block contains loop constructs (they handle their own control flow)
boolean hasLoopConstruct = false;
for (Node elem : list) {
if (elem instanceof For1Node || elem instanceof For3Node) {
hasLoopConstruct = true;
break;
}
}

if (!hasLoopConstruct) {
Label continueBlock = new Label();

// if (!RuntimeControlFlowRegistry.hasMarker()) continue
mv.visitMethodInsn(Opcodes.INVOKESTATIC,
"org/perlonjava/runtime/RuntimeControlFlowRegistry",
"hasMarker",
"()Z",
false);
mv.visitJumpInsn(Opcodes.IFEQ, continueBlock);

// Has marker: check if it matches this loop
mv.visitLdcInsn(node.labelName);
mv.visitMethodInsn(Opcodes.INVOKESTATIC,
"org/perlonjava/runtime/RuntimeControlFlowRegistry",
"checkLoopAndGetAction",
"(Ljava/lang/String;)I",
false);

// If action != 0, jump to nextLabel (exit block)
mv.visitJumpInsn(Opcodes.IFNE, nextLabel);

mv.visitLabel(continueBlock);
}
}

// NOTE: Registry checks are DISABLED in EmitBlock because:
// 1. They cause ASM frame computation errors in nested/refactored code
// 2. Bare labeled blocks (like TODO:) don't need non-local control flow
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/perlonjava/parser/StatementParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ public static Node parseIfStatement(Parser parser) {
elseBranch = parseIfStatement(parser);
}

// Use a macro to emulate Test::More SKIP blocks
TestMoreHelper.handleSkipTest(parser, thenBranch);

return new IfNode(operator.text, condition, thenBranch, elseBranch, parser.tokenIndex);
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/perlonjava/parser/StatementResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,6 @@ yield dieWarnNode(parser, "die", new ListNode(List.of(

parser.ctx.symbolTable.exitScope(scopeIndex);

if (label != null && label.equals("SKIP")) {
// Use a macro to emulate Test::More SKIP blocks
TestMoreHelper.handleSkipTest(parser, block);
}

yield new For3Node(label,
true,
null, null,
Expand Down
52 changes: 0 additions & 52 deletions src/main/java/org/perlonjava/parser/TestMoreHelper.java

This file was deleted.

13 changes: 3 additions & 10 deletions src/main/perl/lib/Test/More.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ our @EXPORT = qw(
pass fail diag note done_testing is_deeply subtest
use_ok require_ok BAIL_OUT
skip
skip_internal
eq_array eq_hash eq_set
);

Expand Down Expand Up @@ -286,21 +285,15 @@ sub BAIL_OUT {
exit 255;
}

sub skip {
die "Test::More::skip() is not implemented";
}

# Workaround to avoid non-local goto (last SKIP).
# The skip_internal subroutine is called from a macro in TestMoreHelper.java
#
sub skip_internal {
sub skip($;$) {
my ($name, $count) = @_;
$count ||= 1;
for (1..$count) {
$Test_Count++;
my $result = "ok";
print "$Test_Indent$result $Test_Count # skip $name\n";
}
return 1;
last SKIP;
}

# Legacy comparison functions - simple implementations using is_deeply
Expand Down
Loading