index 401196595b08b739401d9e39e82ec6d80c9d2ace..189d8d275421b67a4fc2081d664c37ccf4149fc7 100644 (file)
@@ -1141,8 +1141,11 @@ jvm_generate_cast_type(gen_proc_t * p, oberon_type_t * from, oberon_type_t * to)
{
if(to -> class == OBERON_TYPE_RECORD || to -> class == OBERON_TYPE_POINTER)
{
{
if(to -> class == OBERON_TYPE_RECORD || to -> class == OBERON_TYPE_POINTER)
{
- char * full_name = jvm_get_class_full_name(to);
- jvm_generate(p, 1, 1, "checkcast %s", full_name);
+ if(to -> class == OBERON_TYPE_POINTER && to -> base -> class == OBERON_TYPE_RECORD)
+ {
+ char * full_name = jvm_get_class_full_name(to);
+ jvm_generate(p, 1, 1, "checkcast %s", full_name);
+ }
}
else
{
}
else
{
jvm_generate(p, 2 * cell_size, 1, "%ccmp%c", prefix, fop);
jvm_generate(p, 1, 1, "if%s L%i", cmpop, label_true);
}
jvm_generate(p, 2 * cell_size, 1, "%ccmp%c", prefix, fop);
jvm_generate(p, 1, 1, "if%s L%i", cmpop, label_true);
}
+ else if(prefix == 'a')
+ {
+ if(t -> class == OBERON_TYPE_STRING
+ || (t -> class == OBERON_TYPE_POINTER && t -> base -> class == OBERON_TYPE_CHAR))
+ {
+ jvm_generate(p, 2, 1, "invokestatic SYSTEM/STRCMP([B[B)I");
+ jvm_generate(p, 1, 0, "if%s L%i", cmpop, label_true);
+ }
+ else
+ {
+ jvm_generate(p, 1, 0, "if_acmp%s L%i", cmpop, label_true);
+ }
+ }
else
{
jvm_generate(p, 2 * cell_size, 0, "if_%ccmp%s L%i", prefix, cmpop, label_true);
else
{
jvm_generate(p, 2 * cell_size, 0, "if_%ccmp%s L%i", prefix, cmpop, label_true);
@@ -1687,6 +1703,19 @@ oberon_generate_assert_n(oberon_context_t * ctx, oberon_expr_t * cond, int64_t n
jvm_generate(p, 1 + 2, 0, "invokestatic SYSTEM/ASSERT(ZJ)V");
}
jvm_generate(p, 1 + 2, 0, "invokestatic SYSTEM/ASSERT(ZJ)V");
}
+void
+oberon_generate_trap(oberon_context_t * ctx, int64_t n)
+{
+ gen_module_t * m;
+ gen_proc_t * p;
+
+ m = ctx -> mod -> gen_mod;
+ p = m -> class -> p;
+
+ jvm_generate_push_int_size(p, n, 8);
+ jvm_generate(p, 2, 0, "invokestatic SYSTEM/TRAP(J)V");
+}
+
void
oberon_generate_halt(oberon_context_t * ctx, int64_t n)
{
void
oberon_generate_halt(oberon_context_t * ctx, int64_t n)
{