Skip to content

Commit e25eb40

Browse files
committed
WIP stringFromField.dex
1 parent a4bdd28 commit e25eb40

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

dclass.nim

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ let
3434

3535
classes_dex:
3636
dclass com.akavel.hello2.HelloActivity {.public.} of Activity:
37-
proc `<clinit>`() {.static, constructor, regs:2, ins:0, outs:1.} =
38-
# System.loadLibrary("hello-mello")
39-
const_string(0, "hello-mello")
40-
invoke_static(0, jproto System.loadLibrary(String))
41-
return_void()
37+
# proc `<clinit>`() {.static, constructor, regs:2, ins:0, outs:1.} =
38+
# # System.loadLibrary("hello-mello")
39+
# const_string(0, "hello-mello")
40+
# invoke_static(0, jproto System.loadLibrary(String))
41+
# return_void()
4242
proc `<init>`() {.public, constructor, regs:1, ins:1, outs:1.} =
4343
invoke_direct(0, jproto Activity.`<init>`())
4444
return_void()
@@ -49,19 +49,21 @@ classes_dex:
4949
# v0 = new TextView(this)
5050
new_instance(0, TextView)
5151
invoke_direct(0, 2, jproto TextView.`<init>`(Context))
52-
# v1 = this.stringFromJNI()
53-
# NOTE: failure to call a Native function should result in
54-
# java.lang.UnsatisfiedLinkError exception
55-
invoke_virtual(2, jproto HelloActivity.stringFromJNI() -> String)
52+
# # v1 = this.stringFromJNI()
53+
# # NOTE: failure to call a Native function should result in
54+
# # java.lang.UnsatisfiedLinkError exception
55+
# invoke_virtual(2, jproto HelloActivity.stringFromJNI() -> String)
56+
# move_result_object(1)
57+
invoke_virtual(2, jproto HelloActivity.stringFromField() -> String)
5658
move_result_object(1)
5759
# v0.setText(v1)
5860
invoke_virtual(0, 1, jproto TextView.setText(CharSequence))
5961
# this.setContentView(v0)
6062
invoke_virtual(2, 0, jproto HelloActivity.setContentView(View))
6163
# return
6264
return_void()
63-
proc stringFromJNI(): jstring {.public, native.} =
64-
return jenv.NewStringUTF(jenv, "Hello from Nim dclass :D")
65+
# proc stringFromJNI(): jstring {.public, native.} =
66+
# return jenv.NewStringUTF(jenv, "Hello from Nim dclass :D")
6567

6668
proc stringFromField(): jstring {.regs:4, ins:1, outs:3.} =
6769
# this.nimSelf = (long)42

0 commit comments

Comments
 (0)